second: add ocean

This commit is contained in:
Vince Weaver 2023-10-17 01:19:06 -04:00
parent af221b3aac
commit e2dc374012
22 changed files with 1345 additions and 35 deletions

View File

@ -15,6 +15,8 @@ all: second.dsk
second.dsk: QBOOT QLOAD SECOND MUSIC START \
./part01_intropan/INTRO \
./part05_dot_tunnel/TUNNEL \
./part16_ocean/OCEAN \
./part18_3d/THREED
cp $(EMPTY_DISK) second.dsk
$(DOS33_RAW) second.dsk 0 0 QBOOT 0 1
@ -22,10 +24,11 @@ second.dsk: QBOOT QLOAD SECOND MUSIC START \
$(DOS33_RAW) second.dsk 0 4 QBOOT 2 1
$(DOS33_RAW) second.dsk 1 0 QLOAD 0 0
$(DOS33_RAW) second.dsk 3 0 MUSIC 0 0
# $(DOS33_RAW) second.dsk 5 0 SECOND 0 0
$(DOS33_RAW) second.dsk 5 0 START 0 0
$(DOS33_RAW) second.dsk 8 0 ./part01_intropan/INTRO 0 0
$(DOS33_RAW) second.dsk 11 0 ./part18_3d/THREED 0 0
$(DOS33_RAW) second.dsk 11 0 ./part05_dot_tunnel/TUNNEL 0 0
$(DOS33_RAW) second.dsk 13 0 ./part16_ocean/OCEAN 0 0
$(DOS33_RAW) second.dsk 20 0 ./part18_3d/THREED 0 0
####

View File

@ -1,3 +1,51 @@
;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
@ -8,7 +56,7 @@
; vmw note: version I was using based on applesoft HPOSN was ~64 bytes
; this one is 37 bytes
build_tables:
build_hposn_tables:
ldx #0
btmi:
txa

View File

@ -7,18 +7,33 @@
.include "../hardware.inc"
.include "../qload.inc"
hposn_low = $1713 ; 0xC0 bytes (lifetime, used by DrawLargeCharacter)
hposn_high = $1800 ; 0xC0 bytes (lifetime, used by DrawLargeCharacter)
div7_table = $b800
mod7_table = $b900
hposn_high = $ba00
hposn_low = $bb00
.if 0
R = $FC
RR = $F5
D = $FB
CX = $FD
CY = $FE
COUNT = $F6
MINUSXX = $F8
MINUSYY = $FA
.endif
tunnel:
intro_start:
;=====================
; initializations
;=====================
;===================
; Load graphics
;===================
load_loop:
setup_graphics:
sei
bit SET_GR
bit HIRES
@ -28,15 +43,248 @@ load_loop:
lda #0
jsr hgr_page1_clearscreen
jsr build_tables
jsr hgr_make_tables
; from R=12 to R=256 or so
tunnel_again:
lda #0
sta RR
draw_next:
ldx RR
lda star_z,X
tax
lda radii,X
sta R
lda #128
sta CX
lda #96
sta CY
;===============================
; draw circle
;===============================
; draw circle at (CX,CY) of radius R
; signed 8-bit math so problems if R > 64?
; XX=0 YY=R
; D=3-2*R
; GOTO6
lda #0
sta XX
lda R
sta YY
lda #3
sec
sbc R
sbc R
sta D
jmp do_plots
circle_loop:
; X=X+1
inc XX
; IF D>0 THEN Y=Y-1:D=D+4*(X-Y)+10
lda D
bmi else
dec YY
lda XX
sec
sbc YY
asl
asl
clc
adc D
adc #10
jmp store_D
else:
; ELSE D=D+4*X+6
lda XX
asl
asl
clc
adc D
adc #6
store_D:
sta D
do_plots:
lda XX
and #$3
bne done2
; setup constants
lda XX
eor #$FF
sta MINUSXX
inc MINUSXX
lda YY
eor #$FF
sta MINUSYY
inc MINUSYY
; HPLOT CX+X,CY+Y
; HPLOT CX-X,CY+Y
; HPLOT CX+X,CY-Y
; HPLOT CX-X,CY-Y
; HPLOT CX+Y,CY+X
; HPLOT CX-Y,CY+X
; HPLOT CX+Y,CY-X
; HPLOT CX-Y,CY-X
; calc X co-ord
lda #7
sta COUNT
pos_loop:
lda COUNT
and #$4
lsr
tay
lda COUNT
lsr
bcc xnoc
iny
xnoc:
lda CX
clc
adc XX,Y
tax
; calc y co-ord
lda COUNT
lsr
eor #$2
tay
lda CY
clc
adc XX,Y ; A has Y-coord
ldy #0
; want X/7 into X
; want A looked up into OUTL
jsr hplot ; plot at (Y,X), (A)
dec COUNT
bpl pos_loop
done2:
; IFY>=XTHEN4
lda YY
cmp XX
bcs circle_loop
done:
lda RR
clc
adc #1
sta RR
cmp #19
beq done_frame
; GOTO1
jmp draw_next
done_frame:
lda #0
jsr hgr_page1_clearscreen
ldx #19
move_circles:
dec star_z,X
dex
bpl move_circles
jmp tunnel_again
radii:
.byte <4000, <3200, <1600, <1066, <800, <640, <533, <457
.byte <400, <355, <320, <290, <266, 246, 228, 213
.byte 200, 188, 177, 168, 160, 152, 145, 139
.byte 133, 128, 123, 118, 114, 110, 106, 103
.byte 100, 96, 94, 91, 88, 86, 84, 82
.byte 80, 78, 76, 74, 72, 71, 69, 68
.byte 66, 65, 64, 62, 61, 60, 59, 58
.byte 57, 56, 55, 54, 53, 52, 51, 50
.byte 50, 49, 48, 47, 47, 46, 45, 45
.byte 44, 43, 43, 42, 42, 41, 41, 40
.byte 40, 39, 39, 38, 38, 37, 37, 36
.byte 36, 35, 35, 35, 34, 34, 34, 33
.byte 33, 32, 32, 32, 32, 31, 31, 31
.byte 30, 30, 30, 29, 29, 29, 29, 28
.byte 28, 28, 28, 27, 27, 27, 27, 26
.byte 26, 26, 26, 26, 25, 25, 25, 25
.byte 25, 24, 24, 24, 24, 24, 23, 23
.byte 23, 23, 23, 23, 22, 22, 22, 22
.byte 22, 22, 21, 21, 21, 21, 21, 21
.byte 21, 20, 20, 20, 20, 20, 20, 20
.byte 20, 19, 19, 19, 19, 19, 19, 19
.byte 19, 18, 18, 18, 18, 18, 18, 18
.byte 18, 18, 17, 17, 17, 17, 17, 17
.byte 17, 17, 17, 17, 17, 16, 16, 16
.byte 16, 16, 16, 16, 16, 16, 16, 16
.byte 16, 15, 15, 15, 15, 15, 15, 15
.byte 15, 15, 15, 15, 15, 15, 14, 14
.byte 14, 14, 14, 14, 14, 14, 14, 14
.byte 14, 14, 14, 14, 14, 13, 13, 13
.byte 13, 13, 13, 13, 13, 13, 13, 13
.byte 13, 13, 13, 13, 13, 13, 13, 12
.byte 12, 12, 12, 12, 12, 12, 12, 12
; num-stars = 20
star_z:
.byte 15,26,38,50,63,75,78,100,112,125,137
.byte 150,162,175,187,200,212,224,237
blah:
jmp blah
.align $100
.include "../wait_keypress.s"
.include "../hgr_table.s"
.include "../hgr_clear_screen.s"
; A is Ycoord value
; X is Xcoord value
hplot:
tay
lda hposn_low,Y
sta OUTL
lda hposn_high,Y
sta OUTH
ldy div7_table,X
lda mod7_table,X
sta (OUTL),Y
rts

View File

@ -0,0 +1,32 @@
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: OCEAN
####
OCEAN: ocean.o
ld65 -o OCEAN ocean.o -C $(LINKER_SCRIPTS)/apple2_6000.inc
ocean.o: ocean.s ../zx02_optim.s \
graphics/frame00000024.hgr.zx02 \
graphics/frame00000025.hgr.zx02 \
graphics/frame00000026.hgr.zx02 \
graphics/frame00000027.hgr.zx02 \
graphics/frame00000028.hgr.zx02 \
graphics/frame00000029.hgr.zx02 \
graphics/frame00000030.hgr.zx02 \
graphics/frame00000031.hgr.zx02 \
../zp.inc ../hardware.inc ../qload.inc
ca65 -o ocean.o ocean.s -l ocean.lst
###
clean:
rm -f *~ *.o *.lst OCEAN

View File

@ -0,0 +1,81 @@
include ../../../../Makefile.inc
ZX02 = ~/research/6502_compression/zx02.git/build/zx02
PNG_TO_HGR = ../../../../utils/hgr-utils/png2hgr
PNG2GR = ../../../../utils/gr-utils/png2gr
all: frame00000024.hgr.zx02 frame00000025.hgr.zx02 \
frame00000026.hgr.zx02 frame00000027.hgr.zx02 \
frame00000028.hgr.zx02 frame00000029.hgr.zx02 \
frame00000030.hgr.zx02 frame00000031.hgr.zx02
####
frame00000024.hgr.zx02: frame00000024.hgr
$(ZX02) frame00000024.hgr frame00000024.hgr.zx02
frame00000024.hgr: frame00000024.png
$(PNG_TO_HGR) frame00000024.png > frame00000024.hgr
####
frame00000025.hgr.zx02: frame00000025.hgr
$(ZX02) frame00000025.hgr frame00000025.hgr.zx02
frame00000025.hgr: frame00000025.png
$(PNG_TO_HGR) frame00000025.png > frame00000025.hgr
####
frame00000026.hgr.zx02: frame00000026.hgr
$(ZX02) frame00000026.hgr frame00000026.hgr.zx02
frame00000026.hgr: frame00000026.png
$(PNG_TO_HGR) frame00000026.png > frame00000026.hgr
####
frame00000027.hgr.zx02: frame00000027.hgr
$(ZX02) frame00000027.hgr frame00000027.hgr.zx02
frame00000027.hgr: frame00000027.png
$(PNG_TO_HGR) frame00000027.png > frame00000027.hgr
####
frame00000028.hgr.zx02: frame00000028.hgr
$(ZX02) frame00000028.hgr frame00000028.hgr.zx02
frame00000028.hgr: frame00000028.png
$(PNG_TO_HGR) frame00000028.png > frame00000028.hgr
####
frame00000029.hgr.zx02: frame00000029.hgr
$(ZX02) frame00000029.hgr frame00000029.hgr.zx02
frame00000029.hgr: frame00000029.png
$(PNG_TO_HGR) frame00000029.png > frame00000029.hgr
####
frame00000030.hgr.zx02: frame00000030.hgr
$(ZX02) frame00000030.hgr frame00000030.hgr.zx02
frame00000030.hgr: frame00000030.png
$(PNG_TO_HGR) frame00000030.png > frame00000030.hgr
####
frame00000031.hgr.zx02: frame00000031.hgr
$(ZX02) frame00000031.hgr frame00000031.hgr.zx02
frame00000031.hgr: frame00000031.png
$(PNG_TO_HGR) frame00000031.png > frame00000031.hgr
####
clean:
rm -f *~

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

@ -0,0 +1,108 @@
; Ocean
;
; by deater (Vince Weaver) <vince@deater.net>
.include "../zp.inc"
.include "../hardware.inc"
.include "../qload.inc"
ocean_start:
;=====================
; initializations
;=====================
;===================
; Load graphics
;===================
load_loop:
bit SET_GR
bit HIRES
bit FULLGR
bit PAGE1
lda #0
sta COUNT
ocean_loop:
; logo 1
ldx COUNT
lda frame_data_l,X
sta zx_src_l+1
lda frame_data_h,X
sta zx_src_h+1
lda #$40
jsr zx02_full_decomp
bit PAGE2
inc COUNT
; right logo
ldx COUNT
lda frame_data_l,X
sta zx_src_l+1
lda frame_data_h,X
sta zx_src_h+1
lda #$20
jsr zx02_full_decomp
bit PAGE1
inc COUNT
lda COUNT
cmp #14
bne no_count_oflo
lda #0
sta COUNT
no_count_oflo:
jmp ocean_loop
.include "../wait_keypress.s"
.include "../zx02_optim.s"
frame_data_l:
.byte <frame24_data,<frame25_data,<frame26_data,<frame27_data
.byte <frame28_data,<frame29_data,<frame30_data,<frame31_data
.byte <frame30_data,<frame29_data,<frame28_data
.byte <frame27_data,<frame26_data,<frame25_data;,<frame28_data
frame_data_h:
.byte >frame24_data,>frame25_data,>frame26_data,>frame27_data
.byte >frame28_data,>frame29_data,>frame30_data,>frame31_data
.byte >frame30_data,>frame29_data,>frame28_data
.byte >frame27_data,>frame26_data,>frame25_data;,>frame24_data
frame24_data:
.incbin "graphics/frame00000024.hgr.zx02"
frame25_data:
.incbin "graphics/frame00000025.hgr.zx02"
frame26_data:
.incbin "graphics/frame00000026.hgr.zx02"
frame27_data:
.incbin "graphics/frame00000027.hgr.zx02"
frame28_data:
.incbin "graphics/frame00000028.hgr.zx02"
frame29_data:
.incbin "graphics/frame00000029.hgr.zx02"
frame30_data:
.incbin "graphics/frame00000030.hgr.zx02"
frame31_data:
.incbin "graphics/frame00000031.hgr.zx02"

View File

@ -130,7 +130,17 @@ frame15: ; handmade / auto
.include "auto/frame143.inc" ;
.include "auto/frame144.inc" ;
.include "auto/frame145.inc" ;
.include "auto/frame146.inc" ;
.include "auto/frame147.inc" ;
.include "auto/frame148.inc" ;
.include "auto/frame149.inc" ;
.include "auto/frame150.inc" ;
.include "auto/frame151.inc" ;
.include "auto/frame152.inc" ;
.include "auto/frame153.inc" ;
.include "auto/frame154.inc" ;
.include "auto/frame155.inc" ;
num_scenes=(145-15)+1
num_scenes=(155-15)+1

View File

@ -160,19 +160,24 @@ error_string:
.endif
which_disk_array:
.byte 1,1,1,1 ; SECOND, MUSIC, INTRO, 3D
.byte 1,1,1,1 ; SECOND, MUSIC, INTRO, TUNNEL
.byte 1,1 ; 3D, OCEAN
load_address_array:
.byte $20,$D0,$60,$40 ; SECOND, MUSIC, INTRO, 3D
.byte $20,$D0,$60,$60 ; SECOND, MUSIC, INTRO, TUNNEL
.byte $40,$60 ; 3D, OCEAN
track_array:
.byte 5, 3, 8,11 ; SECOND, MUSIC, ?, ?
.byte 5, 3, 8, 11 ; SECOND, MUSIC, INTRO, TUNNEL
.byte 20,13 ; 3D, OCEAN
sector_array:
.byte 0, 0, 0, 0 ; SECOND, MUSIC, ?, ?
.byte 0, 0, 0, 0 ; SECOND, MUSIC, INTRO, TUNNEL
.byte 0, 0 ; 3D, OCEAN
length_array:
.byte 16, 32, 84, 128 ; SECOND, MUSIC, ?, ?
.byte 16, 32, 84, 16 ; SECOND, MUSIC, INTRO, TUNNEL
.byte 128,64 ; 3D, OCEAN
.include "lc_detect.s"
.include "wait.s"

View File

@ -238,8 +238,11 @@ load_loop:
; start music
;=======================
lda #3
; lda #2
lda #5 ; OCEAN
; lda #4 ; THREED
; lda #3 ; TUNNEL
; lda #2 ; INTRO
sta WHICH_LOAD
@ -248,7 +251,9 @@ load_loop:
cli
jmp $4000
; jmp $4000
jmp $6000
forever:
jmp forever

View File

@ -139,8 +139,7 @@ ANGLE = $9A
;COLOR1 = $E0
;COLOR2 = $E1
;MATCH = $E2
XX = $E3
YY = $E4
HGR_COLOR = $E4
;SHIPY = $E4
;YADD = $E5
@ -165,25 +164,45 @@ OFFSET = $EF
IRQ_COUNTDOWN = $F0
LASTKEY = $F1
PADDLE_STATUS = $F2
;LASTKEY = $F1
;PADDLE_STATUS = $F2
SPRITETEMP = $F2
XPOS = $F3
YPOS = $F4
XSAVE = $F6
SCROLL_IN = $F7
SCROLL_OUT = $F8
STRING_COUNT = $F9
TEMP = $FA
MEMCOUNT = $FA
TEMPY = $FB
LEAD0 = $FB
INL = $FC
INH = $FD
OUTL = $FE
OUTH = $FF
XSAVE = $F6
SCROLL_IN=$F7
SCROLL_OUT=$F8
STRING_COUNT = $F9
MEMCOUNT= $FA
LEAD0 = $FB
; tunnel
RR = $F0
COUNT = $F1
XX = $F2
MINUSXX = $F3
YY = $F4
MINUSYY = $F5
D = $F6
R = $F7
CX = $F8
CY = $F9

View File

@ -9,7 +9,8 @@ all: circles.dsk
circles.dsk: HELLO CIRCLES CIRCLES_FILL ARCS WEB PAC ORB ORB_TINY \
BRES.BAS BRESBOT.BAS BRESCOOL.BAS HORROR \
MID.BAS MIDBOT.BAS MIDCOOL.BAS BRESTEST.BAS ARCS_BOT
MID.BAS MIDBOT.BAS MIDCOOL.BAS BRESTEST.BAS ARCS_BOT \
TUNNEL WEB2
cp $(EMPTY_DISK)/empty.dsk circles.dsk
$(DOS33) -y circles.dsk SAVE A HELLO
$(DOS33) -y circles.dsk SAVE A BRES.BAS
@ -28,6 +29,8 @@ circles.dsk: HELLO CIRCLES CIRCLES_FILL ARCS WEB PAC ORB ORB_TINY \
$(DOS33) -y circles.dsk BSAVE -a 0x03f5 ORB_TINY
$(DOS33) -y circles.dsk BSAVE -a 0x03f5 HORROR
$(DOS33) -y circles.dsk BSAVE -a 0x9600 ARCS_BOT
$(DOS33) -y circles.dsk BSAVE -a 0x0C00 TUNNEL
$(DOS33) -y circles.dsk BSAVE -a 0x0C00 WEB2
###
@ -81,6 +84,23 @@ circles.o: circles.s
###
TUNNEL: tunnel.o
ld65 -o TUNNEL tunnel.o -C $(LINKER_SCRIPTS)/apple2_c00.inc
tunnel.o: tunnel.s
ca65 -o tunnel.o tunnel.s -l tunnel.lst
###
WEB2: web2.o
ld65 -o WEB2 web2.o -C $(LINKER_SCRIPTS)/apple2_c00.inc
web2.o: web2.s
ca65 -o web2.o web2.s -l web2.lst
###
CIRCLES_FILL: circles_fill.o
ld65 -o CIRCLES_FILL circles_fill.o -C $(LINKER_SCRIPTS)/apple2_c00.inc
@ -149,4 +169,4 @@ horror.o: horror.s
clean:
rm -f *~ *.o *.lst CIRCLES ARCS WEB CIRCLES_FILL PAC ORB \
BRES.BAS BRESBOT.BAS BRESCOOL.BAS BRESTEST.BAS \
MID.BAS MIDBOT.BAS MIDCOOL.BAS ORB_TINY HORROR
MID.BAS MIDBOT.BAS MIDCOOL.BAS ORB_TINY HORROR TUNNEL WEB2

View File

@ -0,0 +1,253 @@
; tunnel
; D0+ used by HGR routines
HGR_COLOR = $E4
HGR_PAGE = $E6
RR = $F5
COUNT = $F6
XX = $F7
MINUSXX = $F8
YY = $F9
MINUSYY = $FA
D = $FB
R = $FC
CX = $FD
CY = $FE
FRAME = $FF
; soft-switches
KEYPRESS = $C000
KEYRESET = $C010
; ROM routines
HGR2 = $F3D8 ; set hires page2 and clear $4000-$5fff
HGR = $F3E2 ; set hires page1 and clear $2000-$3fff
HPLOT0 = $F457 ; plot at (Y,X), (A)
HCOLOR1 = $F6F0 ; set HGR_COLOR to value in X
COLORTBL = $F6F6
PLOT = $F800 ; PLOT AT Y,A (A colors output, Y preserved)
NEXTCOL = $F85F ; COLOR=COLOR+3
SETCOL = $F864 ; COLOR=A
SETGR = $FB40 ; set graphics and clear LO-RES screen
BELL2 = $FBE4
WAIT = $FCA8 ; delay 1/2(26+27A+5A^2) us
tunnel:
; from R=12 to R=256 or so
jsr HGR2
lda #0
sta RR
draw_next:
ldx RR
lda star_z,X
tax
lda radii,X
sta R
; lda KEYPRESS
; bpl draw_next
; bit KEYRESET
lda #128
sta CX
lda #96
sta CY
;===============================
; draw circle
;===============================
; draw circle at (CX,CY) of radius R
; signed 8-bit math so problems if R > 64?
; XX=0 YY=R
; D=3-2*R
; GOTO6
lda #0
sta XX
lda R
sta YY
lda #3
sec
sbc R
sbc R
sta D
jmp do_plots
circle_loop:
; X=X+1
inc XX
lda XX
and #3
bne circle_loop
; IF D>0 THEN Y=Y-1:D=D+4*(X-Y)+10
lda D
bmi else
dec YY
lda XX
sec
sbc YY
asl
asl
clc
adc D
adc #10
jmp store_D
else:
; ELSE D=D+4*X+6
lda XX
asl
asl
clc
adc D
adc #6
store_D:
sta D
do_plots:
; setup constants
lda XX
eor #$FF
sta MINUSXX
inc MINUSXX
lda YY
eor #$FF
sta MINUSYY
inc MINUSYY
; HPLOT CX+X,CY+Y
; HPLOT CX-X,CY+Y
; HPLOT CX+X,CY-Y
; HPLOT CX-X,CY-Y
; HPLOT CX+Y,CY+X
; HPLOT CX-Y,CY+X
; HPLOT CX+Y,CY-X
; HPLOT CX-Y,CY-X
; calc X co-ord
lda #7
sta COUNT
pos_loop:
lda COUNT
and #$4
lsr
tay
lda COUNT
lsr
bcc xnoc
iny
xnoc:
lda CX
clc
adc XX,Y
tax
; calc y co-ord
lda COUNT
lsr
eor #$2
tay
lda CY
clc
adc XX,Y
ldy #0
jsr HPLOT0 ; plot at (Y,X), (A)
dec COUNT
bpl pos_loop
; IFY>=XTHEN4
lda YY
cmp XX
bcs circle_loop
done:
lda RR
clc
adc #1
sta RR
stop:
cmp #19
beq stop
; GOTO1
jmp draw_next
radii:
.byte <4000, <3200, <1600, <1066, <800, <640, <533, <457
.byte <400, <355, <320, <290, <266, 246, 228, 213
.byte 200, 188, 177, 168, 160, 152, 145, 139
.byte 133, 128, 123, 118, 114, 110, 106, 103
.byte 100, 96, 94, 91, 88, 86, 84, 82
.byte 80, 78, 76, 74, 72, 71, 69, 68
.byte 66, 65, 64, 62, 61, 60, 59, 58
.byte 57, 56, 55, 54, 53, 52, 51, 50
.byte 50, 49, 48, 47, 47, 46, 45, 45
.byte 44, 43, 43, 42, 42, 41, 41, 40
.byte 40, 39, 39, 38, 38, 37, 37, 36
.byte 36, 35, 35, 35, 34, 34, 34, 33
.byte 33, 32, 32, 32, 32, 31, 31, 31
.byte 30, 30, 30, 29, 29, 29, 29, 28
.byte 28, 28, 28, 27, 27, 27, 27, 26
.byte 26, 26, 26, 26, 25, 25, 25, 25
.byte 25, 24, 24, 24, 24, 24, 23, 23
.byte 23, 23, 23, 23, 22, 22, 22, 22
.byte 22, 22, 21, 21, 21, 21, 21, 21
.byte 21, 20, 20, 20, 20, 20, 20, 20
.byte 20, 19, 19, 19, 19, 19, 19, 19
.byte 19, 18, 18, 18, 18, 18, 18, 18
.byte 18, 18, 17, 17, 17, 17, 17, 17
.byte 17, 17, 17, 17, 17, 16, 16, 16
.byte 16, 16, 16, 16, 16, 16, 16, 16
.byte 16, 15, 15, 15, 15, 15, 15, 15
.byte 15, 15, 15, 15, 15, 15, 14, 14
.byte 14, 14, 14, 14, 14, 14, 14, 14
.byte 14, 14, 14, 14, 14, 13, 13, 13
.byte 13, 13, 13, 13, 13, 13, 13, 13
.byte 13, 13, 13, 13, 13, 13, 13, 12
.byte 12, 12, 12, 12, 12, 12, 12, 12
; num-stars = 20
star_z:
.byte 15,26,38,50,63,75,78,100,112,125,137
.byte 150,162,175,187,200,212,224,237

View File

@ -0,0 +1,239 @@
; tunnel
; D0+ used by HGR routines
HGR_COLOR = $E4
HGR_PAGE = $E6
RR = $F5
COUNT = $F6
XX = $F7
MINUSXX = $F8
YY = $F9
MINUSYY = $FA
D = $FB
R = $FC
CX = $FD
CY = $FE
FRAME = $FF
; soft-switches
KEYPRESS = $C000
KEYRESET = $C010
; ROM routines
HGR2 = $F3D8 ; set hires page2 and clear $4000-$5fff
HGR = $F3E2 ; set hires page1 and clear $2000-$3fff
HPLOT0 = $F457 ; plot at (Y,X), (A)
HCOLOR1 = $F6F0 ; set HGR_COLOR to value in X
COLORTBL = $F6F6
PLOT = $F800 ; PLOT AT Y,A (A colors output, Y preserved)
NEXTCOL = $F85F ; COLOR=COLOR+3
SETCOL = $F864 ; COLOR=A
SETGR = $FB40 ; set graphics and clear LO-RES screen
BELL2 = $FBE4
WAIT = $FCA8 ; delay 1/2(26+27A+5A^2) us
tunnel:
; from R=12 to R=256 or so
jsr HGR2
lda #10
sta RR
draw_next:
ldx RR
lda radii,X
sta R
; lda KEYPRESS
; bpl draw_next
; bit KEYRESET
lda #128
sta CX
lda #96
sta CY
;===============================
; draw circle
;===============================
; draw circle at (CX,CY) of radius R
; signed 8-bit math so problems if R > 64?
; XX=0 YY=R
; D=3-2*R
; GOTO6
lda #0
sta XX
lda R
sta YY
lda #3
sec
sbc R
sbc R
sta D
jmp do_plots
circle_loop:
; X=X+1
inc XX
; IF D>0 THEN Y=Y-1:D=D+4*(X-Y)+10
lda D
bmi else
dec YY
lda XX
sec
sbc YY
asl
asl
clc
adc D
adc #10
jmp store_D
else:
; ELSE D=D+4*X+6
lda XX
asl
asl
clc
adc D
adc #6
store_D:
sta D
do_plots:
; setup constants
lda XX
eor #$FF
sta MINUSXX
inc MINUSXX
lda YY
eor #$FF
sta MINUSYY
inc MINUSYY
; HPLOT CX+X,CY+Y
; HPLOT CX-X,CY+Y
; HPLOT CX+X,CY-Y
; HPLOT CX-X,CY-Y
; HPLOT CX+Y,CY+X
; HPLOT CX-Y,CY+X
; HPLOT CX+Y,CY-X
; HPLOT CX-Y,CY-X
; calc X co-ord
lda #7
sta COUNT
pos_loop:
lda COUNT
and #$4
lsr
tay
lda COUNT
lsr
bcc xnoc
iny
xnoc:
lda CX
clc
adc XX,Y
tax
; calc y co-ord
lda COUNT
lsr
eor #$2
tay
lda CY
clc
adc XX,Y
ldy #0
jsr HPLOT0 ; plot at (Y,X), (A)
dec COUNT
bpl pos_loop
; IFY>=XTHEN4
lda YY
cmp XX
bcs circle_loop
done:
lda RR
clc
adc #1
sta RR
stop:
cmp #250
beq stop
; GOTO1
jmp draw_next
radii:
.byte <4000, <3200, <1600, <1066, <800, <640, <533, <457
.byte <400, <355, <320, <290, <266, 246, 228, 213
.byte 200, 188, 177, 168, 160, 152, 145, 139
.byte 133, 128, 123, 118, 114, 110, 106, 103
.byte 100, 96, 94, 91, 88, 86, 84, 82
.byte 80, 78, 76, 74, 72, 71, 69, 68
.byte 66, 65, 64, 62, 61, 60, 59, 58
.byte 57, 56, 55, 54, 53, 52, 51, 50
.byte 50, 49, 48, 47, 47, 46, 45, 45
.byte 44, 43, 43, 42, 42, 41, 41, 40
.byte 40, 39, 39, 38, 38, 37, 37, 36
.byte 36, 35, 35, 35, 34, 34, 34, 33
.byte 33, 32, 32, 32, 32, 31, 31, 31
.byte 30, 30, 30, 29, 29, 29, 29, 28
.byte 28, 28, 28, 27, 27, 27, 27, 26
.byte 26, 26, 26, 26, 25, 25, 25, 25
.byte 25, 24, 24, 24, 24, 24, 23, 23
.byte 23, 23, 23, 23, 22, 22, 22, 22
.byte 22, 22, 21, 21, 21, 21, 21, 21
.byte 21, 20, 20, 20, 20, 20, 20, 20
.byte 20, 19, 19, 19, 19, 19, 19, 19
.byte 19, 18, 18, 18, 18, 18, 18, 18
.byte 18, 18, 17, 17, 17, 17, 17, 17
.byte 17, 17, 17, 17, 17, 16, 16, 16
.byte 16, 16, 16, 16, 16, 16, 16, 16
.byte 16, 15, 15, 15, 15, 15, 15, 15
.byte 15, 15, 15, 15, 15, 15, 14, 14
.byte 14, 14, 14, 14, 14, 14, 14, 14
.byte 14, 14, 14, 14, 14, 13, 13, 13
.byte 13, 13, 13, 13, 13, 13, 13, 13
.byte 13, 13, 13, 13, 13, 13, 13, 12
.byte 12, 12, 12, 12, 12, 12, 12, 12

239
graphics/hgr/circles/web2.s Normal file
View File

@ -0,0 +1,239 @@
; tunnel
; D0+ used by HGR routines
HGR_COLOR = $E4
HGR_PAGE = $E6
RR = $F5
COUNT = $F6
XX = $F7
MINUSXX = $F8
YY = $F9
MINUSYY = $FA
D = $FB
R = $FC
CX = $FD
CY = $FE
FRAME = $FF
; soft-switches
KEYPRESS = $C000
KEYRESET = $C010
; ROM routines
HGR2 = $F3D8 ; set hires page2 and clear $4000-$5fff
HGR = $F3E2 ; set hires page1 and clear $2000-$3fff
HPLOT0 = $F457 ; plot at (Y,X), (A)
HCOLOR1 = $F6F0 ; set HGR_COLOR to value in X
COLORTBL = $F6F6
PLOT = $F800 ; PLOT AT Y,A (A colors output, Y preserved)
NEXTCOL = $F85F ; COLOR=COLOR+3
SETCOL = $F864 ; COLOR=A
SETGR = $FB40 ; set graphics and clear LO-RES screen
BELL2 = $FBE4
WAIT = $FCA8 ; delay 1/2(26+27A+5A^2) us
tunnel:
; from R=12 to R=256 or so
jsr HGR2
lda #13
sta RR
draw_next:
ldx RR
lda radii,X
sta R
; lda KEYPRESS
; bpl draw_next
; bit KEYRESET
lda #128
sta CX
lda #96
sta CY
;===============================
; draw circle
;===============================
; draw circle at (CX,CY) of radius R
; signed 8-bit math so problems if R > 64?
; XX=0 YY=R
; D=3-2*R
; GOTO6
lda #0
sta XX
lda R
sta YY
lda #3
sec
sbc R
sbc R
sta D
jmp do_plots
circle_loop:
; X=X+1
inc XX
; IF D>0 THEN Y=Y-1:D=D+4*(X-Y)+10
lda D
bmi else
dec YY
lda XX
sec
sbc YY
asl
asl
clc
adc D
adc #10
jmp store_D
else:
; ELSE D=D+4*X+6
lda XX
asl
asl
clc
adc D
adc #6
store_D:
sta D
do_plots:
; setup constants
lda XX
eor #$FF
sta MINUSXX
inc MINUSXX
lda YY
eor #$FF
sta MINUSYY
inc MINUSYY
; HPLOT CX+X,CY+Y
; HPLOT CX-X,CY+Y
; HPLOT CX+X,CY-Y
; HPLOT CX-X,CY-Y
; HPLOT CX+Y,CY+X
; HPLOT CX-Y,CY+X
; HPLOT CX+Y,CY-X
; HPLOT CX-Y,CY-X
; calc X co-ord
lda #7
sta COUNT
pos_loop:
lda COUNT
and #$4
lsr
tay
lda COUNT
lsr
bcc xnoc
iny
xnoc:
lda CX
clc
adc XX,Y
tax
; calc y co-ord
lda COUNT
lsr
eor #$2
tay
lda CY
clc
adc XX,Y
ldy #0
jsr HPLOT0 ; plot at (Y,X), (A)
dec COUNT
bpl pos_loop
; IFY>=XTHEN4
lda YY
cmp XX
bcs circle_loop
done:
lda RR
clc
adc #1
sta RR
stop:
cmp #250
beq stop
; GOTO1
jmp draw_next
radii:
.byte <4000, <3200, <1600, <1066, <800, <640, <533, <457
.byte <400, <355, <320, <290, <266, 246, 228, 213
.byte 200, 188, 177, 168, 160, 152, 145, 139
.byte 133, 128, 123, 118, 114, 110, 106, 103
.byte 100, 96, 94, 91, 88, 86, 84, 82
.byte 80, 78, 76, 74, 72, 71, 69, 68
.byte 66, 65, 64, 62, 61, 60, 59, 58
.byte 57, 56, 55, 54, 53, 52, 51, 50
.byte 50, 49, 48, 47, 47, 46, 45, 45
.byte 44, 43, 43, 42, 42, 41, 41, 40
.byte 40, 39, 39, 38, 38, 37, 37, 36
.byte 36, 35, 35, 35, 34, 34, 34, 33
.byte 33, 32, 32, 32, 32, 31, 31, 31
.byte 30, 30, 30, 29, 29, 29, 29, 28
.byte 28, 28, 28, 27, 27, 27, 27, 26
.byte 26, 26, 26, 26, 25, 25, 25, 25
.byte 25, 24, 24, 24, 24, 24, 23, 23
.byte 23, 23, 23, 23, 22, 22, 22, 22
.byte 22, 22, 21, 21, 21, 21, 21, 21
.byte 21, 20, 20, 20, 20, 20, 20, 20
.byte 20, 19, 19, 19, 19, 19, 19, 19
.byte 19, 18, 18, 18, 18, 18, 18, 18
.byte 18, 18, 17, 17, 17, 17, 17, 17
.byte 17, 17, 17, 17, 17, 16, 16, 16
.byte 16, 16, 16, 16, 16, 16, 16, 16
.byte 16, 15, 15, 15, 15, 15, 15, 15
.byte 15, 15, 15, 15, 15, 15, 14, 14
.byte 14, 14, 14, 14, 14, 14, 14, 14
.byte 14, 14, 14, 14, 14, 13, 13, 13
.byte 13, 13, 13, 13, 13, 13, 13, 13
.byte 13, 13, 13, 13, 13, 13, 13, 12
.byte 12, 12, 12, 12, 12, 12, 12, 12