top decor
ROM subroutines Print double


addr code mnemonic action comments
EE0...2B82176 6F00ADDI $76, $6F, 0$76 <== $6Fstore return address to $76
2BC0273 7171FUN $73, $71, $71$73 <== [f($71)]check argument for NAN (1 if NAN, else - 0)
2C04273 0004BZ $73, 0004branch to 2D0, if $73=0branch if correct value
2C49F6F 7030GOI $6F, $70, 30call subroutine $70 + 30, return - $6Fprint the following text
2C8034E 414E#3 'NAN'3 symbols: "NAN"text to print (length=3 - first byte)
2CC9F76 7600GOI $76, $76, 0return using $76(finish subroutine)
2D0 E375 0000SETL $75, 0000$75 <== 0exponent for 0
2D44271 0017BZ $71, 0017branch to 330, if $71=0to print, if argument = 0
2D83173 7100CMPI $73, $71, 0compare $71 with 0 and set $73is argument negative?
2DC4873 0004BNN $73, 0004brach to 2EC, if $73 >=0no "-" sign
2E0E373 002DSETL $73, 002D$73 <== 2D symbol '-'
2E40005 0273TRAP 5/02, $73 (I/O)call system function: print symbolprint char from $73
2E8EC71 8000ANDNH $71, 8000$71 <== $71 AND (NOT 800...) = $71 AND 7FF...reset sign bit
2EC E074 4024SETH $74, 4024$74 <== 402400..float value 10
2F0E073 3FF0SETH $73, 3FF0$73 <== 3FF000..float value 1
2F42175 7200ADDI $75, $72, 0$75 <== $72D - number of decimal digits (input parameter) to exponent
2F8 1073 7374FMUL $73, $73, $74$73 <== $73 * $74 10D is calculating in $73
2FC2572 7201SUBI $72, $72, 1$72 <== $72 - 1dec number of digits
3004572 FFFEBPB $72, FFFEbranch to 2F8, if $72 > 0 repeat cycle until 0
304 0172 7173FCMP $72, $71, $73compare $71 with $73 and set $72compare argument with 10D
3084072 0004BN $72, 0004branch to 318, if $72 < 0skip if argument < 10D
30C1471 7174FDIV $71, $71, $74$71 <== $71 / $74argument / 10
3102175 7501ADDI $75, $75, 1$75 <== $75 + 1inc exponent
314F1FF FFFCJMPB FFFFFCjump to 304repeat cycle
318 1473 7374FDIV $73, $73, $74$73 <== $73 / $7410D-1 (const for normalization: first digit must be non-zero)
31C 0172 7173FCMP $72, $71, $73compare $71 with $73 and set $72compare argument with const
3204872 0004BNN $72, 0004branch to 330, if $72 >= 0finish if normalized mantissa is set in integer part of $71
3241071 7174FMUL $71, $71, $74$71 <== $71 * $74* 10
3282575 7501SUBI $75, $75, 1$75 <== $75 - 1dec exponent
32CF1FF FFFCJMPB FFFFFCjump to 31Crepeat cycle
330 E372 0030SETL $72, 0030$72 <== 30symbol '0'
3340005 0272TRAP 5/02, $72 (I/O)call system function: print symbolprint char from $72
338E372 0030SETL $72, 002E$72 <== 2Esymbol '.'
33C0005 0272TRAP 5/02, $72 (I/O)call system function: print symbolprint char from $72
3401771 0071FINT $71, 00, $71$71 <== int ($71)mantissa
3449F6F 7010GOI $6F, $70, 10call subroutine $70 + 10, return - $6Fprint INT64 from $71
348E372 0065SETL $72, 0065$72 <== 65symbol 'e'
34C0005 0272TRAP 5/02, $72 (I/O)call system function: print symbolprint char from $72
3502171 7500ADDI $71, $75, 00$71 <== $75exponent
3549F6F 7010GOI $6F, $70, 10call subroutine $70 + 10, return - $6Fprint INT64 from $71
3589F76 7600GOI $76, $76, 00return using $76(finish subroutine)

back previous page next page forward


Related topics:

E-MMI software
 

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