From 183c2930eb2c0acc8797c765149222ab71eca3df Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Wed, 5 Jun 2024 10:39:58 -0800 Subject: [PATCH] (base64) Fixed issue where ends too early --- cli/base64/b64enc.tal | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/cli/base64/b64enc.tal b/cli/base64/b64enc.tal index ed23cef..3c3a23f 100644 --- a/cli/base64/b64enc.tal +++ b/cli/base64/b64enc.tal @@ -1,25 +1,21 @@ ( uxncli b64enc.rom data ) |10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1 - -|0000 +|000 @queue $1 -|0100 +|100 @on-reset ( -> ) ;on-console .Console/vector DEO2 BRK @on-console ( -> ) - .Console/read DEI DUP ?{ - &terminate ( -> ) - .queue LDZ EQU ?{ #00 } - #800f DEO - BRK } - - .Console/type DEI #04 EQU ?&terminate + .Console/type DEI #04 EQU ?{ .Console/read DEI + BRK } + .queue LDZ EQU ?{ #00 } + #800f DEO BRK ( @@ -28,21 +24,17 @@ @ ( byte -- ) ,&buf STR #0800 - &l ( -- ) + &>l ( -- ) [ LIT &buf $1 ] OVR #07 SWP SUB SFT #01 AND - [ LIT &inc $1 ] INCk #06 DIVk MUL SUB ,&inc STR - ( bit id -- ) - SWP .queue LDZ ORA DUP ADD .queue STZ + ( ) [ LIT &inc $1 ] INCk #06 DIVk MUL SUB ,&inc STR + ( bit id -- ) SWP .queue LDZ ORA DUP ADD .queue STZ #05 NEQ ?{ - [ LIT2 00 -queue ] - DUP2 LDZ #01 SFT ;MIME ADD2 LDA #18 DEO - STZ } - INC GTHk ?&l + [ LIT2 00 -queue ] DUP2 LDZ #01 SFT ;MIME ADD2 LDA #18 DEO + STZ } + INC GTHk ?&>l POP2 JMP2r @MIME [ - "ABCDEFGHIJKLMNOP - "QRSTUVWXYZabcdef - "ghijklmnopqrstuv - "wxyz0123456789+/ ] + "ABCDEFGHIJKLMNOP "QRSTUVWXYZabcdef + "ghijklmnopqrstuv "wxyz0123456789+/ ]