summaryrefslogtreecommitdiffstats
path: root/b32e.asm
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--b32e.asm22
1 files changed, 8 insertions, 14 deletions
diff --git a/b32e.asm b/b32e.asm
index 8bab796..1e1b7a9 100644
--- a/b32e.asm
+++ b/b32e.asm
@@ -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