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 | |
parent | Add rough untested implementation for b32d (diff) | |
download | base32asm-5b8ba5a949627183c116d8216cfc6f2af0ea4d9b.tar.gz base32asm-5b8ba5a949627183c116d8216cfc6f2af0ea4d9b.zip |
-rw-r--r-- | b32e.asm | 22 | ||||
-rw-r--r-- | makefile | 14 |
2 files changed, 21 insertions, 15 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 @@ -2,7 +2,14 @@ all: b32e b32d .PHONY: test -test: b32e b32d +test: b32e + echo "hello!" | ./b32e + @printf '\n' + echo "hello!" | base32 -w0 + @printf '\n' + +.PHONY: ftest +ftest: b32e b32d cat makefile | ./b32e > makefile.b32 cat makefile | base32 -w 0 > makefile.check.b32 diff makefile.b32 makefile.check.b32 @@ -11,6 +18,11 @@ test: b32e b32d @# cat makefile.check.b32 | base32 -d diff makefile makefile.decoded +.PHONY: perftest +perftest: b32e + time cat doc/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf | ./b32e > 64-ia-32-intel2.pdf.b32 + time cat doc/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf | base32 -w 0 > 64-ia-32-intel2.pdf.b32 + # encoder b32e: b32e.o ld -o $@ $< |