Re: A86: contrast
[Prev][Next][Index][Thread]
Re: A86: contrast
IF you know the number will be only one digit, do
this:
ld a,($c008) ;or whatever
add a,'0'
call _vputmap ;put char in a
IF you know the number is 2 digits (in this case), do
this:
ld a,($c008)
ld l,a
ld h,0
call UNPACK_HL ; or _divHLby10
push af
call UNPACK_HL
add a,'0'
call _vputmap
pop af
add a,'0'
call _vputmap
This rountine is bit slower, but will work with any
number of digits and is smaller.
ld hl,-1
ld (_curRow),hl ;would be one byte more to use de
ld a,($c008)
ld l,a
xor a ;a must be 0 because the routine is _dispahl
ld h,a
call _dispahl
dec hl
call _vputs
There are many other methods.
--- Andrew T <ironman_294@hotmail.com> wrote:
>
> Well that didn't work so i tryed something like
> this...and it didnt
> work.....what have i done worng? ld a,($c008)
> ld a,($c008)
> ld l,a ;ld hl,a
> ld h,0
> call UNPACK_HL
> add a,'0' ;make it ascii
> ld (con),a
> ld hl,con ;now hl pints to contrast
> call _vputs ;but its putting out a blank
> ;saw it done in kollums.asm
>
> con:
> .db $00,$00
>
> >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
> >
> >
>
>
______________________________________________________
> Get Your Private, Free Email at
> http://www.hotmail.com
>
>
=====
__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com