Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Rectangle_erase:
- ld hl,$A62F
- jr Rectangle
- Rectangle_or:
- ld hl,$B6
- jr Rectangle
- Rectangle_xor:
- ld hl,$AE
- Rectangle:
- ; DE = (x,y)
- ; BC = (height,width)
- ld (smc_logic1),hl
- ld (smc_logic0),hl
- push de
- push bc
- push bc
- ld a,d
- call ComputeByte
- ld (smc_FirstByte),a
- ex (sp),hl
- ld a,d
- neg
- and 7
- ld b,a
- ld a,l
- sub b
- ex (sp),hl
- ld c,a
- call ComputeByte
- cpl
- ld (smc_LastByte),a
- ld b,a
- sra c \ sra c \ sra c
- inc c
- ; ld a,c
- ; and %11111000
- ; rra \ rra \ rra
- ; inc a
- ; ld c,a
- 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,(smc_FirstByte)
- and b
- ld c,a ;value
- ld b,d ;height
- ld de,12
- ld a,c
- smc_logic1:
- nop
- or (hl)
- ld (hl),a
- add hl,de
- djnz $-5
- pop bc
- pop de
- ret
- ld e,c
- RectOverLoop:
- ld b,e
- ld c,12
- .db 3Eh ;start of ld a,*
- smc_FirstByte:
- .db 0
- RectLoop:
- smc_logic0:
- nop
- or (hl)
- ld (hl),a
- inc hl
- dec c
- jr z,ExitLoop
- ld a,-1
- djnz RectLoop
- ; jp p,$+4
- ; dec b
- .db 3Eh ;start of ld a,*
- smc_LastByte:
- .db 0
- or (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