All pastes #476677 Raw Edit

Someone

public text v1 · immutable
·published 2007-05-08 08:25 UTC
rendered paste body
*Prints answer to lcd*
Print	   
         psha
         pshb
         pshx
         pshy
	   ldaa #$01
	   jsr  LCDOutCmd
         clra
         ldy  #0      Number of characters
	   xgdx
ODloop   ldx  #10     Reg D = input
         idiv         RegB is digit, RegX is rest of input
         pshb         Save for later, reverse order
         iny
         xgdx
         cpd  #0      Continue until
         bne  ODloop
ODout    pula          next digit
         adda #'0'     convert 0-9 to ASCII 0-9
         jsr  LCDOutChar
	   DEY
	   DEY
DP_Done  INY
	   CPY #$00
	   BNE ODout
MSG_Done puly
         pulx
         pulb
         pula
         rts
*Finish Print command*

*Out puts to LCD*
LCDOutChar
      staa PORTA
      ldab #E+RS    E=1, RS=1, R/W=0
      stab PORTB
      ldab #RS      E=0, RS=1, R/W=0
      stab PORTB
      bsr  LCDWaitShort 40us wait
      rts
*End LCDOutChar*