yeah, I cleared both buffers, and I modified the ion one to output the same stuff to both buffers.
EDIT: it gets the byte at flags+asm_flag2 near the beginning; I wonder if a command uses that earlier to set something?
Disp4
ld a,i
push af
di
ld (OP2+2),sp
ld a,$80
out ($10),a
ld sp,appbackupscreen - plotSScreen
ld e,(plotSScreen-appbackupscreen+12)&$ff
ld c,-$0C
ex af,af'
ld a,%11011011
ld hl,flags+asm_flag2
inc (hl)
jr z,__Disp4Lvlskip
add a,a
ld b,(hl)
inc b
jr z,__Disp4Lvlskip
rlca
ld (hl),-2
__Disp4Lvlskip
ld l,plotSScreen&$ff-1
ex af,af'
__Disp4Lvlentry
ld a,c
add a,$2C
ld h,plotSScreen>>8
inc l
ld b,64
out ($10),a
__Disp4Lvlloop
ld a,(hl)
add hl,sp
xor (hl)
ex af,af'
cp e
rra
ld d,a
ex af,af'
and d
xor (hl)
out ($11),a
ld d,(plotSScreen-appbackupscreen+12)>>8
add hl,de
djnz __Disp4Lvlloop
inc c
jr nz,__Disp4Lvlentry
__Disp4LvlDone
ld sp,(OP2+2)
pop af
ret po
ei
ret
__Disp4LvlEnd
Clrscrn
ld bc,768
ld hl,plotSScreen
ld de,appbackupscreen
sub a
__Clrscrnloop
ld (hl),a
ldi
jp pe,__Clrscrnloop
ret
Drawtilebuffer
ld e,l
ld h,$00
ld d,h
add hl,de
add hl,de
add hl,hl
add hl,hl ;Find the Y displacement offset
ld e,a
and $07 ;Find the bit number
ld c,a
srl e
srl e
srl e
add hl,de ;Find the X displacement offset
ld de,plotSScreen
add hl,de
putSpriteLoop1:
sl1: ld d,(ix) ;loads image byte into D
ld e,$00
ld a,c
or a
jr z,putSpriteSkip1
putSpriteLoop2:
srl d ;rotate to give out smooth moving
rr e
dec a
jr nz,putSpriteLoop2
putSpriteSkip1:
ld a,(hl)
xor d
ld (hl),a
inc hl
ld a,(hl)
xor e
ld (hl),a ;copy to buffer using XOR logic
ld de,$0B
add hl,de
inc ix ;Set for next byte of image
djnz putSpriteLoop1
ret
Drawtilebackbuffer
ld e,l
ld h,$00
ld d,h
add hl,de
add hl,de
add hl,hl
add hl,hl ;Find the Y displacement offset
ld e,a
and $07 ;Find the bit number
ld c,a
srl e
srl e
srl e
add hl,de ;Find the X displacement offset
ld de,appbackupscreen
add hl,de
putSpriteLoop1:
sl1: ld d,(ix) ;loads image byte into D
ld e,$00
ld a,c
or a
jr z,putSpriteSkip1
putSpriteLoop2:
srl d ;rotate to give out smooth moving
rr e
dec a
jr nz,putSpriteLoop2
putSpriteSkip1:
ld a,(hl)
xor d
ld (hl),a
inc hl
ld a,(hl)
xor e
ld (hl),a ;copy to buffer using XOR logic
ld de,$0B
add hl,de
inc ix ;Set for next byte of image
djnz putSpriteLoop1
ret
Tilemap