[A83] Re: displaying values of a variable


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

[A83] Re: displaying values of a variable




This code should work to display the hex value of the accumulator using small 
font...


res textWrite,(iy+textFlags) ;write to display and not to graph buffer only
ld de,0
ld (penCol),de ;print in upper left corner of screen
push af
rrca  ;roll bits right 4 times
rrca
rrca
rrca
and 00001111b ;you could also do and 0Fh...gets rid of four left bits
add 30h ;30h = '0', 
cp 3Ah ;if a >= 3ah, no carry so add 7 to go to appropriate ASCII character.
call nc,AddAnother7
B_CALL VPutMap
pop af
and 00001111b
add 30h
cp 3ah
call nc,AddAnother7
B_CALL VPutMap
B_CALL GetKey ;pause after displaying
ret


AddAnother7:
 add 7
 ret

Quoting Dan Weiss <dwedit@hotmail.com>:

> 
> To display A in the big font, you set h to 0, and l to a, then use
> disphl.
> 
>   ld h,0
>   ld l,a
>   bcall(_disphl)
> 
> Before you display large text, you set CURROW and CURCOL with the 
> coordinates.  Because Currow and Curcol are next to each other, the
> easiest 
> way to do it is to set HL to the coordinates to display it at, then set
> 
> CURROW to hl.  Because you used a Register pair, CURCOL got set too.
> 
> 
> Example (text at 0,0)
>   ld hl,0
>   ld (currow),hl
> 
> Example (Text at 4,2)
>   ld hl,$0402    ;Note: $ means hexidecimal
>   ld (currow),hl
> 
> 
> 
> For the small font used by the Text( command, use this routine:
> 
> ;==========================================
> ;  VDispA - Displays A in the small font
> ;==========================================
> vDispA:
> 	ld h,0
> 	ld l,a
> ;===========================================
> ;  VDispHL - Displays hl in the small font
> ;===========================================
> vDispHL:
> 	push de
> 	push hl
> 	ld de,op1+5
> 	xor a
> 	ld (de),a
> vdhlRepeat:
> 	bcall(_divhlby10)
> 	add a,'0'
> 	dec de
> 	ld (de),a
> 	ld a,h
> 	or l
> 	jr nz,vdhlRepeat
> 	ex de,hl
> 	bcall(_vputs)
> 	pop hl
> 	pop de
> 	ret
> 
> (note that vDispA *uses* vDispHL)
> 
> To set the coordinates to display to, set Penrow and Pencol.  note that
> 
> unlike Currow and Curcol, X comes before Y here.
> 
> Example (text at 0,0)
>   ld hl,0
>   ld (pencol),hl
> 
> Example (Text at 40,20)
>   ld hl,$1428    ;hex values of 20 then 40
>   ld (pencol),hl
> 
> 
> 
> >From: "Charlie Adams" <charlie_w_adams@yahoo.com>
> >Reply-To: assembly-83@lists.ticalc.org
> >To: <assembly-83@lists.ticalc.org>
> >
> >How would you go about displaying a value in the accumulator (a) in an
> Ion
> >program?  I'm sorry if this is a dumb question, I'm new to asm.
> 
> 
> 
> _________________________________________________________________
> Join the world’s largest e-mail service with MSN Hotmail. 
> http://www.hotmail.com
> 
> 
> 




References: