From a9d96063f65221feeb4469ca075b0178af004125 Mon Sep 17 00:00:00 2001 From: janis Date: Thu, 4 Jun 2026 07:44:45 +0200 Subject: [PATCH] fix jmp rel again --- stages/hex0/hex0.in | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/stages/hex0/hex0.in b/stages/hex0/hex0.in index 2fb8a7f..dd179ed 100644 --- a/stages/hex0/hex0.in +++ b/stages/hex0/hex0.in @@ -78,7 +78,7 @@ # cmp rax, 0 48 83 f8 00 # jle die -0f 8e a8 00 00 00 +0f 8e b0 00 00 00 ## (162) # ; end = r8 # mov r8, rax @@ -98,32 +98,37 @@ # cmp r9, r8 4d 39 c1 # jge .L3 -0f 8d 67 00 00 00 +0f 8d 6f 00 00 00 # (190) # # ; if (*pos == '#') { # mov al , byte [r9] 41 8a 41 00 +# cmp al, '\n' +3c 0a +# je .L2.1: +0f 84 15 00 00 00 +# (202) # cmp al, '#' 3c 23 # jne .L1 0f 85 15 00 00 00 -# (202) +# (210) # ; while (*pos != '\n') pos++; -# ; .L2: (202) +# ; .L2: (210) # inc r9 49 ff c1 # cmp byte [r9], '\n' 41 80 39 0a # jne .L2 0f 85 f3 ff ff ff -# (215) +# .L2.1: (223) # inc r9 49 ff c1 # jmp .L0 -e9 d6 ff ff ff -# (223) -# ; .L1: (223) +e9 ce ff ff ff +# (231) +# ; .L1: (231) # ; convert *pos to high word # mov al, byte [r9] 41 8a 01 @@ -173,13 +178,13 @@ c0 e0 04 # cmp byte [r9], '\n' 41 80 39 0a # je .L0 -0f 84 95 ff ff ff -## (288) -# jmp .L1 ; - 293 +0f 84 8d ff ff ff +## (296) +# jmp .L1 ; e9 ba ff ff ff -## (293) +## (301) # ; } -# .L3: (293) +# .L3: (301) # ; write the decoded bytes to stdout # mov rax, 1 (sys_write) 48 c7 c0 01 00 00 00 @@ -195,11 +200,11 @@ e9 ba ff ff ff 48 29 f2 # syscall 0f 05 -# jmp .READ ; 130 - 330 = -200 = 0xffffffffffffff38 -e9 38 ff ff ff -## (330) +# jmp .READ ; +e9 30 ff ff ff +## (338) # -# die: (330) +# die: (338) # mov rax, 60 (sys_exit) 48 c7 c0 3c 00 00 00 # xor rdi, rdi