Code: Select all
ORG #8000
RETURN_TO_BASIC EQU 1
NOPS_AT_START EQU 0
SCRBUF_BASEADDR EQU #4000
SPECIAL_CASE_LINE256 EQU 0
MACRO ldim regpair, val1, val2
ld regpair, ((val1&#FF)<<8)|(val2&#FF)
ENDM
codestart:
IF NOPS_AT_START
nop
nop
nop
nop
ENDIF
main:
IF RETURN_TO_BASIC
ld (stashed_iy), iy
exx
ld (stashed_hl_alt), hl
ld (stashed_sp), sp
ENDIF
.mainloop
ld a, 7
out (#fe), a
halt
ld a, 1
out (#fe), a
IF 1
ldim hl, 128, 96
ld d, 63
call draw_circle
jp .mainloop
ENDIF
IF 0;1
ldim hl, 128, 96
ld d, 95
call draw_circle
ld b, 50
.morehalt
halt
djnz .morehalt
ld a, 0|(7<<3)
call cls
ldim hl, 128, 96
ld d, 95
call draw_fill_circle
ld b, 50
.morehalt2
halt
djnz .morehalt2
ld a, 0|(7<<3)
call cls
jp .mainloop
ENDIF
IF 1;0
ldim hl, 128, 96
ld d, 95
.nextrad
push de
push hl
call draw_circle
pop hl
pop de
dec d
jp p, .nextrad
ENDIF
IF RETURN_TO_BASIC
returntobasic:
ld iy, (stashed_iy)
ld hl, (stashed_hl_alt)
ld sp, (stashed_sp)
exx
ENDIF
ret
; H - cx
; L - cy
; D - radius
draw_circle:
; B = xoffset
xor a
; A' = sx
ex af, af'
xor a
; C = yoffset
ld b, a
ld c, d
ld d, a
IF 1
; push everything
; do the very first line, just draw 2 pixels
push de
push bc
push hl
; cy+x
;ld a, l
;add b
;ld l, a ; B is 0 first line
; cx-y
ld a, h
sub c
ld b, a
; cx+y
ld a, h
add c
ld c, a
xor a ; A=0 and clear carry
sla l
ld h, tbl_scraddr/256 ; this requires tbl_scraddr be aligned to a 256 byte boundary
adc h ; A = H + carry flag
ld h, a ; write it back
; look up screen address from the table
ld a, (hl)
inc l
ld h, (hl)
ld l, a
ld a, c
and ~7
rrca
rrca
rrca
add l
ld l, a
ld a, c
ld de, col2pix
and 7
add e
ld e, a
ld a, (de)
or (hl)
ld (hl), a
ld a, l
and ~31
ld l, a
ld a, b
and ~7
rrca
rrca
rrca
add l
ld l, a
ld a, b
ld de, col2pix
and 7
add e
ld e, a
ld a, (de)
or (hl)
ld (hl), a
jp .doneveryfirstline
ENDIF
.nextline
push de
push bc
push hl
; cy+x
ld a, l
add b
ld l, a
; cx-y
ld a, h
sub c
ld b, a
; cx+y
ld a, h
add c
ld c, a
xor a ; A=0 and clear carry
sla l
ld h, tbl_scraddr/256 ; this requires tbl_scraddr be aligned to a 256 byte boundary
adc h ; A = H + carry flag
ld h, a ; write it back
; look up screen address from the table
ld a, (hl)
inc l
ld h, (hl)
ld l, a
ld a, c
and ~7
rrca
rrca
rrca
add l
ld l, a
ld a, c
ld de, col2pix
and 7
add e
ld e, a
ld a, (de)
or (hl)
ld (hl), a
ld a, l
and ~31
ld l, a
ld a, b
and ~7
rrca
rrca
rrca
add l
ld l, a
ld a, b
ld de, col2pix
and 7
add e
ld e, a
ld a, (de)
or (hl)
ld (hl), a
pop hl
pop bc
push bc
push hl
; cy-x
ld a, l
sub b
ld l, a
; cx-y
ld a, h
sub c
ld b, a
; cx+y
ld a, h
add c
ld c, a
xor a ; A=0 and clear carry
sla l
ld h, tbl_scraddr/256 ; this requires tbl_scraddr be aligned to a 256 byte boundary
adc h ; A = H + carry flag
ld h, a ; write it back
; look up screen address from the table
ld a, (hl)
inc l
ld h, (hl)
ld l, a
ld a, c
and ~7
rrca
rrca
rrca
add l
ld l, a
ld a, c
ld de, col2pix
and 7
add e
ld e, a
ld a, (de)
or (hl)
ld (hl), a
ld a, l
and ~31
ld l, a
ld a, b
and ~7
rrca
rrca
rrca
add l
ld l, a
ld a, b
ld de, col2pix
and 7
add e
ld e, a
ld a, (de)
or (hl)
ld (hl), a
.doneveryfirstline
pop hl
pop bc
pop de
push hl
ld h, 0
ld l, d
ld d, h
ld e, b
add hl, de
add hl, de
inc hl
inc b
ld a, l ; A is new D if we jump to .nexty soon
ld d, 0
ld e, c
or a
sbc hl, de
or a
sbc hl, de
inc hl
bit 7, h
ld d, a
jr nz, .nexty
ld d, l
pop hl
ld a, b
sub c
dec a
jr z, .justdecy ; we already drew this line (at 45 degrees)
push de
push bc
push hl
; cy-y
ld a, l
sub c
ld l, a
; cx - x + 1
ex af, af'
ld e, a
ex af, af'
ld a, h
sub b
inc a
ld c, a
; b = sx - x
ld a, b
sub e
ld b, a
xor a
sla l
ld h, tbl_scraddr/256 ; this requires tbl_scraddr be aligned to a 256 byte boundary
adc h ; A = H + carry flag
ld h, a ; write it back
; look up screen address from the table
ld a, (hl)
inc l ; this won't overflow because of align 256
ld h, (hl)
ld l, a
push hl
call draw_line_horz_knowaddr
pop de
pop hl
pop bc
push bc
push hl
; cx + sx
ld a, h
ex af, af'
ld h, a
ex af, af'
add h
ld c, a
; b = x - sx
ld a, b
sub h
ld b, a
ld h, d
ld l, e
call draw_line_horz_knowaddr
pop hl
pop bc
push bc
push hl
; cy+y
ld a, l
add c
ld l, a
; cx - x + 1
ld a, h
sub b
inc a
ld c, a
; b = sx - x
ld a, b
ex af, af'
ld b, a
ex af, af'
sub b
ld b, a
xor a
sla l
ld h, tbl_scraddr/256 ; this requires tbl_scraddr be aligned to a 256 byte boundary
adc h ; A = H + carry flag
ld h, a ; write it back
; look up screen address from the table
ld a, (hl)
inc l ; this won't overflow because of align 256
ld h, (hl)
ld l, a
push hl
call draw_line_horz_knowaddr
pop de
pop hl
pop bc
push bc
push hl
; cx + sx
ld a, h
ex af, af'
ld h, a
ex af, af'
add h
ld c, a
; b = x - sx
ld a, b
sub h
ld b, a
ld h, d
ld l, e
call draw_line_horz_knowaddr
pop hl
pop bc
pop de
.justdecy
dec c
ex af, af'
ld a, b
ex af, af'
push hl
.nexty
ld a, c
sub b
pop hl
jp p, .nextline
ret
; H - cx
; L - cy
; D - radius
draw_fill_circle:
; B = xoffset
xor a
; C = yoffset
ld b, a
ld c, d
ld d, a
; push everything
push de
; draw the very first line
push bc
push hl
; cy+x
;ld a, l
;add b
;ld l, a ; B is 0 here
ld a, c
add c
inc a
ld b, a
; cx-y
ld a, h
sub c
ld c, a
call draw_line_horz_xor
jp .doneveryfirstline
.nextline
push de
push bc
push hl
; cy+x
ld a, l
add b
ld l, a
ld a, c
add c
inc a
ld b, a
; cx-y
ld a, h
sub c
ld c, a
call draw_line_horz_xor
pop hl
pop bc
push bc
push hl
; cy-x
ld a, l
sub b
ld l, a
ld a, c
add c
inc a
ld b, a
; cx-y
ld a, h
sub c
ld c, a
call draw_line_horz_xor
.doneveryfirstline
pop hl
pop bc
; work out new d
pop de
push hl
ld h, 0
ld l, d
ld d, h
ld e, b
add hl, de
add hl, de
inc hl
inc b
ld a, l ; A is new D if we jump to .nexty soon
ld d, 0
ld e, c
or a
sbc hl, de
or a
sbc hl, de
inc hl
bit 7, h
ld d, a
jr nz, .nexty
ld d, l
pop hl
ld a, b
sub c
dec a
jr z, .justdecy ; we already drew this line (at 45 degrees)
push de
push bc
push hl
; cy-y
ld a, l
sub c
ld l, a
; cx - x + 1
ld a, h
sub b
inc a
ld c, a
; b = x+x-1
ld a, b
add b
dec a
ld b, a
call draw_line_horz_xor
pop hl
pop bc
push bc
push hl
; cy+y
ld a, l
add c
ld l, a
; cx - x + 1
ld a, h
sub b
inc a
ld c, a
; b = x+x-1
ld a, b
add b
dec a
ld b, a
call draw_line_horz_xor
pop hl
pop bc
pop de
.justdecy
dec c
push hl
.nexty
ld a, c
sub b
pop hl
jp p, .nextline
ret
IF 0
; C - column
; L - row
plot:
xor a
sla l
ld h, tbl_scraddr/256 ; this requires tbl_scraddr be aligned to a 256 byte boundary
adc h ; A = H + carry flag
ld h, a ; write it back
; look up screen address from the table
ld a, (hl)
inc l
ld h, (hl)
ld l, a
ld a, c
and ~7
rrca
rrca
rrca
add l
ld l, a
ld a, c
exx
ld hl, col2pix
and 7
add l
ld l, a
ld a, (hl)
exx
or (hl)
ld (hl), a
ret
ENDIF
; B - number of pixels
; C - column offset
; L - row
draw_line_horz:
xor a
sla l
ld h, tbl_scraddr/256 ; this requires tbl_scraddr be aligned to a 256 byte boundary
adc h ; A = H + carry flag
ld h, a ; write it back
; look up screen address from the table
ld a, (hl)
inc l ; this won't overflow because of align 256
ld h, (hl)
; work out the column address
ld l, a
draw_line_horz_knowaddr:
ld a, c
and ~7
rrca
rrca
rrca
add l
ld l, a
; if C&7 == 0 and B&7 == 0, just draw the middle of the line
ld a, c
or b
and 7
jr z, .drawlinemiddle
.notmiddleonly
; work out (C&7), amount of pixels to draw on left hand side
ld a, c
and 7
jr z, .justdrawrhs
ld e, a ; remember (C&7) in E. will subtract this from line length in a bit
; if 8-C&7 > B (line length), we only draw 1 cell and not all of the pixels
ld a, 8
sub e
cp b
jr nc, .draw1cellpartial
ld c, a
ld a, e ; amount to shift down
exx
ld hl, srlFFtable
add l
ld l, a
ld a, (hl)
exx
; put lefthandside
or (hl)
ld (hl), a
inc l
ld a, b
sub c ; adjust line length for pixels we just drew
ld b, a
and 7
.justdrawrhs
ld e, b ; remember B&7 in E
ld a, b
and ~7
rrca
rrca
rrca
ld b, a
or a
jr z, .dontdrawmiddle
ld a, #FF
.middleloop
ld (hl), a
inc l
djnz .middleloop
.dontdrawmiddle
; work out (B&7), amount of pixels to draw on left hand side
ld a, e
and 7
dec a
ret m
jr z, .putlinerhsnoshift ; no need to shift
exx
ld hl, sra80table
add l
ld l, a
ld a, (hl)
exx
; put righthandside
or (hl)
ld (hl), a
ret
.putlinerhsnoshift
ld a, #80
or (hl)
ld (hl), a
ret
.draw1cellpartial
dec b
ld a, #80
jr z, .nosra
ld a, b
exx
ld hl, sra80table
add l
ld l, a
ld a, (hl)
exx
.nosra
ld b, e
.rrcaagain
rrca
djnz .rrcaagain
or (hl)
ld (hl), a
ret
.drawlinemiddle
ld a, b
rrca
rrca
rrca
ld b, a
ld a, #FF
.middleonlyloop
ld (hl), a
inc l
djnz .middleonlyloop
ret
; B - number of pixels
; C - column offset
; L - row
draw_line_horz_xor:
xor a
sla l
ld h, tbl_scraddr/256 ; this requires tbl_scraddr be aligned to a 256 byte boundary
adc h ; A = H + carry flag
ld h, a ; write it back
; look up screen address from the table
ld a, (hl)
inc l ; this won't overflow because of align 256
ld h, (hl)
; work out the column address
ld l, a
ld a, c
and ~7
rrca
rrca
rrca
add l
ld l, a
; if C&7 == 0 and B&7 == 0, just draw the middle of the line
ld a, c
or b
and 7
jr z, .drawlinemiddle
.notmiddleonly
; work out (C&7), amount of pixels to draw on left hand side
ld a, c
and 7
jr z, .justdrawrhs
ld e, a ; remember (C&7) in E. will subtract this from line length in a bit
; if 8-C&7 > B (line length), we only draw 1 cell and not all of the pixels
ld a, 8
sub e
cp b
jr nc, .draw1cellpartial
ld c, a
ld a, e ; amount to shift down
exx
ld hl, srlFFtable
add l
ld l, a
ld a, (hl)
exx
; put lefthandside
xor (hl)
ld (hl), a
inc l
ld a, b
sub c ; adjust line length for pixels we just drew
ld b, a
and 7
.justdrawrhs
ld e, b ; remember B&7 in E
ld a, b
and ~7
rrca
rrca
rrca
ld b, a
or a
jr z, .dontdrawmiddle
;ld a, #FF
ld c, #FF
.middleloop
ld a, c
xor (hl)
ld (hl), a
inc l
djnz .middleloop
.dontdrawmiddle
; work out (B&7), amount of pixels to draw on left hand side
ld a, e
and 7
dec a
ret m
jr z, .putlinerhsnoshift ; no need to shift
exx
ld hl, sra80table
add l
ld l, a
ld a, (hl)
exx
; put righthandside
xor (hl)
ld (hl), a
ret
.putlinerhsnoshift
ld a, #80
xor (hl)
ld (hl), a
ret
.draw1cellpartial
dec b
ld a, #80
jr z, .nosra
ld a, b
exx
ld hl, sra80table
add l
ld l, a
ld a, (hl)
exx
.nosra
ld b, e
.rrcaagain
rrca
djnz .rrcaagain
xor (hl)
ld (hl), a
ret
.drawlinemiddle
ld a, b
rrca
rrca
rrca
ld b, a
ld c, #FF
.middleonlyloop
ld a, c
xor (hl)
ld (hl), a
inc l
djnz .middleonlyloop
ret
cls:
di ;disable interrupt
ld (.stack+1), sp ;store current stack pointer
ld sp, 16384 + 6144 + 768
ld b, 128 ; clear attribs in 128 * 3 pushes
ld h, a
ld l, a
.attribloop
push hl
push hl
push hl
djnz .attribloop
ld hl, 0
ld b, l ;set B to 0. it causes that DJNZ will repeat 256 times
.loop1
push hl ;store hl on stack
push hl ;next
push hl ;these four push instruction stores 8 bytes on stack
push hl
push hl ;store hl on stack
push hl ;next
push hl ;these four push instruction stores 8 bytes on stack
push hl
push hl ;store hl on stack
push hl ;next
push hl ;these four push instruction stores 8 bytes on stack
push hl
djnz .loop1 ;repeat for next 12*2 bytes
.stack
ld sp, 0 ;parameter will be overwritten
ei
ret
data_section:
IF RETURN_TO_BASIC
stashed_iy dw 0
stashed_hl_alt dw 0
stashed_sp dw 0
ENDIF
ALIGN 256
; screen address table. This must be 256 byte aligned
tbl_scraddr dw SCRBUF_BASEADDR + #0000, SCRBUF_BASEADDR + #0100, SCRBUF_BASEADDR + #0200, SCRBUF_BASEADDR + #0300, SCRBUF_BASEADDR + #0400, SCRBUF_BASEADDR + #0500, SCRBUF_BASEADDR + #0600, SCRBUF_BASEADDR + #0700
dw SCRBUF_BASEADDR + #0020, SCRBUF_BASEADDR + #0120, SCRBUF_BASEADDR + #0220, SCRBUF_BASEADDR + #0320, SCRBUF_BASEADDR + #0420, SCRBUF_BASEADDR + #0520, SCRBUF_BASEADDR + #0620, SCRBUF_BASEADDR + #0720
dw SCRBUF_BASEADDR + #0040, SCRBUF_BASEADDR + #0140, SCRBUF_BASEADDR + #0240, SCRBUF_BASEADDR + #0340, SCRBUF_BASEADDR + #0440, SCRBUF_BASEADDR + #0540, SCRBUF_BASEADDR + #0640, SCRBUF_BASEADDR + #0740
dw SCRBUF_BASEADDR + #0060, SCRBUF_BASEADDR + #0160, SCRBUF_BASEADDR + #0260, SCRBUF_BASEADDR + #0360, SCRBUF_BASEADDR + #0460, SCRBUF_BASEADDR + #0560, SCRBUF_BASEADDR + #0660, SCRBUF_BASEADDR + #0760
dw SCRBUF_BASEADDR + #0080, SCRBUF_BASEADDR + #0180, SCRBUF_BASEADDR + #0280, SCRBUF_BASEADDR + #0380, SCRBUF_BASEADDR + #0480, SCRBUF_BASEADDR + #0580, SCRBUF_BASEADDR + #0680, SCRBUF_BASEADDR + #0780
dw SCRBUF_BASEADDR + #00a0, SCRBUF_BASEADDR + #01a0, SCRBUF_BASEADDR + #02a0, SCRBUF_BASEADDR + #03a0, SCRBUF_BASEADDR + #04a0, SCRBUF_BASEADDR + #05a0, SCRBUF_BASEADDR + #06a0, SCRBUF_BASEADDR + #07a0
dw SCRBUF_BASEADDR + #00c0, SCRBUF_BASEADDR + #01c0, SCRBUF_BASEADDR + #02c0, SCRBUF_BASEADDR + #03c0, SCRBUF_BASEADDR + #04c0, SCRBUF_BASEADDR + #05c0, SCRBUF_BASEADDR + #06c0, SCRBUF_BASEADDR + #07c0
dw SCRBUF_BASEADDR + #00e0, SCRBUF_BASEADDR + #01e0, SCRBUF_BASEADDR + #02e0, SCRBUF_BASEADDR + #03e0, SCRBUF_BASEADDR + #04e0, SCRBUF_BASEADDR + #05e0, SCRBUF_BASEADDR + #06e0, SCRBUF_BASEADDR + #07e0
dw SCRBUF_BASEADDR + #0800, SCRBUF_BASEADDR + #0900, SCRBUF_BASEADDR + #0a00, SCRBUF_BASEADDR + #0b00, SCRBUF_BASEADDR + #0c00, SCRBUF_BASEADDR + #0d00, SCRBUF_BASEADDR + #0e00, SCRBUF_BASEADDR + #0f00
dw SCRBUF_BASEADDR + #0820, SCRBUF_BASEADDR + #0920, SCRBUF_BASEADDR + #0a20, SCRBUF_BASEADDR + #0b20, SCRBUF_BASEADDR + #0c20, SCRBUF_BASEADDR + #0d20, SCRBUF_BASEADDR + #0e20, SCRBUF_BASEADDR + #0f20
dw SCRBUF_BASEADDR + #0840, SCRBUF_BASEADDR + #0940, SCRBUF_BASEADDR + #0a40, SCRBUF_BASEADDR + #0b40, SCRBUF_BASEADDR + #0c40, SCRBUF_BASEADDR + #0d40, SCRBUF_BASEADDR + #0e40, SCRBUF_BASEADDR + #0f40
dw SCRBUF_BASEADDR + #0860, SCRBUF_BASEADDR + #0960, SCRBUF_BASEADDR + #0a60, SCRBUF_BASEADDR + #0b60, SCRBUF_BASEADDR + #0c60, SCRBUF_BASEADDR + #0d60, SCRBUF_BASEADDR + #0e60, SCRBUF_BASEADDR + #0f60
dw SCRBUF_BASEADDR + #0880, SCRBUF_BASEADDR + #0980, SCRBUF_BASEADDR + #0a80, SCRBUF_BASEADDR + #0b80, SCRBUF_BASEADDR + #0c80, SCRBUF_BASEADDR + #0d80, SCRBUF_BASEADDR + #0e80, SCRBUF_BASEADDR + #0f80
dw SCRBUF_BASEADDR + #08a0, SCRBUF_BASEADDR + #09a0, SCRBUF_BASEADDR + #0aa0, SCRBUF_BASEADDR + #0ba0, SCRBUF_BASEADDR + #0ca0, SCRBUF_BASEADDR + #0da0, SCRBUF_BASEADDR + #0ea0, SCRBUF_BASEADDR + #0fa0
dw SCRBUF_BASEADDR + #08c0, SCRBUF_BASEADDR + #09c0, SCRBUF_BASEADDR + #0ac0, SCRBUF_BASEADDR + #0bc0, SCRBUF_BASEADDR + #0cc0, SCRBUF_BASEADDR + #0dc0, SCRBUF_BASEADDR + #0ec0, SCRBUF_BASEADDR + #0fc0
dw SCRBUF_BASEADDR + #08e0, SCRBUF_BASEADDR + #09e0, SCRBUF_BASEADDR + #0ae0, SCRBUF_BASEADDR + #0be0, SCRBUF_BASEADDR + #0ce0, SCRBUF_BASEADDR + #0de0, SCRBUF_BASEADDR + #0ee0, SCRBUF_BASEADDR + #0fe0
dw SCRBUF_BASEADDR + #1000, SCRBUF_BASEADDR + #1100, SCRBUF_BASEADDR + #1200, SCRBUF_BASEADDR + #1300, SCRBUF_BASEADDR + #1400, SCRBUF_BASEADDR + #1500, SCRBUF_BASEADDR + #1600, SCRBUF_BASEADDR + #1700
dw SCRBUF_BASEADDR + #1020, SCRBUF_BASEADDR + #1120, SCRBUF_BASEADDR + #1220, SCRBUF_BASEADDR + #1320, SCRBUF_BASEADDR + #1420, SCRBUF_BASEADDR + #1520, SCRBUF_BASEADDR + #1620, SCRBUF_BASEADDR + #1720
dw SCRBUF_BASEADDR + #1040, SCRBUF_BASEADDR + #1140, SCRBUF_BASEADDR + #1240, SCRBUF_BASEADDR + #1340, SCRBUF_BASEADDR + #1440, SCRBUF_BASEADDR + #1540, SCRBUF_BASEADDR + #1640, SCRBUF_BASEADDR + #1740
dw SCRBUF_BASEADDR + #1060, SCRBUF_BASEADDR + #1160, SCRBUF_BASEADDR + #1260, SCRBUF_BASEADDR + #1360, SCRBUF_BASEADDR + #1460, SCRBUF_BASEADDR + #1560, SCRBUF_BASEADDR + #1660, SCRBUF_BASEADDR + #1760
dw SCRBUF_BASEADDR + #1080, SCRBUF_BASEADDR + #1180, SCRBUF_BASEADDR + #1280, SCRBUF_BASEADDR + #1380, SCRBUF_BASEADDR + #1480, SCRBUF_BASEADDR + #1580, SCRBUF_BASEADDR + #1680, SCRBUF_BASEADDR + #1780
dw SCRBUF_BASEADDR + #10a0, SCRBUF_BASEADDR + #11a0, SCRBUF_BASEADDR + #12a0, SCRBUF_BASEADDR + #13a0, SCRBUF_BASEADDR + #14a0, SCRBUF_BASEADDR + #15a0, SCRBUF_BASEADDR + #16a0, SCRBUF_BASEADDR + #17a0
dw SCRBUF_BASEADDR + #10c0, SCRBUF_BASEADDR + #11c0, SCRBUF_BASEADDR + #12c0, SCRBUF_BASEADDR + #13c0, SCRBUF_BASEADDR + #14c0, SCRBUF_BASEADDR + #15c0, SCRBUF_BASEADDR + #16c0, SCRBUF_BASEADDR + #17c0
dw SCRBUF_BASEADDR + #10e0, SCRBUF_BASEADDR + #11e0, SCRBUF_BASEADDR + #12e0, SCRBUF_BASEADDR + #13e0, SCRBUF_BASEADDR + #14e0, SCRBUF_BASEADDR + #15e0, SCRBUF_BASEADDR + #16e0, SCRBUF_BASEADDR + #17e0
col2pix db #80, #40, #20, #10, #08, #04, #02, #01
; #FF >> 0..7
srlFFtable db #FF, #7F, #3F, #1F, #0F, #07, #03, #01
; same but for arithmetic shift right
sra80table db #80, #C0, #E0, #F0, #F8, #FC, #FE, #FF
endofprog: