started implementing decimal output

This commit is contained in:
Luxferre
2022-07-31 23:36:51 +03:00
parent cf6a6e4259
commit 948b81084a
3 changed files with 26 additions and 15 deletions
+21 -15
View File
@@ -75,27 +75,33 @@
INC2 ,&loop JMP
&eof POP2 JMP2r
( convert true hex short value to BCD - up to 9999 represented by #270f coded into #9999 )
( convert BCD to hex value )
( output decimal short )
( draw decimal short )
@print-dec ( x y value* -- x y )
STH2 ( value* -- )
#00 ,&zero STR
SWP2 ,&coords STR2 ( value* -- )
#2710 ,&parse JSR
#03e8 ,&parse JSR
#0064 ,&parse JSR
#000a ,&parse JSR
,&emit JSR POP
STH2r
JMP2r
&parse DIV2k DUP ,&emit JSR MUL2 SUB2 JMP2r
&emit
DUP [ LIT &zero $1 ] #0000 EQU2 ,&skip JCN
#01 ,&zero STR DUP #30 ADD STH2r ROT ;putc STH2 JSR2 &skip POP JMP2r
NIP ,&emit JSR
,&coords LDR2
JMP2r
&parse
DIV2k ( value* divisor* -- value* divisor* div* )
DUP ( value* divisor* div* divlonib -- )
,&emit JSR ( value* divisor* div* -- )
MUL2 ( value* divisor* div* -- value* wholevalue* )
SUB2 ( value* wholevalue* -- rem* )
JMP2r
&emit
#30 ADD
,&coords LDR2
ROT
;putc JSR2
,&coords STR2
JMP2r
LIT &coords $2
( nanofont glyphs for ESOP, courtesy of Michaelangel007 )
( the basic 96 nanofont glyphs for ESOP, courtesy of Michaelangel007 )
@nanofont
0000 4400 aa00 aee0 64c4 ce60 4c60 4000 4840 4240 6600 4e40 0088 0e00 0080 2480