top decor
ROM subroutines Input integer number


addr code mnemonic action comments
EE0...D0E072 EA00SETH $72, 0000$72 <== EA00set the address of buffer
(in system RAM)
D4E772 0060INCL $72, 0060$72 <== $72 + 60
D8E371 0016SETL $71, 0016$71 <== 16save 2010 to the first byte
of buffer (max string length)
DCA171 7200STBI $71, $72, 00($72) <== $71
E00005 0A72TRAP 5/0A, $72call system function: input stringinput string with number
E4E772 0002INCL $72, 0002$72 <== $72 + 1get first symbol to $71
E88171 7200LDBI $71, $72, 00$71 <== ($72)
EC3171 712D CMPI $71, $71, 2Dcompare $71 and 2D;
result - $71
compare with '-'
F0E373 0001SETL $73, 0001$73 <== 1+1 to sign
F4E374 0000SETL $74, 0000$74 <== 00 to string index
F84A71 0003BNZ $71, 0003branch to 104 if $71 <> 0bypass for positive numbers
FC2573 7302SUBI $73, $73, 02$73 <== $73 - 2-1 to sign
100E774 0001INCL $74, 0001$74 <== $74 + 11 to string index
104E371 0000SETL $71, 0000$71 <== 00 to result
1088275 7274LDBU $75, $72, $74$75 <== ($72 + $74)get current symbol from buffer
10C3176 750DCMPI $76, $75, 0Dcompare $75 with 0D;
result - $76
compare with enter code
1104276 000ABZ $76, 000Abranch to 138 if $76 = 0exit if enter (end of string)
1142575 7530SUBI $75, $75, 30$75 <== $75 - 30form decimal digit value
1184075 0009BN $75, 0009branch to 13C if $75 < 0if < 0 - error
11C3176 7509CMPI $76, $75, 09compare $75 with 09;
result - $76
compare with 9
1204476 0007BP $76, 0007branch to 13C if $76 > 0if > 9 - error
1241971 710AMULI $71, $71, 0A$71 <== $71 * 0Aresult * 1010
1281875 7573MUL $75, $75, $73$75 <== $75 * $73current digit * sign
12C2071 7175ADD $71, $71, $75$71 <== $71 + $75add to result
1302174 7401ADDI $74, $74, 01$74 <== $74 + 1next bufer index
134F1FF FFF5JMPB FFFFF5branch to 108repeat cycle
1389F6F 6F00GOI $6F, $6F, 00return using $6F(finish subroutine)
13CE373 0020SETL $73, 0020$73 <== 20code of space symbol
1404274 0004BZ $74, 0004branch to 150 if $74 = 0end cycle
1440005 0273TRAP 5/02, $73call system function: print symbolprint space under every correct symbol
1482574 7401SUBI $74, $74, 01$74 <== $74 - 1decrease couner of spaces
14CF1FF FFFDJMPB FFFFFDbranch to 140repeat cycle
1502176 6F00ADDI $76, $6F, 00$76 <== $6Fstore return address and
call print string ROM subroutine
1549F6F 7030GOI $6F, $70, 30call $70+30; return - $6F
158075E 3F3F
3F07 0D0A
.^???...7 symbols: 'BELL', '^??'
'?', 'BELL", CR/LF
text to print
(length=7 - first byte)
160216F 7600ADDI $6F, $76, 00$6F <== $76restore return address
164F1FF FFDBJMPB FFFFDBbranch to D0repeat from the very beginning

back previous page next page forward


Related topics:

E-MMI software
 

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