|
|
ROM subroutines
Print integer number
|
|
addr |
code |
mnemonic |
action |
comments |
EE0...80 | E072 EA00 | SETH $72, 0000 | $72 <== EA00 | set the address of the last buffer byte (system RAM) |
84 | E772 007F | INCL $72, 007F | $1 <== $72 + 7F |
88 | E373 0024 | SETL $73, 0024 | $73 <== 24 | put '$' (the ending symbol) to buffer |
8C | A373 7200 | STBUI $73, $72, 00 | ($72) <== $73 |
90 | 4871 0003 | BNN $71, 0003 | branch to 9C if $71 >= 0 | bypass if sign is plus |
94 | E373 002D | SETL $73, 002D | $73 <== 2D | print '-' |
98 | 0005 0273 | TRAP 5/02, $73 | call system function: print symbol |
9C | 1D74 710A | DIVI $74, $71, 0A | $74 <== $71 / 10 | put the quotient into $74 |
A0 | 1973 740A | MULI $73, $74, 0A | $73 <== $74 * 10 | remainder into $73 |
A4 | 2473 7173 | SUB $73, $71, $73 | $73 <== $71 - $73 |
A8 | 4871 0003 | BNN $71, 0003 | branch to B4 if $71 >= 0 | bypass for positive numbers |
AC | C573 7300 | NORI $73, $73, 00 | $73 <== NOT $73 | make $73 positive |
B0 | E773 0001 | INCL $73, 0001 | $73 <== $73 + 1 |
B4 | 2173 7330 | ADDI $73, $73, 30 | $73 <== $73 + 30 | form digit code |
B8 | 2572 7201 | SUBI $72, $72, 01 | $72 <== $72 - 1 | save current symbol to buffer |
BC | A373 7200 | STBUI $73, $72, 00 | ($72) <== $73 |
C0 | 2171 7400 | ADDI $71, $74, 00 | $71 <== $74 | copy the result to $71 |
C4 | 4B71 FFF6 | BNZB $71, FFF6 | branch to 9C if $71 <> 0 | repeat the cycle |
C8 | 0005 0972 | TRAP 5/09, $72 | call system function: print string | print the result string from buffer |
CC | 9F6F 6F00 | GOI $6F, $6F, 0 | return using $6F | (finish subroutine) |
Related topics:
E-MMI software
|
(C) 2003, Evgeny Eremin. rEd-MMI project documentation
|
|