Re: A82: Easiest way to get a into OP1 (82)
[Prev][Next][Index][Thread]
Re: A82: Easiest way to get a into OP1 (82)
> If you feel like answering another question what is the easiest way to 
> display a and HL on the screen in menu style? Thanks a lot!
I use this routine:
; Routine to convert the number in HL to a string (in OP1) 
; and print it in small font (always 5 chars).
; based on a routine by Dines that didn't work :)
dnsc:
  LD DE,$802C           ; -> OP1 (temp storage)
  LD B,5                ; maimum number of digits
dnsc_loop:
  CALL UNPACK_HL        ; Unpack one digit of HL into A
  ADD A,$30             ; make it ASCII
  LD (DE),A             ; Save in buffer
  DEC DE                ; point to next digit
  DJNZ dnss_loop
  LD A,0
  LD ($802D),A          ; nullterminate it
  INC DE                ; point to first digit
  EX DE,HL              ; hl points to string
  ROM_CALL(D_ZM_STR)    ; print it
  RET
-------------------------
//Anders Gustafsson - aig@swipnet.se
References: