top decor
ROM subroutines Print integer number


addr code mnemonic action comments
EE0...80E072 EA00SETH $72, 0000$72 <== EA00set the address of the last
buffer byte (system RAM)
84E772 007FINCL $72, 007F$1 <== $72 + 7F
88E373 0024SETL $73, 0024$73 <== 24put '$' (the ending symbol)
to buffer
8CA373 7200STBUI $73, $72, 00($72) <== $73
904871 0003BNN $71, 0003branch to 9C if $71 >= 0bypass if sign is plus
94E373 002DSETL $73, 002D$73 <== 2Dprint '-'
980005 0273TRAP 5/02, $73call system function: print symbol
9C1D74 710ADIVI $74, $71, 0A$74 <== $71 / 10put the quotient into $74
A01973 740AMULI $73, $74, 0A$73 <== $74 * 10remainder into $73
A42473 7173SUB $73, $71, $73$73 <== $71 - $73
A84871 0003BNN $71, 0003branch to B4 if $71 >= 0bypass for positive numbers
ACC573 7300NORI $73, $73, 00$73 <== NOT $73make $73 positive
B0E773 0001INCL $73, 0001$73 <== $73 + 1
B42173 7330ADDI $73, $73, 30$73 <== $73 + 30form digit code
B82572 7201SUBI $72, $72, 01$72 <== $72 - 1save current symbol to buffer
BCA373 7200STBUI $73, $72, 00($72) <== $73
C02171 7400ADDI $71, $74, 00$71 <== $74copy the result to $71
C44B71 FFF6BNZB $71, FFF6branch to 9C if $71 <> 0repeat the cycle
C80005 0972TRAP 5/09, $72call system function: print stringprint the result string from buffer
CC9F6F 6F00GOI $6F, $6F, 0 return using $6F(finish subroutine)

back previous page next page forward


Related topics:

E-MMI software
 

  (C) 2003, Evgeny Eremin. rEd-MMI project documentation