diff options
-rw-r--r-- | b32e.asm | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -49,19 +49,19 @@ b32e: xor rbx, rbx ; get a byte from the input - mov bl, byte [input_buffer] + mov bl, byte [input_buffer + 4] ; mask and shift to get 5 bits which is a number in 0 ~ 31 and bl, 0xf8 shr bl, 3 - ; rshift the input buffer - shr qword [input_buffer], 5 + ; shift left the input buffer + shl qword [input_buffer], 5 ; convert to base32 add rbx, rfc4648 mov dl, byte [rbx] - mov [output_buffer + r11], dl + mov byte [output_buffer + r11], dl ; increase counter inc r11 @@ -85,6 +85,13 @@ _start: cmp rax, 0 je .exit + ; swap endianness of input + mov rax, qword [input_buffer] + bswap rax + ; correct position in qword + shr rax, 24 + mov qword [input_buffer], rax + ; convert to base 32 call b32e ; print |