summaryrefslogtreecommitdiffstats
path: root/b32e.asm
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2018-11-27 22:07:14 +0100
committerNao Pross <naopross@thearcway.org>2018-11-27 22:07:14 +0100
commitc85e31163227216e4f33857ddf878142549a3435 (patch)
treeef65b351d2308e17a3f07822fff23065eb05b51e /b32e.asm
parentAdd Intel IA32 x64 instruction set manual (diff)
downloadbase32asm-c85e31163227216e4f33857ddf878142549a3435.tar.gz
base32asm-c85e31163227216e4f33857ddf878142549a3435.zip
Set input buffer to be 8 bytes to fit in a register for shl
Diffstat (limited to 'b32e.asm')
-rw-r--r--b32e.asm7
1 files changed, 5 insertions, 2 deletions
diff --git a/b32e.asm b/b32e.asm
index 04ce671..ada7ff0 100644
--- a/b32e.asm
+++ b/b32e.asm
@@ -4,7 +4,7 @@ rfc4648 db 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'
section .bss
-input_buffer resb 5
+input_buffer resb 8
output_buffer resb 8
section .text
@@ -43,9 +43,12 @@ b32e:
; get 5 bits from the input
xor rbx, rbx
mov bl, byte [input_buffer]
- and bl, 0x1f
+ ; mask and shift to convert to a number 0 ~ 32
+ and bl, 0xf8
+ shr bl, 3
; rshift the input buffer
+ shl qword [input_buffer], 5
; convert to base32
add rbx, rfc4648