Re: A86: contrast


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

Re: A86: contrast




First of all, when using pen coordinates (PenCol, PenRow) you need to
remember that each row is a pixel wide, so instead of displaying your
second line output at row $01, you should use $06. (each line of text is
6 pixels high).

ld bc, $0600     instead of  ld bc, $0100
ld (_penCol), bc

Second, you are attempting to display a number using _vputs.  _vputs
displays the text beginning at the memory location POINTED TO by the HL
register.  You loaded the contrast value into HL, and tried to use
_vputs to display it.  It outputted garbage on the screen because _vputs
went to the location in HL, which would have been some address between
$0000 and $00FF (you loaded 0 into h).  When it got there, it displayed
characters until it encountered a $00 byte.  That is why it displayed
garbage.  I believe someone else replied saying that you should use the 
dispAHL routine.  You may be able to use this, but I'm not entirely sure
it functions... my emulator's dead, and my link doesn't work, so if
someone could tell me it does or doesn't work as planned it would be
appreciated.

;DispHLvwidth	displays HL as a number in variable-width font
;--------------------------------
;input: - value in HL do display
;		- graphscreen coords in bc
;output: - HL displayed in vWidth font
;		 - OP1-3 used
;--------------------------------

	ld (_penCol),bc			;cursor location in bc
	call _SetXXXXOP2                ;OP2=hl
	call _OP2TOOP1                  ;move to OP1
	call _formreal                  ;OP3=zero-terminated string value of
OP1
	ld hl,_OP3                      ;point hl to OP3
	call _vputs           		;display
	ret				;return

Cassady Roop
croop@oregontrail.net


Andrew T wrote:
> 
> hmmmm I made a little contrast program but i am haveing some problems could
> some one tell me two things, first im getting trash in my out put second you
> cant hold down a key you have to keep on pushing it.
> BUT...i am happy to say that it does make the contrast go up or down
> 
> .org _asm_exec_ram
> 
> ProgStart:
> ld bc,$0000
> ld (_penCol),bc
> ld hl,msg
> call _vputs
> ld bc,$0100
> ld (_penCol),bc
> ld a,($c008)
> ld l,a
> ld h,0
> call _vputs
> key_wait
> xor a
> call GET_KEY
> cp K_PLUS
> jr z,inc_contrast
> cp K_MINUS
> jr z,dec_contrast
> cp K_EXIT
> ret z
> jr ProgStart
> 
> inc_contrast:
> ld a,($c008)
> cp $1f
> jp p,ProgStart
> inc a
> out (2),a
> ld ($c008),a
> jr ProgStart
> 
> dec_contrast:
> ld a,($c008)
> cp 0
> jp z,ProgStart
> dec a
> out (2),a
> ld ($c008),a
> jr ProgStart
> 
> msg:
> .db "The contrast is:",0
> 
> .end
> 
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com


References: