|
|
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...168 | 8171 6F00 | LDBI $71, $6F, 00 | $71 <== ($6F) | text length to $71 |
16C | E76F 0001 | INCL $6F, 0001 | $6F <== $6F + 1 | next symbol's address |
170 | 8172 6F00 | LDBI $72, $6F, 00 | $72 <== ($6F) | get current symbol |
174 | 0005 0272 | TRAP 5/02, $72 | call system function: print symbol | print it |
178 | 2571 7101 | SUBI $71, $71, 01 | $71 <== $71 - 1 | dec symbols counter |
17C | 4571 FFFC | BPB $71, FFFC | branch to 16C if $71 > 0 | repeat if symbols remain |
180 | E76F 0004 | INCL $6F, 0004 | $6F <== $6F + 4 | +1 (next) +3 (round address) |
184 | 3F6F 6F02 | SRUI $6F, $6F, 02 | 2 bit right shift $6F | reset 2 leftmost bits |
188 | 3B6F 6F02 | SLUI $6F, $6F, 02 | 2 bit left shift $6F |
18C | 9F6F 6F00 | GOI $6F, $6F, 00 | return using $6F | (finish subroutine) |
Next line
addr |
code |
mnemonic |
action |
comments |
EE0...190 | E371 000A | SETL $71, 000A | $71 <== 0A | LF code |
194 | 0005 0271 | TRAP 5/02, $71 | call system function: print symbol | print it |
198 | E371 000D | SETL $71, 000A | $71 <== 0D | CR code |
19C | 0005 0271 | TRAP 5/02, $71 | call system function: print symbol | print it |
1A0 | 9F6F 6F00 | GOI $6F, $6F, 00 | return using $6F | (finish subroutine) |
Related topics:
E-MMI software
|
(C) 2003, Evgeny Eremin. rEd-MMI project documentation
|
|