mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-12-27 17:29:49 +00:00
hgr: add horizontal scroll test case
This commit is contained in:
parent
8611d9281e
commit
d8a46a4c3d
44
graphics/hgr/horiz_scroll/Makefile
Normal file
44
graphics/hgr/horiz_scroll/Makefile
Normal file
@ -0,0 +1,44 @@
|
||||
include ../../../Makefile.inc
|
||||
|
||||
DOS33 = ../../../utils/dos33fs-utils/dos33
|
||||
DOS33_RAW = ../../../utils/dos33fs-utils/dos33_raw
|
||||
EMPTY_DISK = ../../../empty_disk/empty.dsk
|
||||
TOKENIZE = ../../../utils/asoft_basic-utils/tokenize_asoft
|
||||
LINKER_SCRIPTS = ../../../linker_scripts/
|
||||
|
||||
all: horiz_scroll.dsk
|
||||
|
||||
####
|
||||
|
||||
horiz_scroll.dsk: HELLO HSCROLL_TEST
|
||||
cp $(EMPTY_DISK) horiz_scroll.dsk
|
||||
$(DOS33) -y horiz_scroll.dsk SAVE A HELLO
|
||||
$(DOS33) -y horiz_scroll.dsk BSAVE -a 0x6000 HSCROLL_TEST
|
||||
|
||||
###
|
||||
|
||||
HELLO: hello.bas
|
||||
$(TOKENIZE) < hello.bas > HELLO
|
||||
|
||||
|
||||
|
||||
####
|
||||
|
||||
HSCROLL_TEST: hscroll_test.o
|
||||
ld65 -o HSCROLL_TEST hscroll_test.o -C $(LINKER_SCRIPTS)/apple2_6000.inc
|
||||
|
||||
hscroll_test.o: hscroll_test.s zx02_optim.s \
|
||||
graphics/pq2_bgl.hgr.zx02 \
|
||||
graphics/pq2_bgr.hgr.zx02 \
|
||||
horiz_scroll.s hgr_partial.s \
|
||||
zp.inc hardware.inc
|
||||
ca65 -o hscroll_test.o hscroll_test.s -l hscroll_test.lst
|
||||
|
||||
###
|
||||
|
||||
graphics/pq2_bgl.hgr.zx02:
|
||||
cd graphics && make
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o *.lst HELLO HSCROLL_TEST
|
||||
cd graphics && make clean
|
3
graphics/hgr/horiz_scroll/NOTES
Normal file
3
graphics/hgr/horiz_scroll/NOTES
Normal file
@ -0,0 +1,3 @@
|
||||
|
||||
$8000-?? code
|
||||
|
50
graphics/hgr/horiz_scroll/graphics/Makefile
Normal file
50
graphics/hgr/horiz_scroll/graphics/Makefile
Normal file
@ -0,0 +1,50 @@
|
||||
include ../../../../Makefile.inc
|
||||
|
||||
ZX02 = ~/research/6502_compression/zx02.git/build/zx02
|
||||
PNG_TO_HGR = ../../../../utils/hgr-utils/png2hgr
|
||||
PNG2GR = ../../../../utils/gr-utils/png2gr
|
||||
|
||||
all: pq2_bgl.hgr.zx02 pq2_bgr.hgr.zx02
|
||||
|
||||
|
||||
####
|
||||
|
||||
pq2_dialog1.hgr.zx02: pq2_dialog1.hgr
|
||||
$(ZX02) pq2_dialog1.hgr pq2_dialog1.hgr.zx02
|
||||
|
||||
pq2_dialog1.hgr: pq2_dialog1.png
|
||||
$(PNG_TO_HGR) pq2_dialog1.png > pq2_dialog1.hgr
|
||||
|
||||
####
|
||||
|
||||
pq2_dialog2.hgr.zx02: pq2_dialog2.hgr
|
||||
$(ZX02) pq2_dialog2.hgr pq2_dialog2.hgr.zx02
|
||||
|
||||
pq2_dialog2.hgr: pq2_dialog2.png
|
||||
$(PNG_TO_HGR) pq2_dialog2.png > pq2_dialog2.hgr
|
||||
|
||||
|
||||
####
|
||||
|
||||
pq2_bgl.hgr.zx02: pq2_bgl.hgr
|
||||
$(ZX02) pq2_bgl.hgr pq2_bgl.hgr.zx02
|
||||
|
||||
pq2_bgl.hgr: pq2_bgl.png
|
||||
$(PNG_TO_HGR) pq2_bgl.png > pq2_bgl.hgr
|
||||
|
||||
####
|
||||
|
||||
pq2_bgr.hgr.zx02: pq2_bgr.hgr
|
||||
$(ZX02) pq2_bgr.hgr pq2_bgr.hgr.zx02
|
||||
|
||||
pq2_bgr.hgr: pq2_bgr.png
|
||||
$(PNG_TO_HGR) pq2_bgr.png > pq2_bgr.hgr
|
||||
|
||||
|
||||
|
||||
####
|
||||
|
||||
clean:
|
||||
rm -f *~ *.zx02 *.hgr
|
||||
|
||||
|
BIN
graphics/hgr/horiz_scroll/graphics/long_pq2.png
Normal file
BIN
graphics/hgr/horiz_scroll/graphics/long_pq2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
BIN
graphics/hgr/horiz_scroll/graphics/pq2_bgl.png
Normal file
BIN
graphics/hgr/horiz_scroll/graphics/pq2_bgl.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
BIN
graphics/hgr/horiz_scroll/graphics/pq2_bgr.png
Normal file
BIN
graphics/hgr/horiz_scroll/graphics/pq2_bgr.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.6 KiB |
101
graphics/hgr/horiz_scroll/hardware.inc
Normal file
101
graphics/hgr/horiz_scroll/hardware.inc
Normal file
@ -0,0 +1,101 @@
|
||||
; HARDWARE LOCATIONS
|
||||
|
||||
KEYPRESS = $C000
|
||||
KEYRESET = $C010
|
||||
|
||||
; SOFT SWITCHES
|
||||
CLR80COL = $C000 ; PAGE1/PAGE1 normal
|
||||
SET80COL = $C001 ; PAGE1/PAGE2 switches PAGE1 in Aux instead
|
||||
EIGHTYCOLOFF = $C00C
|
||||
EIGHTYCOLON = $C00D
|
||||
TBCOLOR = $C022 ; IIgs text fg/bg colors
|
||||
NEWVIDEO = $C029 ; IIgs graphics modes
|
||||
SPEAKER = $C030
|
||||
CLOCKCTL = $C034 ; bits 0-3 are IIgs border color
|
||||
CYAREG = $C036 ; iigs motor detect and clock speed
|
||||
SET_GR = $C050
|
||||
SET_TEXT = $C051
|
||||
FULLGR = $C052
|
||||
TEXTGR = $C053
|
||||
PAGE1 = $C054
|
||||
PAGE2 = $C055
|
||||
LORES = $C056 ; Enable LORES graphics
|
||||
HIRES = $C057 ; Enable HIRES graphics
|
||||
AN3 = $C05E ; Annunciator 3
|
||||
|
||||
PADDLE_BUTTON0 = $C061
|
||||
PADDL0 = $C064
|
||||
PTRIG = $C070
|
||||
|
||||
; APPLESOFT BASIC ROUTINES
|
||||
|
||||
NORMAL = $F273
|
||||
HGR2 = $F3D8
|
||||
HGR = $F3E2
|
||||
BKGND0 = $F3F4 ; clear current page to A
|
||||
HPOSN = $F411 ; (Y,X),(A) (values stores in HGRX,XH,Y)
|
||||
HPLOT0 = $F457 ; plot at (Y,X), (A)
|
||||
COLOR_SHIFT = $F47E
|
||||
HLINRL = $F530 ; (X,A),(Y)
|
||||
HGLIN = $F53A ; line to (X,A),(Y)
|
||||
COLORTBL = $F6F6
|
||||
|
||||
; MONITOR ROUTINES
|
||||
|
||||
HLINE = $F819 ; HLINE Y,$2C at A
|
||||
VLINE = $F828 ; VLINE A,$2D at Y
|
||||
CLRSCR = $F832 ; Clear low-res screen
|
||||
CLRTOP = $F836 ; clear only top of low-res screen
|
||||
SETCOL = $F864 ; COLOR=A
|
||||
ROM_TEXT2COPY = $F962 ; iigs
|
||||
TEXT = $FB36
|
||||
TABV = $FB5B ; VTAB to A
|
||||
ROM_MACHINEID = $FBB3 ; iigs
|
||||
BASCALC = $FBC1 ;
|
||||
BELL = $FBDD ; ring the bell
|
||||
VTAB = $FC22 ; VTAB to CV
|
||||
HOME = $FC58 ; Clear the text screen
|
||||
WAIT = $FCA8 ; delay 1/2(26+27A+5A^2) us
|
||||
SETINV = $FE80 ; INVERSE
|
||||
SETNORM = $FE84 ; NORMAL
|
||||
COUT = $FDED ; output A to screen
|
||||
COUT1 = $FDF0 ; output A to screen
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
COLOR_BLACK = 0
|
||||
COLOR_RED = 1
|
||||
COLOR_DARKBLUE = 2
|
||||
COLOR_PURPLE = 3
|
||||
COLOR_DARKGREEN = 4
|
||||
COLOR_GREY = 5
|
||||
COLOR_MEDIUMBLUE = 6
|
||||
COLOR_LIGHTBLUE = 7
|
||||
COLOR_BROWN = 8
|
||||
COLOR_ORANGE = 9
|
||||
COLOR_GREY2 = 10
|
||||
COLOR_PINK = 11
|
||||
COLOR_LIGHTGREEN = 12
|
||||
COLOR_YELLOW = 13
|
||||
COLOR_AQUA = 14
|
||||
COLOR_WHITE = 15
|
||||
|
||||
COLOR_BOTH_BLACK = $00
|
||||
COLOR_BOTH_RED = $11
|
||||
COLOR_BOTH_DARKBLUE = $22
|
||||
COLOR_BOTH_DARKGREEN = $44
|
||||
COLOR_BOTH_GREY = $55
|
||||
COLOR_BOTH_MEDIUMBLUE = $66
|
||||
COLOR_BOTH_LIGHTBLUE = $77
|
||||
COLOR_BOTH_BROWN = $88
|
||||
COLOR_BOTH_ORANGE = $99
|
||||
COLOR_BOTH_PINK = $BB
|
||||
COLOR_BOTH_LIGHTGREEN = $CC
|
||||
COLOR_BOTH_YELLOW = $DD
|
||||
COLOR_BOTH_AQUA = $EE
|
||||
COLOR_BOTH_WHITE = $FF
|
||||
|
4
graphics/hgr/horiz_scroll/hello.bas
Normal file
4
graphics/hgr/horiz_scroll/hello.bas
Normal file
@ -0,0 +1,4 @@
|
||||
5 HOME
|
||||
100 PRINT " ______"
|
||||
110 PRINT " A \/\/\/ SOFTWARE PRODUCTION"
|
||||
120 PRINT CHR$(4);"BRUN HSCROLL_TEST"
|
89
graphics/hgr/horiz_scroll/hgr_clear_screen.s
Normal file
89
graphics/hgr/horiz_scroll/hgr_clear_screen.s
Normal file
@ -0,0 +1,89 @@
|
||||
hgr_clear_screen:
|
||||
lda DRAW_PAGE
|
||||
beq hgr_page1_clearscreen
|
||||
lda #0
|
||||
beq hgr_page2_clearscreen
|
||||
|
||||
hgr_page1_clearscreen:
|
||||
|
||||
ldy #0
|
||||
hgr_page1_cls_loop:
|
||||
sta $2000,Y
|
||||
sta $2100,Y
|
||||
sta $2200,Y
|
||||
sta $2300,Y
|
||||
sta $2400,Y
|
||||
sta $2500,Y
|
||||
sta $2600,Y
|
||||
sta $2700,Y
|
||||
sta $2800,Y
|
||||
sta $2900,Y
|
||||
sta $2A00,Y
|
||||
sta $2B00,Y
|
||||
sta $2C00,Y
|
||||
sta $2D00,Y
|
||||
sta $2E00,Y
|
||||
sta $2F00,Y
|
||||
sta $3000,Y
|
||||
sta $3100,Y
|
||||
sta $3200,Y
|
||||
sta $3300,Y
|
||||
sta $3400,Y
|
||||
sta $3500,Y
|
||||
sta $3600,Y
|
||||
sta $3700,Y
|
||||
sta $3800,Y
|
||||
sta $3900,Y
|
||||
sta $3A00,Y
|
||||
sta $3B00,Y
|
||||
sta $3C00,Y
|
||||
sta $3D00,Y
|
||||
sta $3E00,Y
|
||||
sta $3F00,Y
|
||||
iny
|
||||
bne hgr_page1_cls_loop
|
||||
|
||||
rts
|
||||
|
||||
|
||||
hgr_page2_clearscreen:
|
||||
|
||||
ldy #0
|
||||
hgr_page2_cls_loop:
|
||||
sta $4000,Y
|
||||
sta $4100,Y
|
||||
sta $4200,Y
|
||||
sta $4300,Y
|
||||
sta $4400,Y
|
||||
sta $4500,Y
|
||||
sta $4600,Y
|
||||
sta $4700,Y
|
||||
sta $4800,Y
|
||||
sta $4900,Y
|
||||
sta $4A00,Y
|
||||
sta $4B00,Y
|
||||
sta $4C00,Y
|
||||
sta $4D00,Y
|
||||
sta $4E00,Y
|
||||
sta $4F00,Y
|
||||
sta $5000,Y
|
||||
sta $5100,Y
|
||||
sta $5200,Y
|
||||
sta $5300,Y
|
||||
sta $5400,Y
|
||||
sta $5500,Y
|
||||
sta $5600,Y
|
||||
sta $5700,Y
|
||||
sta $5800,Y
|
||||
sta $5900,Y
|
||||
sta $5A00,Y
|
||||
sta $5B00,Y
|
||||
sta $5C00,Y
|
||||
sta $5D00,Y
|
||||
sta $5E00,Y
|
||||
sta $5F00,Y
|
||||
iny
|
||||
bne hgr_page2_cls_loop
|
||||
|
||||
rts
|
||||
|
46
graphics/hgr/horiz_scroll/hgr_partial.s
Normal file
46
graphics/hgr/horiz_scroll/hgr_partial.s
Normal file
@ -0,0 +1,46 @@
|
||||
; copy partial part of screen from $6000 to DRAW_PAGE
|
||||
; HGR_X1,HGR_Y1 to HGR_X2,HGR_Y2 source
|
||||
; destination = Y at HGR_DEST
|
||||
|
||||
hgr_partial:
|
||||
lda HGR_DEST
|
||||
sta dest_y_smc+1
|
||||
|
||||
ldx HGR_Y1 ; Y1
|
||||
hgr_partial_outer_loop:
|
||||
lda hposn_low,X
|
||||
sta INL
|
||||
lda hposn_high,X
|
||||
ora #$40 ; convert to $6000
|
||||
sta INH
|
||||
|
||||
txa
|
||||
pha
|
||||
|
||||
dest_y_smc:
|
||||
ldx #100 ; DEST_Y
|
||||
lda hposn_low,X
|
||||
sta OUTL
|
||||
lda hposn_high,X
|
||||
clc
|
||||
adc DRAW_PAGE
|
||||
sta OUTH
|
||||
|
||||
pla
|
||||
tax
|
||||
|
||||
ldy HGR_X1 ; X1
|
||||
hgr_partial_inner_loop:
|
||||
lda (INL),Y
|
||||
sta (OUTL),Y
|
||||
iny
|
||||
cpy HGR_X2 ; X2
|
||||
bne hgr_partial_inner_loop
|
||||
|
||||
inc dest_y_smc+1
|
||||
|
||||
inx
|
||||
cpx HGR_Y2 ; Y2
|
||||
bne hgr_partial_outer_loop
|
||||
|
||||
rts
|
97
graphics/hgr/horiz_scroll/hgr_table.s
Normal file
97
graphics/hgr/horiz_scroll/hgr_table.s
Normal file
@ -0,0 +1,97 @@
|
||||
;div7_table = $b800
|
||||
;mod7_table = $b900
|
||||
;hposn_high = $ba00
|
||||
;hposn_low = $bb00
|
||||
|
||||
|
||||
hgr_make_tables:
|
||||
|
||||
;=====================
|
||||
; make /7 %7 tables
|
||||
;=====================
|
||||
|
||||
hgr_make_7_tables:
|
||||
|
||||
ldy #0
|
||||
lda #0
|
||||
ldx #0
|
||||
div7_loop:
|
||||
sta div7_table,Y
|
||||
|
||||
inx
|
||||
cpx #7
|
||||
bne div7_not7
|
||||
|
||||
clc
|
||||
adc #1
|
||||
ldx #0
|
||||
div7_not7:
|
||||
iny
|
||||
bne div7_loop
|
||||
|
||||
|
||||
ldy #0
|
||||
lda #0
|
||||
mod7_loop:
|
||||
sta mod7_table,Y
|
||||
clc
|
||||
adc #1
|
||||
cmp #7
|
||||
bne mod7_not7
|
||||
lda #0
|
||||
mod7_not7:
|
||||
iny
|
||||
bne mod7_loop
|
||||
|
||||
|
||||
; Hposn table
|
||||
|
||||
; hposn_low, hposn_high will each be filled with $C0 bytes
|
||||
; based on routine by John Brooks
|
||||
; posted on comp.sys.apple2 on 2018-07-11
|
||||
; https://groups.google.com/d/msg/comp.sys.apple2/v2HOfHOmeNQ/zD76fJg_BAAJ
|
||||
; clobbers A,X
|
||||
; preserves Y
|
||||
|
||||
; vmw note: version I was using based on applesoft HPOSN was ~64 bytes
|
||||
; this one is 37 bytes
|
||||
|
||||
build_hposn_tables:
|
||||
ldx #0
|
||||
btmi:
|
||||
txa
|
||||
and #$F8
|
||||
bpl btpl1
|
||||
ora #5
|
||||
btpl1:
|
||||
asl
|
||||
bpl btpl2
|
||||
ora #5
|
||||
btpl2:
|
||||
asl
|
||||
asl
|
||||
sta hposn_low, X
|
||||
txa
|
||||
and #7
|
||||
rol
|
||||
asl hposn_low, X
|
||||
rol
|
||||
ora #$20
|
||||
sta hposn_high, X
|
||||
inx
|
||||
cpx #$C0
|
||||
bne btmi
|
||||
|
||||
; go 16 beyond, which allows our text scrolling routine
|
||||
|
||||
ldx #16
|
||||
extra_table_loop:
|
||||
lda hposn_low,X
|
||||
sta hposn_low+192,X
|
||||
lda hposn_high,X
|
||||
eor #$60
|
||||
sta hposn_high+192,X
|
||||
dex
|
||||
bpl extra_table_loop
|
||||
|
||||
rts
|
183
graphics/hgr/horiz_scroll/horiz_scroll.s
Normal file
183
graphics/hgr/horiz_scroll/horiz_scroll.s
Normal file
@ -0,0 +1,183 @@
|
||||
;============================
|
||||
; do the pan
|
||||
|
||||
horiz_pan:
|
||||
|
||||
pan_loop:
|
||||
|
||||
lda #0
|
||||
sta COUNT
|
||||
sta TICKER
|
||||
sta P2_OFFSET
|
||||
|
||||
pan_outer_outer_loop:
|
||||
|
||||
ldx #191
|
||||
pan_outer_loop:
|
||||
|
||||
; $2000 ; 0010 -> 0100 0011 -> 0101
|
||||
lda hposn_high,X
|
||||
sta pil_smc1+2
|
||||
sta pil_smc2+2
|
||||
sta pil_smc3+2
|
||||
; sta pil_smc4+2
|
||||
sta pil_smc6+2
|
||||
; $4000
|
||||
eor #$60
|
||||
sta pil_smc5+2
|
||||
sta pil_smc7+2
|
||||
sta pil_smc8+2
|
||||
sta pil_smc9+2
|
||||
|
||||
; $2000
|
||||
lda hposn_low,X
|
||||
sta pil_smc1+1
|
||||
sta pil_smc2+1
|
||||
; sta pil_smc4+1
|
||||
sta pil_smc6+1
|
||||
sta pil_smc5+1
|
||||
sta pil_smc8+1
|
||||
|
||||
; $2000+1
|
||||
|
||||
sta pil_smc3+1
|
||||
inc pil_smc3+1
|
||||
sta pil_smc7+1
|
||||
inc pil_smc7+1
|
||||
sta pil_smc9+1
|
||||
inc pil_smc9+1
|
||||
|
||||
|
||||
stx XSAVE
|
||||
|
||||
|
||||
ldy #0
|
||||
|
||||
; original: 36*39 = ??
|
||||
; updated: 34*39
|
||||
|
||||
pil_smc1:
|
||||
ldx $2000,Y ; ; 4+
|
||||
pan_inner_loop:
|
||||
|
||||
lda left_lookup_main,X ; 4+
|
||||
sta TEMPY ; 3
|
||||
|
||||
pil_smc3:
|
||||
ldx $2000+1,Y ; 4+
|
||||
lda left_lookup_next,X ; 4+
|
||||
ora TEMPY ; 3
|
||||
|
||||
pil_smc2:
|
||||
sta $2000,Y ; 5
|
||||
|
||||
iny ; 2
|
||||
cpy #39 ; 2
|
||||
bne pan_inner_loop ; 2/3
|
||||
|
||||
; leftover
|
||||
|
||||
; X has $2000,39
|
||||
lda left_lookup_main,X ; 4+
|
||||
sta TEMPY ; 3
|
||||
|
||||
pil_smc5:
|
||||
ldx $4000 ; 4+
|
||||
lda left_lookup_next,X ; 4+
|
||||
ora TEMPY ; 3
|
||||
|
||||
pil_smc6:
|
||||
sta $2000,Y ; 5
|
||||
|
||||
; X has $4000
|
||||
lda left_lookup_main,X ; 4+
|
||||
sta TEMPY ; 3
|
||||
|
||||
pil_smc7:
|
||||
ldx $4000+1 ; 4+
|
||||
lda left_lookup_next,X ; 4+
|
||||
ora TEMPY ; 3
|
||||
|
||||
pil_smc8:
|
||||
sta $4000 ; 5
|
||||
|
||||
lda left_lookup_main,X ; 4+
|
||||
pil_smc9:
|
||||
sta $4000+1 ; 5
|
||||
|
||||
; $2038 $2039 $4000 $4001
|
||||
;0 DCCBBAA GGFFEED KJJIIHH NNMMLLK
|
||||
;1 EDDCCBB HHGGFFE LKKJJII ~~NNMML
|
||||
;2 FEEDDCC IIHHGGF MLLKKJJ ~~~~NNM
|
||||
;3 GFFEEDD JJIIHHG NMMLLKK ~~~~~~N
|
||||
;4 HGGFFEE KKJJIIH ~NNMMLL ~~~~~~~
|
||||
;5 IHHGGFF LLKKJJI ~~~NNMM ~~~~~~~
|
||||
;6 JIIHHGG MMLLKKJ ~~~~~NN ~~~~~~~
|
||||
;7 KJJIIHH NNMMLLK ~~~~~~~ ~~~~~~~
|
||||
;8 RQQPPOO UUTTSSR
|
||||
|
||||
; every 8 clicks need to copy over two more columns
|
||||
|
||||
ldx XSAVE
|
||||
|
||||
dex
|
||||
; cpx #15 ; #$ff
|
||||
; bne pan_outer_loop
|
||||
beq done_pan_outer_loop
|
||||
jmp pan_outer_loop
|
||||
done_pan_outer_loop:
|
||||
|
||||
lda KEYPRESS
|
||||
bmi done_pan
|
||||
|
||||
; check if update
|
||||
; FIXME: use mod 7 table here
|
||||
inc TICKER
|
||||
lda TICKER
|
||||
cmp #7
|
||||
bne no_ticker
|
||||
|
||||
lda #0
|
||||
sta TICKER
|
||||
inc P2_OFFSET
|
||||
inc P2_OFFSET
|
||||
|
||||
ldx #0
|
||||
p2_loop:
|
||||
lda hposn_low,X
|
||||
sta GBASL
|
||||
lda hposn_high,X
|
||||
eor #$60
|
||||
sta GBASH
|
||||
|
||||
ldy P2_OFFSET
|
||||
lda (GBASL),Y
|
||||
pha
|
||||
iny
|
||||
lda (GBASL),Y
|
||||
ldy #1
|
||||
sta (GBASL),Y
|
||||
dey
|
||||
pla
|
||||
sta (GBASL),Y
|
||||
|
||||
inx
|
||||
cpx #192
|
||||
bne p2_loop
|
||||
|
||||
|
||||
no_ticker:
|
||||
inc COUNT
|
||||
lda COUNT
|
||||
cmp #139
|
||||
beq done_pan
|
||||
|
||||
; bne pan_outer_outer_loop
|
||||
jmp pan_outer_outer_loop
|
||||
|
||||
done_pan:
|
||||
bit KEYRESET
|
||||
|
||||
rts
|
||||
|
||||
.include "scroll_tables.s"
|
94
graphics/hgr/horiz_scroll/hscroll_test.s
Normal file
94
graphics/hgr/horiz_scroll/hscroll_test.s
Normal file
@ -0,0 +1,94 @@
|
||||
; Test horizontal scroll
|
||||
|
||||
;
|
||||
; by deater (Vince Weaver) <vince@deater.net>
|
||||
|
||||
.include "zp.inc"
|
||||
.include "hardware.inc"
|
||||
|
||||
mod7_table = $1c00
|
||||
div7_table = $1d00
|
||||
hposn_low = $1e00
|
||||
hposn_high = $1f00
|
||||
|
||||
hscroll_test:
|
||||
;=====================
|
||||
; initializations
|
||||
;=====================
|
||||
|
||||
;===================
|
||||
; Load graphics
|
||||
;===================
|
||||
|
||||
bit SET_GR
|
||||
bit HIRES
|
||||
bit FULLGR
|
||||
bit PAGE1
|
||||
|
||||
jsr hgr_make_tables
|
||||
|
||||
lda #0
|
||||
jsr hgr_page1_clearscreen
|
||||
|
||||
;======================================
|
||||
;======================================
|
||||
; Pan
|
||||
;======================================
|
||||
;======================================
|
||||
; do we have room to do page flipping?
|
||||
|
||||
|
||||
;===========================================
|
||||
; load left logo to $2000 and right to $4000
|
||||
|
||||
; left logo
|
||||
|
||||
lda #<intro_left_data
|
||||
sta zx_src_l+1
|
||||
|
||||
lda #>intro_left_data
|
||||
sta zx_src_h+1
|
||||
|
||||
lda #$20
|
||||
|
||||
jsr zx02_full_decomp
|
||||
|
||||
; right logo
|
||||
|
||||
lda #<intro_right_data
|
||||
sta zx_src_l+1
|
||||
lda #>intro_right_data
|
||||
sta zx_src_h+1
|
||||
lda #$40
|
||||
jsr zx02_full_decomp
|
||||
|
||||
;==============================
|
||||
; do the pan
|
||||
;==============================
|
||||
|
||||
jsr horiz_pan
|
||||
|
||||
; wait a bit
|
||||
|
||||
jsr wait_until_keypress
|
||||
|
||||
|
||||
|
||||
done_intro:
|
||||
jmp done_intro
|
||||
|
||||
|
||||
.include "wait_keypress.s"
|
||||
.include "zx02_optim.s"
|
||||
.include "hgr_table.s"
|
||||
.include "hgr_clear_screen.s"
|
||||
.include "horiz_scroll.s"
|
||||
.include "hgr_partial.s"
|
||||
; .include "../hgr_page_flip.s"
|
||||
|
||||
|
||||
intro_left_data:
|
||||
.incbin "graphics/pq2_bgl.hgr.zx02"
|
||||
intro_right_data:
|
||||
.incbin "graphics/pq2_bgr.hgr.zx02"
|
||||
|
34
graphics/hgr/horiz_scroll/scroll_tables.s
Normal file
34
graphics/hgr/horiz_scroll/scroll_tables.s
Normal file
@ -0,0 +1,34 @@
|
||||
left_lookup_main:
|
||||
.byte $00,$00,$00,$00,$01,$01,$01,$01,$02,$02,$02,$02,$03,$03,$03,$03
|
||||
.byte $04,$04,$04,$04,$05,$05,$05,$05,$06,$06,$06,$06,$07,$07,$07,$07
|
||||
.byte $08,$08,$08,$08,$09,$09,$09,$09,$0A,$0A,$0A,$0A,$0B,$0B,$0B,$0B
|
||||
.byte $0C,$0C,$0C,$0C,$0D,$0D,$0D,$0D,$0E,$0E,$0E,$0E,$0F,$0F,$0F,$0F
|
||||
.byte $10,$10,$10,$10,$11,$11,$11,$11,$12,$12,$12,$12,$13,$13,$13,$13
|
||||
.byte $14,$14,$14,$14,$15,$15,$15,$15,$16,$16,$16,$16,$17,$17,$17,$17
|
||||
.byte $18,$18,$18,$18,$19,$19,$19,$19,$1A,$1A,$1A,$1A,$1B,$1B,$1B,$1B
|
||||
.byte $1C,$1C,$1C,$1C,$1D,$1D,$1D,$1D,$1E,$1E,$1E,$1E,$1F,$1F,$1F,$1F
|
||||
.byte $80,$80,$80,$80,$81,$81,$81,$81,$82,$82,$82,$82,$83,$83,$83,$83
|
||||
.byte $84,$84,$84,$84,$85,$85,$85,$85,$86,$86,$86,$86,$87,$87,$87,$87
|
||||
.byte $88,$88,$88,$88,$89,$89,$89,$89,$8A,$8A,$8A,$8A,$8B,$8B,$8B,$8B
|
||||
.byte $8C,$8C,$8C,$8C,$8D,$8D,$8D,$8D,$8E,$8E,$8E,$8E,$8F,$8F,$8F,$8F
|
||||
.byte $90,$90,$90,$90,$91,$91,$91,$91,$92,$92,$92,$92,$93,$93,$93,$93
|
||||
.byte $94,$94,$94,$94,$95,$95,$95,$95,$96,$96,$96,$96,$97,$97,$97,$97
|
||||
.byte $98,$98,$98,$98,$99,$99,$99,$99,$9A,$9A,$9A,$9A,$9B,$9B,$9B,$9B
|
||||
.byte $9C,$9C,$9C,$9C,$9D,$9D,$9D,$9D,$9E,$9E,$9E,$9E,$9F,$9F,$9F,$9F
|
||||
left_lookup_next:
|
||||
.byte $00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60
|
||||
.byte $00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60
|
||||
.byte $00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60
|
||||
.byte $00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60
|
||||
.byte $00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60
|
||||
.byte $00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60
|
||||
.byte $00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60
|
||||
.byte $00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60
|
||||
.byte $00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60
|
||||
.byte $00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60
|
||||
.byte $00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60
|
||||
.byte $00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60
|
||||
.byte $00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60
|
||||
.byte $00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60
|
||||
.byte $00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60
|
||||
.byte $00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60,$00,$20,$40,$60
|
5
graphics/hgr/horiz_scroll/wait_keypress.s
Normal file
5
graphics/hgr/horiz_scroll/wait_keypress.s
Normal file
@ -0,0 +1,5 @@
|
||||
wait_until_keypress:
|
||||
lda KEYPRESS ; 4
|
||||
bpl wait_until_keypress ; 3
|
||||
bit KEYRESET ; clear the keyboard buffer
|
||||
rts ; 6
|
282
graphics/hgr/horiz_scroll/zp.inc
Normal file
282
graphics/hgr/horiz_scroll/zp.inc
Normal file
@ -0,0 +1,282 @@
|
||||
;==================
|
||||
;==================
|
||||
; Zero Page Usage
|
||||
;==================
|
||||
;==================
|
||||
|
||||
; ZX0 decompression addresses
|
||||
|
||||
ZX0_src = $00
|
||||
ZX0_dst = $02
|
||||
offset = $04
|
||||
bitr = $06
|
||||
pntr = $07
|
||||
WHICH_LOAD = $09
|
||||
CURRENT_DISK = $0A
|
||||
|
||||
; Zero page monitor routines addresses
|
||||
; We don't use the monitor but we use some of these anyway
|
||||
|
||||
WNDLFT = $20
|
||||
WNDWDTH = $21
|
||||
WNDTOP = $22
|
||||
WNDBTM = $23
|
||||
CH = $24
|
||||
CV = $25
|
||||
GBASL = $26
|
||||
GBASH = $27
|
||||
BASL = $28
|
||||
BASH = $29
|
||||
H2 = $2C
|
||||
V2 = $2D
|
||||
MASK = $2E
|
||||
COLOR = $30
|
||||
;INVFLG = $32
|
||||
|
||||
;==========================
|
||||
; $60-$6F unused currently
|
||||
;==========================
|
||||
|
||||
|
||||
;==========================
|
||||
; $70-$7F for PT3 Player
|
||||
;==========================
|
||||
|
||||
AY_REGISTERS = $70
|
||||
A_FINE_TONE = $70
|
||||
A_COARSE_TONE = $71
|
||||
B_FINE_TONE = $72
|
||||
B_COARSE_TONE = $73
|
||||
C_FINE_TONE = $74
|
||||
C_COARSE_TONE = $75
|
||||
NOISE = $76
|
||||
ENABLE = $77
|
||||
PT3_MIXER_VAL = $77
|
||||
A_VOLUME = $78
|
||||
B_VOLUME = $79
|
||||
C_VOLUME = $7A
|
||||
ENVELOPE_FINE = $7B
|
||||
ENVELOPE_COARSE = $7C
|
||||
ENVELOPE_SHAPE = $7D
|
||||
PATTERN_L = $7E
|
||||
PATTERN_H = $7F
|
||||
|
||||
;============================
|
||||
; $80-$8D rest of pt3_player
|
||||
;============================
|
||||
|
||||
PT3_TEMP = $80
|
||||
ORNAMENT_L = $81
|
||||
ORNAMENT_H = $82
|
||||
SAMPLE_L = $83
|
||||
SAMPLE_H = $84
|
||||
LOOP = $85
|
||||
MB_VALUE = $86
|
||||
MB_ADDR_L = $87
|
||||
MB_ADDR_H = $88
|
||||
DONE_PLAYING = $89
|
||||
DONE_SONG = $8A
|
||||
APPLEII_MODEL = $8B
|
||||
SOUND_STATUS = $8C
|
||||
SOUND_DISABLED = $80
|
||||
SOUND_IN_LC = $01 ; $01 sound effects in language card
|
||||
SOUND_MOCKINGBOARD = $02 ; mockingboard detected
|
||||
|
||||
;=============================
|
||||
; not sure why these are here
|
||||
;=============================
|
||||
|
||||
DISP_PAGE = $8D
|
||||
DRAW_PAGE = $8E
|
||||
TOTAL_RAM = $8F
|
||||
|
||||
;=============================
|
||||
; $90-$CF currently free
|
||||
;=============================
|
||||
|
||||
;=============================
|
||||
; $D0-$D9 = hgr move
|
||||
;=============================
|
||||
HGR_X1 = $D0
|
||||
HGR_X2 = $D1
|
||||
HGR_Y1 = $D2
|
||||
HGR_Y2 = $D3
|
||||
HGR_DEST= $D4
|
||||
BOARD_COUNT = $D5
|
||||
|
||||
|
||||
WHICH_SLOT = $DA ; from boot sector
|
||||
|
||||
|
||||
;==============================================
|
||||
; $E0-$EF use for common things, don't re-use
|
||||
;==============================================
|
||||
IRQ_COUNTDOWN = $E0
|
||||
SECOND_COUNTDOWN= $E1
|
||||
COUNT = $E2
|
||||
XSAVE = $E3
|
||||
TEMPY = $E4
|
||||
XPOS = $E5 ; gr_plot
|
||||
YPOS = $E6 ; gr_plot
|
||||
COLOR_MASK = $E7 ; gr_plot
|
||||
FRAME = $E8
|
||||
FRAMEL = $E8
|
||||
FRAMEH = $E9
|
||||
BTC_L = $EA ; audio
|
||||
BTC_H = $EB ; audio
|
||||
MASKL = $EC ; gr_putsprite_mask
|
||||
MASKH = $ED
|
||||
|
||||
;==============================================
|
||||
; $F0-$FB can re-use in each file
|
||||
;==============================================
|
||||
|
||||
; tunnel
|
||||
XX = $F2
|
||||
MINUSXX = $F3
|
||||
YY = $F4
|
||||
MINUSYY = $F5
|
||||
D = $F6
|
||||
R = $F7
|
||||
CX = $F8
|
||||
CY = $F9
|
||||
RR = $FA
|
||||
|
||||
; Credits
|
||||
BACKUP_OUTL = $F2
|
||||
BACKUP_OUTH = $F3
|
||||
|
||||
; Nuts/ opener
|
||||
|
||||
SPRITE_Y = $F2
|
||||
SPRITE_X = $F3
|
||||
CURRENT_ROW = $F4
|
||||
|
||||
; PLASMACUBE
|
||||
OUT1 = $F0
|
||||
OUT1H = $F1
|
||||
OUT2 = $F2
|
||||
OUT2H = $F3
|
||||
COMPT1 = $F4
|
||||
COMPT2 = $F5
|
||||
PARAM1 = $F6
|
||||
PARAM2 = $F7
|
||||
PARAM3 = $F8
|
||||
PARAM4 = $F9
|
||||
GRLINE = $FA
|
||||
GRLINEH = $FB
|
||||
|
||||
; PLASMA
|
||||
|
||||
; CUBE
|
||||
SAVEX = $F3
|
||||
SAVEY = $F4
|
||||
SUM = $F5
|
||||
|
||||
; CIRCLES/DRAW_BOXES
|
||||
COLOR2 = $F3
|
||||
X1 = $F4
|
||||
X2 = $F5
|
||||
Y1 = $F6
|
||||
Y2 = $F7
|
||||
SCENE_COUNT = $F8
|
||||
LAST_TYPE = $F9
|
||||
|
||||
; lens
|
||||
LENS_X = $F0
|
||||
LENS_Y = $F1
|
||||
XADD = $F2
|
||||
YADD = $F3
|
||||
|
||||
; rotozoom
|
||||
NUM1L = $F0
|
||||
NUM1H = $F1
|
||||
NUM2L = $F2
|
||||
NUM2H = $F3
|
||||
RESULT = $F4 ; F5,F6,F7
|
||||
SCALE_I = $F8
|
||||
SCALE_F = $F9
|
||||
ANGLE = $FA
|
||||
|
||||
; credits
|
||||
SCROLL_X = $F0
|
||||
|
||||
; polar
|
||||
SCROLL_START = $F0
|
||||
YDEST = $F1
|
||||
|
||||
; sierzoom
|
||||
;XX = $F0
|
||||
XX_TH = $F1
|
||||
XX_TL = $F2
|
||||
;YY = $F3
|
||||
YY_TH = $F4
|
||||
YY_TL = $F5
|
||||
T_L = $F6
|
||||
T_H = $F7
|
||||
SAVED = $F8
|
||||
|
||||
BAR_X1 = $F0
|
||||
BAR_X2 = $F1
|
||||
|
||||
; spheres
|
||||
BASE_SPRITEL = $F0
|
||||
BASE_SPRITEH = $F1
|
||||
CURRENT_SPRITEL = $F2
|
||||
CURRENT_SPRITEH = $F3
|
||||
XMISSION_COUNT = $F4
|
||||
REF1L = $F5
|
||||
REF1H = $F6
|
||||
REF2L = $F7
|
||||
REF2H = $F8
|
||||
REFCOUNT = $F9
|
||||
|
||||
; BIOS
|
||||
STRING_COUNT = $F0
|
||||
LEAD0 = $F1
|
||||
SCROLL_OUT = $F2
|
||||
SCROLL_IN = $F3
|
||||
MEMCOUNT = $F4
|
||||
FAKE_KEY_COUNT = $F5
|
||||
|
||||
; OPENER
|
||||
TICKER = $F1
|
||||
P2_OFFSET = $F2
|
||||
|
||||
; dots
|
||||
MAX_DOTS = $F1
|
||||
Y_OFFSET = $F2
|
||||
|
||||
;==============================================
|
||||
; $FC-$FF we use for in/out pointers
|
||||
;==============================================
|
||||
|
||||
INL = $FC
|
||||
INH = $FD
|
||||
OUTL = $FE
|
||||
OUTH = $FF
|
||||
|
||||
|
||||
; read any file slot 6 version
|
||||
; based on FASTLD6 and RTS copyright (c) Peter Ferrie 2011-2013,2018
|
||||
|
||||
; modified to assembled with ca64 -- vmw
|
||||
; added code to patch it to run from current disk slot -- vmw
|
||||
|
||||
|
||||
adrlo = $26 ; constant from boot prom
|
||||
adrhi = $27 ; constant from boot prom
|
||||
tmpsec = $3c ; constant from boot prom
|
||||
reqsec = $3d ; constant from boot prom
|
||||
sizelo = $44
|
||||
sizehi = $45
|
||||
secsize = $46
|
||||
|
||||
ldsizel = $f0
|
||||
ldsizeh = $f1
|
||||
namlo = $fb
|
||||
namhi = $fc
|
||||
step = $fd ; state for stepper motor
|
||||
tmptrk = $fe ; temporary copy of current track
|
||||
phase = $ff ; current phase for /seek
|
||||
|
159
graphics/hgr/horiz_scroll/zx02_optim.s
Normal file
159
graphics/hgr/horiz_scroll/zx02_optim.s
Normal file
@ -0,0 +1,159 @@
|
||||
; De-compressor for ZX02 files
|
||||
; ----------------------------
|
||||
;
|
||||
; Decompress ZX02 data (6502 optimized format), optimized for speed and size
|
||||
; 138 bytes code, 58.0 cycles/byte in test file.
|
||||
;
|
||||
; Compress with:
|
||||
; zx02 input.bin output.zx0
|
||||
;
|
||||
; (c) 2022 DMSC
|
||||
; Code under MIT license, see LICENSE file.
|
||||
|
||||
|
||||
;ZP=$80
|
||||
|
||||
;offset = ZP+0
|
||||
;ZX0_src = ZP+2
|
||||
;ZX0_dst = ZP+4
|
||||
;bitr = ZP+6
|
||||
;pntr = ZP+7
|
||||
|
||||
; Initial values for offset, source, destination and bitr
|
||||
;zx0_ini_block:
|
||||
; .byte $00, $00, <comp_data, >comp_data, <out_addr, >out_addr, $80
|
||||
|
||||
;--------------------------------------------------
|
||||
; Decompress ZX0 data (6502 optimized format)
|
||||
|
||||
zx02_full_decomp:
|
||||
; ; Get initialization block
|
||||
; ldy #7
|
||||
;
|
||||
;copy_init: lda zx0_ini_block-1, y
|
||||
; sta offset-1, y
|
||||
; dey
|
||||
; bne copy_init
|
||||
|
||||
|
||||
sta ZX0_dst+1 ; page to output to in A
|
||||
zx_src_l:
|
||||
ldy #$dd
|
||||
sty ZX0_src
|
||||
zx_src_h:
|
||||
ldy #$dd
|
||||
sty ZX0_src+1
|
||||
ldy #$80
|
||||
sty bitr
|
||||
ldy #0
|
||||
sty offset
|
||||
sty offset+1
|
||||
sty ZX0_dst ; always on even page
|
||||
|
||||
; Decode literal: Ccopy next N bytes from compressed file
|
||||
; Elias(length) byte[1] byte[2] ... byte[N]
|
||||
decode_literal:
|
||||
jsr get_elias
|
||||
|
||||
cop0: lda (ZX0_src), y
|
||||
inc ZX0_src
|
||||
bne plus1
|
||||
inc ZX0_src+1
|
||||
plus1: sta (ZX0_dst),y
|
||||
inc ZX0_dst
|
||||
bne plus2
|
||||
inc ZX0_dst+1
|
||||
plus2: dex
|
||||
bne cop0
|
||||
|
||||
asl bitr
|
||||
bcs dzx0s_new_offset
|
||||
|
||||
; Copy from last offset (repeat N bytes from last offset)
|
||||
; Elias(length)
|
||||
jsr get_elias
|
||||
dzx0s_copy:
|
||||
lda ZX0_dst
|
||||
sbc offset ; C=0 from get_elias
|
||||
sta pntr
|
||||
lda ZX0_dst+1
|
||||
sbc offset+1
|
||||
sta pntr+1
|
||||
|
||||
cop1:
|
||||
lda (pntr), y
|
||||
inc pntr
|
||||
bne plus3
|
||||
inc pntr+1
|
||||
plus3: sta (ZX0_dst),y
|
||||
inc ZX0_dst
|
||||
bne plus4
|
||||
inc ZX0_dst+1
|
||||
plus4: dex
|
||||
bne cop1
|
||||
|
||||
asl bitr
|
||||
bcc decode_literal
|
||||
|
||||
; Copy from new offset (repeat N bytes from new offset)
|
||||
; Elias(MSB(offset)) LSB(offset) Elias(length-1)
|
||||
dzx0s_new_offset:
|
||||
; Read elias code for high part of offset
|
||||
jsr get_elias
|
||||
beq exit ; Read a 0, signals the end
|
||||
; Decrease and divide by 2
|
||||
dex
|
||||
txa
|
||||
lsr ; @
|
||||
sta offset+1
|
||||
|
||||
; Get low part of offset, a literal 7 bits
|
||||
lda (ZX0_src), y
|
||||
inc ZX0_src
|
||||
bne plus5
|
||||
inc ZX0_src+1
|
||||
plus5:
|
||||
; Divide by 2
|
||||
ror ; @
|
||||
sta offset
|
||||
|
||||
; And get the copy length.
|
||||
; Start elias reading with the bit already in carry:
|
||||
ldx #1
|
||||
jsr elias_skip1
|
||||
|
||||
inx
|
||||
bcc dzx0s_copy
|
||||
|
||||
; Read an elias-gamma interlaced code.
|
||||
; ------------------------------------
|
||||
get_elias:
|
||||
; Initialize return value to #1
|
||||
ldx #1
|
||||
bne elias_start
|
||||
|
||||
elias_get: ; Read next data bit to result
|
||||
asl bitr
|
||||
rol ; @
|
||||
tax
|
||||
|
||||
elias_start:
|
||||
; Get one bit
|
||||
asl bitr
|
||||
bne elias_skip1
|
||||
|
||||
; Read new bit from stream
|
||||
lda (ZX0_src), y
|
||||
inc ZX0_src
|
||||
bne plus6
|
||||
inc ZX0_src+1
|
||||
plus6: ;sec ; not needed, C=1 guaranteed from last bit
|
||||
rol ;@
|
||||
sta bitr
|
||||
|
||||
elias_skip1:
|
||||
txa
|
||||
bcs elias_get
|
||||
; Got ending bit, stop reading
|
||||
exit:
|
||||
rts
|
Loading…
Reference in New Issue
Block a user