Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GBUF_LSB = 40h
- GBUF_MSB = 93h
- Rectangle_erase:
- ; DE = (x,y)
- ; BC = (height,width)
- ;Uses 2 bytes of RAM: (FirstByte), (LastByte)
- push de
- push bc
- push bc
- ld a,d
- call ComputeByte
- cpl ;used for WHITE
- ld (FirstByte),a
- ex (sp),hl
- ld a,d
- neg
- and 7
- jr nz,$+4
- ld a,8
- ld b,a
- ld a,l
- sub b
- ex (sp),hl
- ld c,a
- call ComputeByte
- ; cpl
- ld (LastByte),a
- ld b,a
- sra c \ sra c \ sra c
- inc c
- ld a,d
- ld d,0
- ld h,d
- ld l,e
- add hl,hl
- add hl,de
- add hl,hl
- add hl,hl
- and %11111000
- rra \ rra \ rra
- add a,GBUF_LSB
- ld e,a
- ld d,GBUF_MSB
- add hl,de
- ;HL points to the first byte
- pop de
- ;D is the height
- ;E is the number of bytes wide
- inc c
- dec c
- jr nz,RectOverLoop-1
- ld a,(FirstByte)
- or b
- ld c,a ;value
- ld b,d ;height
- ld de,12
- ld a,c
- and (hl)
- ld (hl),a
- add hl,de
- djnz $-4
- pop bc
- pop de
- ret
- ld e,c
- RectOverLoop:
- ld b,e
- ld c,12
- ld a,(FirstByte)
- RectLoop:
- and (hl)
- ld (hl),a
- inc hl
- dec c
- jr z,ExitLoop
- xor a ;should be 'ld a,255' for other modes
- djnz RectLoop
- ld a,(lastByte)
- and (hl)
- ld (hl),a
- add hl,bc
- ExitLoop:
- dec d
- jr nz,RectOverLoop
- pop bc
- pop de
- ret
- ComputeByte:
- and 7
- ld b,a
- ld a,80h
- jr z,$+5
- rrca
- djnz $-1
- add a,a
- dec a
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement