From 593c9b4918c70d2d356c297120a3d77239dee41a Mon Sep 17 00:00:00 2001 From: turret Date: Tue, 12 Sep 2023 11:06:36 -0500 Subject: cat: still unfinish impl + optimizations --- cat.s | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/cat.s b/cat.s index fa2a839..78f4ff6 100644 --- a/cat.s +++ b/cat.s @@ -34,6 +34,7 @@ process_fd: mov [smallbuf], rcx mov rax, smallbuf call outpstring + jmp .skipnonprinting .skipshowends: ; SHOWNONPRINTING mov r11, r13 @@ -44,25 +45,24 @@ process_fd: and rcx, 0xff cmp rcx, 127 jge .showendsm - mov rcx, [r10] - and rcx, 0xff cmp rcx, 0x20 jge .skipnonprinting - ; carrot notation - cmp rcx, 10 - je .skipnonprinting -.showendsm: - ; M- notation - je .eq127 - xor rcx, rcx - mov rcx, "M-" + ; carrot notation (less than 0x20) + or rcx, 0x40 + ror rcx, 8 + or rcx, "^" + and rcx, 0xffff mov [smallbuf], rcx mov rax, smallbuf call outpstring - xor rcx, rcx - mov rcx, [r10] - and rcx, 0xff + jmp .skipnonprinting +.showendsm: + ; M- notation + je .eq127 sub rcx, 128 + ror rcx, 16 + or rcx, "M-" + and rcx, 0xffffff mov [smallbuf], rcx mov rax, smallbuf call outpstring -- cgit v1.2.3