summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Osipov <mike.osipov@gmail.com>2019-10-04 14:33:30 +0300
committerMikhail Osipov <mike.osipov@gmail.com>2019-10-04 14:33:30 +0300
commit2d8db366a571bfb191f09f455c8979b23da8ae14 (patch)
tree2bb3256ad26a823a536bdd0e39521731499074b5
parent545e26b41e05372389e5f4f07762f08f9d6b3c88 (diff)
add eol support
-rw-r--r--main.s24
1 files changed, 19 insertions, 5 deletions
diff --git a/main.s b/main.s
index 2d55ef9..45c960a 100644
--- a/main.s
+++ b/main.s
@@ -362,11 +362,23 @@ read_next:
movl -8(%ebp), %edx
movl %esp, %esi
-.read_char:
+.charloop:
lodsb
+ cmpb $0x0a, %al
+ jne 1f
+
+ cmpl $WIDTH, %ecx
+ je .charloop_next
+
+ xorb %al, %al
+ subl %ecx, %edx
+ rep stosb
+ jmp 2f
+
+ 1:
subb $'0, %al
testb $0b11111110, %al
- jnz .inc_count
+ jnz .charloop_next
stosb
decl %ecx
@@ -374,16 +386,18 @@ read_next:
testl %ecx, %ecx
jnz 1f
+ 2:
addl $2, %edi
movl $WIDTH, %ecx
- 1: testl %edx, %edx
+ 1:
+ testl %edx, %edx
jz read_end
-.inc_count:
+.charloop_next:
decl %ebx
testl %ebx, %ebx
- jnz .read_char
+ jnz .charloop
movl %ecx, -4(%ebp)
movl %edx, -8(%ebp)