Re: A86: Re: Gray Scale


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

Re: A86: Re: Gray Scale





Matt Johnson wrote:

> Hmm.. you can replace the bit 1, a with the 'AND' instruction when you are
> checking the VBL int. Also, why do you save the last 6 bytes of plotscreen?
> Shouldn't you be saving the 6 bytes after plotscreen since when you write
> 1024 bytes starting at $CA00 (I think that is it off the top of my head) you
> overwrite 6 unknown bytes past _plotScreen + 1024
>
> Later,
>     Matt
>
> >I improved the gray scale in this routine and it is now as flickerless
> >as the z80 is capable of.  There is only a small flicker when the
> >batteries are very low.  I also commented it.

 Good question.  I got from an older routine thinking that it was preserving the
seed, but it doesn't need to be preserved at all.  The vbl thing doesn't need to
be checked either.  So, here's the same routine minus about 15 bytes.  Thanks
Matt.

Also here are the calls you can use with this routine:

OpenGray -  set up and enable gray scale interrupt (call to turn on grayscale)
CloseGray - clear memories and reset interrupt (call to turn off grayscale)
ClrMem - clear the bitplane at $ca00 and the video memory
ClrGrf - clear just the bitplane at $ca00

To use this you need to copy one layer of memory to $ca00 and one layer to
$fc00.  If the bit is set on the bitplane at $ca00, it will appear light gray;
if it is set in video memory ($fc00), it will appear dark gray; if it's set in
both, it will be black or if it's set in neither it will be white.  You can also
use the (UserCounter) as a timer because it's incremented once every interrupt.
The standard cursor toggles once every 70 interrupts so here is an example:

.org _asm_exec_ram

 ld hl,bitplane1
 ld de$ca00
 ld bc,1024
 ldir

 ld hl,bitplane2
 ld de,$fc00
 ld bc,1024
 ldir

 call _runindicoff
 call OpenGray

;
waitkey:
 ld a,(UserCounter)
 sub 70
 call nc,toggle_cursor            ;call if (UserCounter) >= 70

;check keypresses

 jr waitkey
;

 jp CloseGray

;
toggle_cursor:
 ld (UserCounter),a        ;reset counter to zero or there about

;cursor stuff

 ret

#include "Gray2.asm"
;include bitplane files

.end
Warning
Could not process part with given Content-Type: application/x-unknown-content-type-asm_auto_file; name="gray2.ASM"

Follow-Ups: References: