aboutsummaryrefslogtreecommitdiffstats
path: root/cat.s
diff options
context:
space:
mode:
authorturret <turret@duck.com>2023-09-12 11:06:36 -0500
committerturret <turret@duck.com>2023-09-12 11:06:36 -0500
commit593c9b4918c70d2d356c297120a3d77239dee41a (patch)
treefc3305721b5bef991681c5a33e8785ab3349d0a2 /cat.s
parentcacdc486f78940215c2b57092894777ac88e18a9 (diff)
downloadcat-593c9b4918c70d2d356c297120a3d77239dee41a.tar.gz
cat-593c9b4918c70d2d356c297120a3d77239dee41a.tar.bz2
cat-593c9b4918c70d2d356c297120a3d77239dee41a.zip
cat: still unfinish impl + optimizations
Diffstat (limited to 'cat.s')
-rw-r--r--cat.s26
1 files 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