Re: A86: displaying a variable


[Prev][Next][Index][Thread]

Re: A86: displaying a variable




To increase your variable, then print it in small font:

...
 ld hl,MyVar
 inc (hl)
 call _ldhlind
 call DisplayHL
 ...

;====================================================================
; DisplayHL:  (idea from SCaBBy/Mardell)    [Assembly Coder's Zenith]
;  Display HL as a 5-digit decimal number with no leading zeros
;  out: AF, HL, BC, DE destroyed
;====================================================================
DisplayHL:
 ld c,'0'  				; save ascii value for zero
 ld de,_OP1+5			; point to end of the buffer
 xor a				; zero terminate string
 ld (de),a				; set last byte to zero
DisplayHLl:
 call UNPACK_HL			; next digit
 dec de				; next position
 add a,c				; convert to ascii
 ld (de),a				; save digit
 ld a,h				; load upper byte
 or l					; check with lower byte for zero
 jr nz,DisplayHLl			; loop
 ex de,hl				; point to buffer
 call _vputs			; print number
 ret					; we're done

--
David Phillips <david@acz.org>
http://www.acz.org/

----- Original Message -----
From: <BlAsTo1414@aol.com>
To: <assembly-86@lists.ticalc.org>
Sent: Monday, January 25, 1999 7:14 PM
Subject: Re: A86: displaying a variable


>
>The variable that I want to display is a number that will be higher than 10
>most of the time.  So how would I display it then?  the default setting is
1,
>but it will change as the user progresses in the game.  I still need to
know
>how to display that number and add to it.
>
>Thanks again,
> BlAsTo1414
>
>
>>
>>  if it's always less than 10 you can add $30 and it'll work that way
>>
>>  -josh
>>
>>  On Sat, 23 Jan 1999 20:59:13 EST BlAsTo1414@aol.com writes:
>>  >
>>  >hi,
>>  >I have a variable stored like this:
>>  >
>>  >variable1:
>>  > .db 1,0
>>  >
>>  >does this mean that when i display the variable, ((ld
>>  >hl,variable1)(call
>>  >_puts)) it will display the number 1?  if not, how would I do that?
>>  >
>>  >Thank you for your help,
>>  >   BlAsTo1414
>>  >
>>  >
>>
>
>