aboutsummaryrefslogtreecommitdiffstats
path: root/cat.s
diff options
context:
space:
mode:
authorturret <turret@duck.com>2023-09-13 11:06:26 -0500
committerturret <turret@duck.com>2023-09-13 11:06:26 -0500
commit865f913eb14a358bb44b93eb54a46edad6c1950d (patch)
tree59a5a04cabdcd4ae013801fd1e2e01737c1b45f2 /cat.s
parent593c9b4918c70d2d356c297120a3d77239dee41a (diff)
downloadcat-865f913eb14a358bb44b93eb54a46edad6c1950d.tar.gz
cat-865f913eb14a358bb44b93eb54a46edad6c1950d.tar.bz2
cat-865f913eb14a358bb44b93eb54a46edad6c1950d.zip
cat: still unfinsihed impl but some work donw
Diffstat (limited to 'cat.s')
-rw-r--r--cat.s31
1 files changed, 20 insertions, 11 deletions
diff --git a/cat.s b/cat.s
index 78f4ff6..e9bb318 100644
--- a/cat.s
+++ b/cat.s
@@ -23,9 +23,9 @@ process_fd:
mov r11, r13
and r11, showends
cmp r11, 1
- jl .skipshowends
mov rcx, [r10]
and rcx, 0xff
+ jl .skipshowends
cmp rcx, 0x0a
jne .skipshowends
call .flushbuf
@@ -41,33 +41,42 @@ process_fd:
and r11, shownonprinting
cmp r11, 1
jl .skipnonprinting
- mov rcx, [r10]
- and rcx, 0xff
+ cmp rcx, 0x0a
+ je .skipnonprinting
+.docaret:
cmp rcx, 127
jge .showendsm
cmp rcx, 0x20
jge .skipnonprinting
; carrot notation (less than 0x20)
- or rcx, 0x40
+ xor rcx, 0x40
ror rcx, 8
or rcx, "^"
and rcx, 0xffff
mov [smallbuf], rcx
mov rax, smallbuf
call outpstring
+ cmp r9, r10
+ je .skipnonprinting
+ dec r9
+ call .flushbuf
+ inc r10
+ inc r9
+ dec r8
jmp .skipnonprinting
.showendsm:
; M- notation
je .eq127
- sub rcx, 128
- ror rcx, 16
- or rcx, "M-"
- and rcx, 0xffffff
- mov [smallbuf], rcx
+ xor rdi, rdi
+ or rdi, "M-"
+ and rcx, 0xffff
+ mov [smallbuf], rdi
mov rax, smallbuf
call outpstring
-
- jmp .skipnonprinting
+ mov rcx, [r10]
+ and rcx, 0xff
+ sub rcx, 128
+ jmp .docaret
.eq127:
xor rcx, rcx
mov rcx, "^?"