A86: Re: Re: More GrayScale Sprite Problem


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

A86: Re: Re: More GrayScale Sprite Problem




$f700 -- stack
$f800 -- dark layer
$fc00 -- light layer

If you start getting strange crashes, you might be overflowing the stack
into the program or vice-versa...


; Flicker-free four level Grayscale routines
; by Clem Vasseur <clem@acz.org>
; and David Phillips <david@acz.org>
; Assembly Coder's Zenith -- http://www.acz.org/
;
; OpenGray  -- initialize grayscale
; CloseGray -- uninstall grayscale handler
; ClearGray -- clear both grayscale planes
;

OpenGray:
 di
OpenGrayMoveStack:
 ld hl,-$400
 add hl,sp
 ld sp,hl
 ld hl,$fb00
 ld de,$f700
 ld bc,256
 ldir
OpenGrayInstall:
 ld hl,IntStart
 ld de,$D2FE
 push de
 ld bc,IntEnd-IntStart
 ldir
 ld de,$28
 pop hl
 ld a,(hl)
 dec hl
 push hl
 ld b,5
OpenGrayCalcChecksum:
 add hl,de
 add a,(hl)
 djnz OpenGrayCalcChecksum
 pop hl
 ld (hl),a
 set 2,(iy+$23)
 exx
 ld bc,$3800
 ld de,$0304
 exx
 ld hl,($4065)
 ld (IntROMpatch),hl
 ei

ClearGray:
 ld hl,VideoRam
 ld de,VideoRam+1
 ld bc,2047
 ld (hl),0
 ldir
 ret

CloseGray:
 res 2,(iy+$23)
 ld a,$3c
 out (0),a
CloseGrayRestoreStack:
 di
 ld hl,$400
 add hl,sp
 ld sp,hl
 ld hl,$f700
 ld de,$fb00
 ld bc,256
 ldir
 ei
 ret

IntStart:
 in a,(3)
 bit 1,a
 jr z,IntExit
 out (c),b
 dec d
 jr nz,IntSkip
 ld d,3
 jr IntSwap
IntSkip:
 ld a,d
 dec a
 jr nz,IntExit
IntSwap:
 ld a,b
 xor e
 ld b,a
IntExit:
 pop hl
 in a,(3)
 and 1
 push af
 push bc
 push de
 call $01A1
IntROMpatch = $-2
 pop de
 pop bc
 pop af
 add a,9
 out (3),a
 ld a,11
 out (3),a
 ex af,af'
 exx
 ei
 reti
IntEnd:

.end

> yes, please post it!




References: