view lib/kreiderclib/ltoa.as @ 2981:9550602c9a0b

sierra/objs_lsl/mnln.asm: Use division quotient, not remainder It calls a routine twice to make a division (L125C) but doesn't check the right register for the result. The result is returned in reg U and the remainder in reg D but the procedure expect the result to be returned in reg D. The divison routine seems to be correct because it is properly used elsewhere in the code. Patch by Guillaume Major and Robert Gault.
author Guillaume Major <guillaume.major@gmail.com>
date Sat, 12 Apr 2014 15:30:03 +0200
parents 1647f1874cdf
children
line wrap: on
line source

* Disassembly by Os9disasm of ltoa.r

 section code

* class D external label equates

D0000 equ $0000 
D000a equ $000a 

ltoa: clra   
 clrb   
 pshs  d,u 
 ldu   10,s 
 tst   6,s 
 bpl   L0018 
 inc   ,s 
 leax  6,s 
 pshs  x 
 leax  8,s 
 lbsr  _lneg 
 lbsr  _lmove 
L0018 ldd   8,s 
 pshs  d 
 ldd   8,s 
 pshs  d 
 leax  >L005e,pcr 
 lbsr  _lmod 
 ldb   3,x 
 addb  #$30 
 stb   ,u+ 
 leax  6,s 
 pshs  x 
 ldd   2,x 
 pshs  d 
 ldd   ,x 
 pshs  d 
 leax  >L005e,pcr 
 lbsr  _ldiv 
 lbsr  _lmove 
 ldd   8,s 
 addd  6,s 
 bne   L0018 
 tst   ,s 
 beq   L0051 
 ldb   #$2d 
 stb   ,u+ 
L0051 clr   ,u 
 ldd   10,s 
 pshs  d 
 lbsr  reverse 
 leas  4,s 
 puls  u,pc 
L005e neg   D0000 
 neg   D000a 

 endsect