|
|
ROM subroutines
Print double
|
|
| addr |
code |
mnemonic |
action |
comments |
| EE0...2B8 | 2176 6F00 | ADDI $76, $6F, 0 | $76 <== $6F | store return address to $76 |
| 2BC | 0273 7171 | FUN $73, $71, $71 | $73 <== [f($71)] | check argument for NAN (1 if NAN, else - 0) |
| 2C0 | 4273 0004 | BZ $73, 0004 | branch to 2D0, if $73=0 | branch if correct value |
| 2C4 | 9F6F 7030 | GOI $6F, $70, 30 | call subroutine $70 + 30, return - $6F | print the following text |
| 2C8 | 034E 414E | #3 'NAN' | 3 symbols: "NAN" | text to print (length=3 - first byte) |
| 2CC | 9F76 7600 | GOI $76, $76, 0 | return using $76 | (finish subroutine) |
| 2D0
| E375 0000 | SETL $75, 0000 | $75 <== 0 | exponent for 0 |
| 2D4 | 4271 0017 | BZ $71, 0017 | branch to 330, if $71=0 | to print, if argument = 0 |
| 2D8 | 3173 7100 | CMPI $73, $71, 0 | compare $71 with 0 and set $73 | is argument negative? |
| 2DC | 4873 0004 | BNN $73, 0004 | brach to 2EC, if $73 >=0 | no "-" sign |
| 2E0 | E373 002D | SETL $73, 002D | $73 <== 2D | symbol '-' |
| 2E4 | 0005 0273 | TRAP 5/02, $73 (I/O) | call system function: print symbol | print char from $73 |
| 2E8 | EC71 8000 | ANDNH $71, 8000 | $71 <== $71 AND (NOT 800...) = $71 AND 7FF... | reset sign bit |
| 2EC |
E074 4024 | SETH $74, 4024 | $74 <== 402400.. | float value 10 |
| 2F0 | E073 3FF0 | SETH $73, 3FF0 | $73 <== 3FF000.. | float value 1 |
| 2F4 | 2175 7200 | ADDI $75, $72, 0 | $75 <== $72 | D - number of decimal digits (input parameter) to exponent |
| 2F8 |
1073 7374 | FMUL $73, $73, $74 | $73 <== $73 * $74 | 10D is calculating in $73 |
| 2FC | 2572 7201 | SUBI $72, $72, 1 | $72 <== $72 - 1 | dec number of digits |
| 300 | 4572 FFFE | BPB $72, FFFE | branch to 2F8, if $72 > 0 | repeat cycle until 0 |
| 304 |
0172 7173 | FCMP $72, $71, $73 | compare $71 with $73 and set $72 | compare argument with 10D |
| 308 | 4072 0004 | BN $72, 0004 | branch to 318, if $72 < 0 | skip if argument < 10D |
| 30C | 1471 7174 | FDIV $71, $71, $74 | $71 <== $71 / $74 | argument / 10 |
| 310 | 2175 7501 | ADDI $75, $75, 1 | $75 <== $75 + 1 | inc exponent |
| 314 | F1FF FFFC | JMPB FFFFFC | jump to 304 | repeat cycle |
| 318 |
1473 7374 | FDIV $73, $73, $74 | $73 <== $73 / $74 | 10D-1 (const for normalization: first digit must be non-zero) |
| 31C |
0172 7173 | FCMP $72, $71, $73 | compare $71 with $73 and set $72 | compare argument with const |
| 320 | 4872 0004 | BNN $72, 0004 | branch to 330, if $72 >= 0 | finish if normalized mantissa is set in integer part of $71 |
| 324 | 1071 7174 | FMUL $71, $71, $74 | $71 <== $71 * $74 | * 10 |
| 328 | 2575 7501 | SUBI $75, $75, 1 | $75 <== $75 - 1 | dec exponent |
| 32C | F1FF FFFC | JMPB FFFFFC | jump to 31C | repeat cycle |
| 330 |
E372 0030 | SETL $72, 0030 | $72 <== 30 | symbol '0' |
| 334 | 0005 0272 | TRAP 5/02, $72 (I/O) | call system function: print symbol | print char from $72 |
| 338 | E372 0030 | SETL $72, 002E | $72 <== 2E | symbol '.' |
| 33C | 0005 0272 | TRAP 5/02, $72 (I/O) | call system function: print symbol | print char from $72 |
| 340 | 1771 0071 | FINT $71, 00, $71 | $71 <== int ($71) | mantissa |
| 344 | 9F6F 7010 | GOI $6F, $70, 10 | call subroutine $70 + 10, return - $6F | print INT64 from $71 |
| 348 | E372 0065 | SETL $72, 0065 | $72 <== 65 | symbol 'e' |
| 34C | 0005 0272 | TRAP 5/02, $72 (I/O) | call system function: print symbol | print char from $72 |
| 350 | 2171 7500 | ADDI $71, $75, 00 | $71 <== $75 | exponent |
| 354 | 9F6F 7010 | GOI $6F, $70, 10 | call subroutine $70 + 10, return - $6F | print INT64 from $71 |
| 358 | 9F76 7600 | GOI $76, $76, 00 | return using $76 | (finish subroutine) |
Related topics:
E-MMI software
|
|
(C) 2007, Evgeny Eremin. rEd-MMI project documentation
|
|