hgr: parallax
This commit is contained in:
parent
4a1a6e6126
commit
c387dfd393
|
@ -0,0 +1,95 @@
|
|||
include ../../../Makefile.inc
|
||||
|
||||
LINKER_DIR = ../../../linker_scripts/
|
||||
|
||||
EMPTY_DISK = ../../../empty_disk/empty.dsk
|
||||
DOS33 = ../../../utils/dos33fs-utils/dos33
|
||||
TOKENIZE = ../../../utils/asoft_basic-utils/tokenize_asoft
|
||||
|
||||
all: paralax.dsk
|
||||
|
||||
paralax.dsk: HELLO BOXES BOXES_BOT LARGE LARGE_BOT PAR PAR_BOT WEIRD
|
||||
cp $(EMPTY_DISK) paralax.dsk
|
||||
$(DOS33) -y paralax.dsk SAVE A HELLO
|
||||
$(DOS33) -y paralax.dsk BSAVE -a 0xc00 BOXES
|
||||
$(DOS33) -y paralax.dsk BSAVE -a 0x3B7 BOXES_BOT
|
||||
$(DOS33) -y paralax.dsk BSAVE -a 0xc00 LARGE
|
||||
$(DOS33) -y paralax.dsk BSAVE -a 0x386 LARGE_BOT
|
||||
$(DOS33) -y paralax.dsk BSAVE -a 0xc00 PAR
|
||||
$(DOS33) -y paralax.dsk BSAVE -a 0x37B PAR_BOT
|
||||
$(DOS33) -y paralax.dsk BSAVE -a 0xc00 WEIRD
|
||||
|
||||
###
|
||||
|
||||
BOXES: boxes.o
|
||||
ld65 -o BOXES boxes.o -C $(LINKER_DIR)/apple2_c00.inc
|
||||
|
||||
boxes.o: boxes.s
|
||||
ca65 -o boxes.o boxes.s -l boxes.lst
|
||||
|
||||
###
|
||||
|
||||
LARGE: large.o
|
||||
ld65 -o LARGE large.o -C $(LINKER_DIR)/apple2_c00.inc
|
||||
|
||||
large.o: large.s
|
||||
ca65 -o large.o large.s -l large.lst
|
||||
|
||||
###
|
||||
|
||||
PAR: par.o
|
||||
ld65 -o PAR par.o -C $(LINKER_DIR)/apple2_c00.inc
|
||||
|
||||
par.o: par.s
|
||||
ca65 -o par.o par.s -l par.lst
|
||||
|
||||
|
||||
###
|
||||
|
||||
WEIRD: weird.o
|
||||
ld65 -o WEIRD weird.o -C $(LINKER_DIR)/apple2_c00.inc
|
||||
|
||||
weird.o: weird.s
|
||||
ca65 -o weird.o weird.s -l weird.lst
|
||||
|
||||
|
||||
|
||||
|
||||
###
|
||||
|
||||
BOXES_BOT: boxes_bot.o
|
||||
ld65 -o BOXES_BOT boxes_bot.o -C $(LINKER_DIR)/apple2_3b7.inc
|
||||
|
||||
boxes_bot.o: boxes_bot.s
|
||||
ca65 -o boxes_bot.o boxes_bot.s -l boxes_bot.lst
|
||||
|
||||
|
||||
###
|
||||
|
||||
LARGE_BOT: large_bot.o
|
||||
ld65 -o LARGE_BOT large_bot.o -C $(LINKER_DIR)/apple2_386.inc
|
||||
|
||||
large_bot.o: large_bot.s
|
||||
ca65 -o large_bot.o large_bot.s -l large_bot.lst
|
||||
|
||||
###
|
||||
|
||||
PAR_BOT: par_bot.o
|
||||
ld65 -o PAR_BOT par_bot.o -C $(LINKER_DIR)/apple2_37b.inc
|
||||
|
||||
par_bot.o: par_bot.s
|
||||
ca65 -o par_bot.o par_bot.s -l par_bot.lst
|
||||
|
||||
|
||||
###
|
||||
|
||||
|
||||
HELLO: hello.bas
|
||||
$(TOKENIZE) < hello.bas > HELLO
|
||||
|
||||
####
|
||||
|
||||
|
||||
clean:
|
||||
rm -f *~ *.o *.lst HELLO BOXES BOXES_BOT LARGE LARGE_BOT PAR PAR_BOT
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
; parallax hgr
|
||||
|
||||
; by deater (Vince Weaver) <vince@deater.net>
|
||||
|
||||
|
||||
; Zero Page
|
||||
GBASL = $26
|
||||
GBASH = $27
|
||||
H2 = $2C
|
||||
COLOR = $30
|
||||
|
||||
HGR_X = $E0
|
||||
HGR_Y = $E2
|
||||
HGR_COLOR = $E4
|
||||
HGR_HORIZ = $E5
|
||||
HGR_PAGE = $E6
|
||||
|
||||
X2 = $FB
|
||||
FRAME = $FC
|
||||
|
||||
|
||||
; Soft Switches
|
||||
KEYPRESS= $C000
|
||||
KEYRESET= $C010
|
||||
SET_GR = $C050 ; Enable graphics
|
||||
FULLGR = $C052 ; Full screen, no text
|
||||
PAGE1 = $C054 ; Page1
|
||||
PAGE2 = $C055 ; Page2
|
||||
LORES = $C056 ; Enable LORES graphics
|
||||
|
||||
; ROM routines
|
||||
|
||||
HGR = $F3E2
|
||||
HGR2 = $F3D8
|
||||
HCLR = $F3F2
|
||||
HPLOT0 = $F457 ;; plot at (Y,X), (A)
|
||||
WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us
|
||||
HPOSN = $F411 ; (Y,X),(A) (values stores in HGRX,XH,Y)
|
||||
|
||||
|
||||
|
||||
boxes:
|
||||
|
||||
;===================
|
||||
; init screen
|
||||
|
||||
jsr HGR2
|
||||
|
||||
boxes_forever:
|
||||
|
||||
inc FRAME
|
||||
|
||||
; flip page
|
||||
|
||||
lda HGR_PAGE ; $40 or $20
|
||||
pha
|
||||
asl
|
||||
asl
|
||||
rol
|
||||
tay
|
||||
lda PAGE1,Y
|
||||
pla
|
||||
|
||||
eor #$60 ; flip draw_page
|
||||
sta HGR_PAGE
|
||||
|
||||
ldx #191 ; init Y
|
||||
|
||||
yloop:
|
||||
txa
|
||||
|
||||
pha
|
||||
jsr HPOSN
|
||||
pla
|
||||
|
||||
tax
|
||||
|
||||
ldy #39 ; 2
|
||||
xloop:
|
||||
|
||||
; calculate color
|
||||
|
||||
; color = (XX-FRAME)^(YY)
|
||||
lda #$00
|
||||
sta COLOR
|
||||
|
||||
sec ; subtract frame from Y
|
||||
tya
|
||||
sbc FRAME
|
||||
sta X2
|
||||
|
||||
txa
|
||||
lsr
|
||||
lsr
|
||||
|
||||
eor X2
|
||||
|
||||
and #$04
|
||||
beq no_color
|
||||
lda #$ff
|
||||
sta COLOR
|
||||
|
||||
no_color:
|
||||
lda COLOR
|
||||
sta (GBASL),Y
|
||||
|
||||
dey ; 1
|
||||
bpl xloop ; 2
|
||||
|
||||
dex ; 1
|
||||
cpx #$ff
|
||||
|
||||
bne yloop ; 2
|
||||
|
||||
beq boxes_forever ; 2
|
||||
|
||||
|
||||
; for bot
|
||||
; jmp boxes
|
|
@ -0,0 +1,209 @@
|
|||
; Parallax HGR
|
||||
|
||||
; by deater (Vince Weaver) <vince@deater.net>
|
||||
|
||||
|
||||
; Zero Page
|
||||
GBASL = $26
|
||||
GBASH = $27
|
||||
H2 = $2C
|
||||
COLOR = $30
|
||||
|
||||
HGR_X = $E0
|
||||
HGR_Y = $E2
|
||||
HGR_COLOR = $E4
|
||||
HGR_HORIZ = $E5
|
||||
HGR_PAGE = $E6
|
||||
|
||||
FRAME = $F0
|
||||
FRAME2 = $F1
|
||||
FRAME4 = $F2
|
||||
|
||||
X2 = $FB
|
||||
COLORS = $FC
|
||||
|
||||
; Soft Switches
|
||||
PAGE1 = $C054 ; Page1
|
||||
PAGE2 = $C055 ; Page2
|
||||
|
||||
|
||||
; ROM routines
|
||||
|
||||
HGR = $F3E2
|
||||
HGR2 = $F3D8
|
||||
HCLR = $F3F2
|
||||
HPLOT0 = $F457 ;; plot at (Y,X), (A)
|
||||
WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us
|
||||
HPOSN = $F411 ; (Y,X),(A) (values stores in HGRX,XH,Y)
|
||||
|
||||
|
||||
hgr_lookup_h = $1000
|
||||
hgr_lookup_l = $1100
|
||||
|
||||
parallax:
|
||||
|
||||
;===================
|
||||
; init screen
|
||||
jsr HGR2
|
||||
|
||||
;===================
|
||||
; int tables
|
||||
|
||||
ldx #191
|
||||
init_loop:
|
||||
txa
|
||||
pha
|
||||
jsr HPOSN
|
||||
pla
|
||||
tax
|
||||
lda GBASL
|
||||
sta hgr_lookup_l,X
|
||||
lda GBASH
|
||||
sec
|
||||
sbc #$40
|
||||
sta hgr_lookup_h,X
|
||||
dex
|
||||
cpx #$ff
|
||||
bne init_loop
|
||||
|
||||
|
||||
parallax_forever:
|
||||
|
||||
inc FRAME ; 2
|
||||
lda FRAME
|
||||
lsr
|
||||
sta FRAME2
|
||||
lsr
|
||||
sta FRAME4
|
||||
|
||||
;========================
|
||||
; flip page
|
||||
|
||||
lda HGR_PAGE ; $40 or $20
|
||||
pha
|
||||
asl
|
||||
asl
|
||||
rol
|
||||
tay
|
||||
lda PAGE1,Y
|
||||
pla
|
||||
|
||||
eor #$60 ; flip draw_page
|
||||
sta HGR_PAGE
|
||||
|
||||
|
||||
ldx #191 ; init Y
|
||||
|
||||
|
||||
yloop:
|
||||
|
||||
;==============
|
||||
; point GBASL/GBSAH to current line
|
||||
|
||||
lda hgr_lookup_l,X
|
||||
sta out_smc+1
|
||||
lda hgr_lookup_h,X
|
||||
clc
|
||||
adc HGR_PAGE
|
||||
sta out_smc+2
|
||||
|
||||
;==============
|
||||
; current column (work backwards)
|
||||
|
||||
ldy #39 ; 2
|
||||
xloop:
|
||||
|
||||
;==============
|
||||
; precalc X2
|
||||
|
||||
tya
|
||||
asl
|
||||
asl
|
||||
sta X2
|
||||
|
||||
; calculate colors
|
||||
; color = (XX-FRAME)^(YY)
|
||||
|
||||
|
||||
;===========================
|
||||
; LARGE
|
||||
|
||||
txa
|
||||
|
||||
sec ; subtract frame from Y
|
||||
sbc FRAME
|
||||
|
||||
eor X2
|
||||
and #$40
|
||||
|
||||
beq skip_color_large
|
||||
lda #$ff
|
||||
jmp draw_color
|
||||
skip_color_large:
|
||||
|
||||
;===========================
|
||||
; MEDIUM
|
||||
|
||||
txa
|
||||
|
||||
sec ; subtract frame from Y
|
||||
sbc FRAME2
|
||||
|
||||
eor X2
|
||||
and #$20
|
||||
|
||||
beq skip_color_medium
|
||||
lda #$55
|
||||
jmp draw_color
|
||||
skip_color_medium:
|
||||
|
||||
|
||||
;===========================
|
||||
; SMALL
|
||||
|
||||
txa
|
||||
|
||||
sec ; subtract frame from YY
|
||||
sbc FRAME4
|
||||
|
||||
eor X2
|
||||
and #$10
|
||||
|
||||
beq skip_color_small
|
||||
lda #$aa
|
||||
|
||||
jmp draw_color
|
||||
skip_color_small:
|
||||
|
||||
lda #$00
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;========================
|
||||
; actually draw color
|
||||
|
||||
draw_color:
|
||||
out_smc:
|
||||
sta $2000,Y
|
||||
|
||||
|
||||
dey ; 1
|
||||
bpl xloop ; 2
|
||||
|
||||
dex ; 1
|
||||
|
||||
cpx #$FF
|
||||
|
||||
bne yloop ; 2
|
||||
|
||||
beq parallax_forever ; 2
|
||||
|
||||
|
||||
; for bot
|
||||
; $3F5 - 127 + 3 = $379
|
||||
|
||||
jmp parallax
|
|
@ -0,0 +1,208 @@
|
|||
; Parallax HGR
|
||||
|
||||
; by deater (Vince Weaver) <vince@deater.net>
|
||||
|
||||
|
||||
; Zero Page
|
||||
GBASL = $26
|
||||
GBASH = $27
|
||||
H2 = $2C
|
||||
COLOR = $30
|
||||
|
||||
HGR_X = $E0
|
||||
HGR_Y = $E2
|
||||
HGR_COLOR = $E4
|
||||
HGR_HORIZ = $E5
|
||||
HGR_PAGE = $E6
|
||||
|
||||
FRAME = $F0
|
||||
FRAME2 = $F1
|
||||
FRAME4 = $F2
|
||||
|
||||
X2 = $FB
|
||||
COLORS = $FC
|
||||
|
||||
; Soft Switches
|
||||
PAGE1 = $C054 ; Page1
|
||||
PAGE2 = $C055 ; Page2
|
||||
|
||||
|
||||
; ROM routines
|
||||
|
||||
HGR = $F3E2
|
||||
HGR2 = $F3D8
|
||||
HCLR = $F3F2
|
||||
HPLOT0 = $F457 ;; plot at (Y,X), (A)
|
||||
WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us
|
||||
HPOSN = $F411 ; (Y,X),(A) (values stores in HGRX,XH,Y)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
parallax:
|
||||
|
||||
;===================
|
||||
; init screen
|
||||
jsr HGR2
|
||||
|
||||
parallax_forever:
|
||||
|
||||
inc FRAME ; 2
|
||||
lda FRAME
|
||||
lsr
|
||||
sta FRAME2
|
||||
lsr
|
||||
sta FRAME4
|
||||
|
||||
;========================
|
||||
; update color
|
||||
|
||||
lda FRAME
|
||||
|
||||
; flip page
|
||||
|
||||
lda HGR_PAGE ; $40 or $20
|
||||
pha
|
||||
asl
|
||||
asl
|
||||
rol
|
||||
tay
|
||||
lda PAGE1,Y
|
||||
pla
|
||||
|
||||
eor #$60 ; flip draw_page
|
||||
sta HGR_PAGE
|
||||
|
||||
|
||||
ldx #191 ; init Y
|
||||
|
||||
|
||||
yloop:
|
||||
|
||||
;==============
|
||||
; point GBASL/GBSAH to current line
|
||||
|
||||
txa
|
||||
|
||||
pha
|
||||
jsr HPOSN
|
||||
pla
|
||||
|
||||
tax
|
||||
|
||||
;==============
|
||||
; current column (work backwards)
|
||||
|
||||
ldy #39 ; 2
|
||||
xloop:
|
||||
|
||||
lda #0
|
||||
sta COLORS
|
||||
|
||||
; calculate colors
|
||||
; color = (XX-FRAME)^(YY)
|
||||
|
||||
|
||||
;===========================
|
||||
; SMALL
|
||||
|
||||
sec ; subtract frame from Y
|
||||
tya
|
||||
|
||||
sbc FRAME4
|
||||
|
||||
sta X2
|
||||
|
||||
txa
|
||||
|
||||
eor X2
|
||||
and #$2
|
||||
|
||||
beq skip_color_small
|
||||
lda #$4c
|
||||
; lda #$1b
|
||||
sta COLORS
|
||||
skip_color_small:
|
||||
|
||||
|
||||
;===========================
|
||||
; MEDIUM
|
||||
|
||||
sec ; subtract frame from Y
|
||||
tya
|
||||
|
||||
sbc FRAME2
|
||||
|
||||
sta X2
|
||||
|
||||
txa
|
||||
clc
|
||||
adc #1
|
||||
|
||||
eor X2
|
||||
and #$4
|
||||
|
||||
beq skip_color_medium
|
||||
lda #$26
|
||||
sta COLORS
|
||||
skip_color_medium:
|
||||
|
||||
|
||||
|
||||
;===========================
|
||||
; LARGE
|
||||
|
||||
sec ; subtract frame from Y
|
||||
tya
|
||||
|
||||
sbc FRAME
|
||||
|
||||
sta X2
|
||||
|
||||
txa
|
||||
clc
|
||||
adc #2
|
||||
|
||||
eor X2
|
||||
and #$8
|
||||
|
||||
beq skip_color_large
|
||||
lda #$1B
|
||||
; lda #$4c
|
||||
sta COLORS
|
||||
skip_color_large:
|
||||
|
||||
;========================
|
||||
; actually draw color
|
||||
|
||||
|
||||
lda COLORS
|
||||
sta (GBASL),Y
|
||||
|
||||
|
||||
dey ; 1
|
||||
bpl xloop ; 2
|
||||
|
||||
dex ; 1
|
||||
|
||||
cpx #$FF
|
||||
|
||||
bne yloop ; 2
|
||||
|
||||
beq parallax_forever ; 2
|
||||
|
||||
; 00 = right
|
||||
; 01 = up
|
||||
; 10 = left
|
||||
; 11 = down
|
||||
; adc = $65
|
||||
; sbc = $E5
|
||||
|
||||
|
||||
|
||||
|
||||
; for bot
|
||||
; $3F5 - 127 + 3 = $379
|
||||
|
||||
jmp parallax
|
Loading…
Reference in New Issue