top decor
ROM subroutines Print text; next line


Two subroutines that help to realize analog of Pascal constructions write('text') and writeln('text').

Print text

Text must be placed after subroutine call. Its first byte must be set equal to number of symbols.

addr code mnemonic action comments
EE0...1688171 6F00LDBI $71, $6F, 00$71 <== ($6F)text length to $71
16CE76F 0001INCL $6F, 0001$6F <== $6F + 1next symbol's address
1708172 6F00LDBI $72, $6F, 00$72 <== ($6F)get current symbol
1740005 0272TRAP 5/02, $72call system function:
print symbol
print it
1782571 7101SUBI $71, $71, 01$71 <== $71 - 1dec symbols counter
17C4571 FFFCBPB $71, FFFCbranch to 16C if $71 > 0repeat if symbols remain
180E76F 0004INCL $6F, 0004$6F <== $6F + 4+1 (next) +3 (round address)
1843F6F 6F02SRUI $6F, $6F, 022 bit right shift $6Freset 2 leftmost bits
1883B6F 6F02SLUI $6F, $6F, 022 bit left shift $6F
18C9F6F 6F00GOI $6F, $6F, 00return using $6F(finish subroutine)

Next line

addr code mnemonic action comments
EE0...190E371 000ASETL $71, 000A$71 <== 0ALF code
1940005 0271TRAP 5/02, $71call system function: print symbolprint it
198E371 000DSETL $71, 000A$71 <== 0DCR code
19C0005 0271TRAP 5/02, $71call system function: print symbolprint it
1A09F6F 6F00GOI $6F, $6F, 00return using $6F(finish subroutine)

back previous page next page forward


Related topics:

E-MMI software
 

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