diff options
author | Nao Pross <naopross@thearcway.org> | 2018-12-04 21:51:39 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2018-12-04 21:51:39 +0100 |
commit | 5b8ba5a949627183c116d8216cfc6f2af0ea4d9b (patch) | |
tree | 39a135a1056a53adc0da424a6dfc4566d5d26da1 /b32e.asm | |
parent | Add rough untested implementation for b32d (diff) | |
download | base32asm-master.tar.gz base32asm-master.zip |
Diffstat (limited to 'b32e.asm')
-rw-r--r-- | b32e.asm | 22 |
1 files changed, 8 insertions, 14 deletions
@@ -43,10 +43,12 @@ write_output: b32e: ; save the number of bits read in cl mov bl, 8 ; each byte contains 8 bits - mul bl + mul bl ; multiply al by 8 mov cl, al ; set up output counter xor r11, r11 + ; set up processed bit counter + xor ch, ch ; initialize output buffer with padding mov rbx, 0x3d3d3d3d3d3d3d3d mov qword [output_buffer], rbx @@ -70,21 +72,13 @@ b32e: mov bl, byte [rbx] mov byte [output_buffer + r11], bl - ; increase counter + ; increase output counter inc r11 + ; increase bit counter + add ch, 5 - ; check number of bits converted >= bits read - mov bl, 5 ; each iteration processed 5 bits - mov rax, r11 - mul bl - cmp al, cl - jge .exit - - ; check counter - ; when the counter reaches 8 it means that 8 characters (40 bits) - ; have been processed and written - cmp r11, 8 - jl .loop + cmp ch, cl + jl .loop .exit: ret |