plasma: add special bot version

did get it to load with the more advanced loader
This commit is contained in:
Vince Weaver 2021-01-10 00:55:29 -05:00
parent 3b9f746ca6
commit 9ec1f83fd2
7 changed files with 250 additions and 9 deletions

View File

@ -3,7 +3,7 @@ include ../../Makefile.inc
DOS33 = ../../utils/dos33fs-utils/dos33
TOKENIZE = ../../utils/asoft_basic-utils/tokenize_asoft
all: appleiibot.dsk convert_to convert_back convert_qkumba make_boxes convert_vmw
all: appleiibot.dsk convert_to convert_back convert_qkumba make_boxes convert_vmw convert_tgreene
appleiibot.dsk: E2.BAS FLAME.BAS FLAME2.BAS \
CIRCLES.BAS AUTUMN.BAS QKUMBA.BAS ASTEROID.BAS PERSON.BAS SHIP.BAS \
@ -89,6 +89,14 @@ convert_vmw: convert_vmw.o
convert_vmw.o: convert_vmw.c
$(CC) $(CFLAGS) -c convert_vmw.c
###
convert_tgreene: convert_tgreene.o
$(CC) $(LFLAGS) -o convert_tgreene convert_tgreene.o
convert_tgreene.o: convert_tgreene.c
$(CC) $(CFLAGS) -c convert_tgreene.c
###
@ -323,4 +331,4 @@ HYPER.BAS: hyper.bas
####
clean:
rm -f *~ *.o *.lst convert_to convert_from convert_qkumba convert_vmw make_boxes convert_back LOAD *.BAS
rm -f *~ *.o *.lst convert_to convert_from convert_qkumba convert_vmw make_boxes convert_back convert_tgreene LOAD *.BAS

View File

@ -1,2 +1,2 @@
1REM,=n9D`M1X/5Z.NJ.MJ-AS'1k-1b3kR4jjk/3bbnM9R(021QoPB25An-W3N/J_O;M7QkU:21oY_0&73<Y_D2Q463dWoR4i^3b6^E*FMhLE)/1%/1.00hmnaknbP(L3748DA$ 2@NJ&*,T8DL2'&U:2@H 28Z?<S-=TU
2FORI=0TO121:POKE3072+I,4*PEEK(2054+I)-192+(PEEK(2175+I/3)-32)/4^(I-INT(I/3)*3):NEXT:CALL3072
1FORI=0TO143:POKE872+I,4*PEEK(2125+I)-192+(PEEK(2269+I/3)-35)/4^(I-INT(I/3)*3):NEXT
2&",=n9D`M1X/5Z.Ni+Mi*AS'1kD.b3kR4jjk/3bbnLX0k0j_E`>0SP.X1P2(02ImRB28=mY8J0N9:W3T/JhO;X/OoI73)mZ[/3/1BQ]g/Q<63nWoR,gb1`<QC8:JoLE0#.1+01,/omnngmo7G0S+O6::>GP'#5C`'#4RNMD%6*00),NWD4PI*+-C/Ia*Z?6*@S

View File

@ -0,0 +1,3 @@
{B15}
1REM,=n9D`M1X/5Z.NJ.MJ-AS'1k-1b3kR4jjk/3bbnM9R(021QoPB25An-W3N/J_O;M7QkU:21oY_0&73<Y_D2Q463dWoR4i^3b6^E*FMhLE)/1%/1.00hmnaknbP(L3748DA$ 2@NJ&*,T8DL2'&U:2@H 28Z?<S-=TU
2FORI=0TO121:POKE3072+I,4*PEEK(2054+I)-192+(PEEK(2175+I/3)-32)/4^(I-INT(I/3)*3):NEXT:CALL3072

View File

@ -6,11 +6,12 @@ LINKERSCRIPTS = ../../../linker_scripts
all: plasma.dsk
plasma.dsk: HELLO PLASMA PLASMA_TINY
plasma.dsk: HELLO PLASMA PLASMA_TINY PLASMA_BOT
cp empty.dsk plasma.dsk
$(DOS33) -y plasma.dsk SAVE A HELLO
$(DOS33) -y plasma.dsk BSAVE -a 0xC00 PLASMA
$(DOS33) -y plasma.dsk BSAVE -a 0x300 PLASMA
$(DOS33) -y plasma.dsk BSAVE -a 0xC00 PLASMA_TINY
$(DOS33) -y plasma.dsk BSAVE -a 0x368 PLASMA_BOT
###
@ -20,13 +21,22 @@ HELLO: hello.bas
###
PLASMA: plasma.o
ld65 -o PLASMA plasma.o -C $(LINKERSCRIPTS)/apple2_c00.inc
ld65 -o PLASMA plasma.o -C $(LINKERSCRIPTS)/apple2_300.inc
plasma.o: plasma.s
ca65 -o plasma.o plasma.s -l plasma.lst
###
PLASMA_BOT: plasma_bot.o
ld65 -o PLASMA_BOT plasma_bot.o -C ./apple2_368.inc
plasma_bot.o: plasma_bot.s
ca65 -o plasma_bot.o plasma_bot.s -l plasma_bot.lst
###
PLASMA_TINY: plasma_tiny.o
ld65 -o PLASMA_TINY plasma_tiny.o -C $(LINKERSCRIPTS)/apple2_c00.inc
@ -37,4 +47,4 @@ plasma_tiny.o: plasma_tiny.s
###
clean:
rm -f *~ *.o *.lst PLASMA
rm -f *~ *.o *.lst PLASMA PLASMA_TINY PLASMA_BOT

View File

@ -0,0 +1,12 @@
MEMORY {
ZP: start = $00, size = $1A, type = rw;
RAM: start = $368, size = $8E00, file = %O;
}
SEGMENTS {
CODE: load = RAM, type = ro, align = $1;
RODATA: load = RAM, type = ro;
DATA: load = RAM, type = rw;
BSS: load = RAM, type = bss, define = yes;
ZEROPAGE: load = ZP, type = zp;
}

View File

@ -30,6 +30,7 @@ SAVEY = $FF
;================================
; Clear screen and setup graphics
;================================
plasma:
jsr SETGR ; set lo-res 40x40 mode
bit FULLGR ; make it 40x48
@ -195,7 +196,6 @@ sinetable:
;.byte $07,$07,$06,$06,$02,$02,$05,$05
;.byte $00,$55,$77,$ff,$77,$66,$22,$55
; make lookup happen at page boundary
.org $d00

View File

@ -0,0 +1,208 @@
; do a (hopefully fast) plasma type demo
; 151 -- original
; 137 -- optimize generation
; 136 -- align lookup table so we can index it easier
; 130 -- optimize indexing of lookup
; 126 -- run loops backaward
; 124 -- notice X already 0 before plot
; 131 -- use GBASCALC. much faster, but 7 bytes larger
; 129 -- run loop backwards
; 128 -- set color ourselves
; 127 -- overlap color lookup with sine table
; 119 -- forgot to comment out unused
; 121 -- make it use full screen (40x48)
; 149 -- add page flipping
; 144 -- optimize a bit
; 141 -- smc DRAW_PAGE
; goal=135
.include "zp.inc"
.include "hardware.inc"
CTEMP = $FC
SAVEOFF = $FD
SAVEX = $FE
SAVEY = $FF
;================================
; Clear screen and setup graphics
;================================
plasma:
jsr SETGR ; set lo-res 40x40 mode
bit FULLGR ; make it 40x48
; color = ( 8.0 + 8*sin(x) + 8.0 + 8*sin(y) )/2
; becomes
; color = ( 16 + (sintable[xx&0xf]) + (sintable[yy&0xf])) / 2;
; we only create a 16x16 texture, which we pattern across 40x48 screen
create_lookup:
ldy #15
create_yloop:
ldx #15
create_xloop:
clc
lda #15 ; 8+8 (but 15 works better)
adc sinetable,X
adc sinetable,Y
lsr
lookup_smc:
sta lookup ; always starts at $d00
inc lookup_smc+1
dex
bpl create_xloop
dey
bpl create_yloop
; X and Y both $FF
create_lookup_done:
forever_loop:
cycle_colors:
; cycle colors
; can't do palette rotate on Apple II so faking it here
; just incrementing every entry in texture by 1
; X if $FF when arriving here
; ldx #0
inx ; make X 0
cycle_loop:
inc lookup,X
inx
bne cycle_loop
; set/flip pages
; we want to flip pages and then draw to the offscreen one
flip_pages:
; ldx #0 ; x already 0
lda draw_page_smc+1 ; DRAW_PAGE
beq done_page
inx
done_page:
ldy PAGE0,X ; set display page to PAGE1 or PAGE2
eor #$4 ; flip draw page between $400/$800
sta draw_page_smc+1 ; DRAW_PAGE
; plot current frame
; scan whole 40x48 screen and plot each point based on
; lookup table colors
plot_frame:
ldx #47 ; YY=47 (count backwards)
plot_yloop:
txa ; get (y&0xf)<<4
asl
asl
asl
asl
sta CTEMP ; save for later
txa ; get Y in accumulator
lsr ; call actually wants Ycoord/2
php ; save shifted-off low bit in C for later
jsr GBASCALC ; point GBASL/H to address in (A is ycoord/2)
; after, A is GBASL, C is clear
lda GBASH ; adjust to be PAGE1/PAGE2 ($400 or $800)
draw_page_smc:
adc #0
sta GBASH
plp ; restore C, indicating odd/even row
lda #$0f ; setup mask for odd/even line
bcc plot_mask
adc #$e0 ; needlessly clever, from monitor rom src
plot_mask:
sta MASK
;==========
ldy #39 ; XX = 39 (countdown)
plot_xloop:
stx SAVEX ; SAVE YY
tya ; get x&0xf
and #$f
ora CTEMP ; combine with val from earlier
; get ((y&0xf)*16)+x
tax
plot_lookup:
; sta plot_lookup_smc+1
plot_lookup_smc:
lda lookup,X ; load lookup, (y*16)+x
; lda lookup ; load lookup, (y*16)+x
and #$f
lsr ; we actually only have 8 colors
tax
lda colorlookup,X ; lookup color
sta COLOR ; each nibble should be same
jsr PLOT1 ; plot at GBASL,Y (x co-ord goes in Y)
ldx SAVEX ; restore YY
dey
bpl plot_xloop
dex
bpl plot_yloop
bmi forever_loop
colorlookup:
bw_color_lookup:
.byte $55,$22,$66,$77,$ff,$77,$55 ; ,$00 shared w sin table
; this is actually 8*sin(x)
sinetable:
.byte $00,$03,$05,$07,$08,$07,$05,$03
.byte $00,$FD,$FB,$F9,$F8,$F9,$FB,$FD
;colorlookup:
;.byte $00,$00,$05,$05,$07,$07,$0f,$0f
;.byte $07,$07,$06,$06,$02,$02,$05,$05
;.byte $00,$55,$77,$ff,$77,$66,$22,$55
; want this to be at 3f5
; Lenth is 144 so start at $3f4 -
; 1013 - 144 + 3 = 872 = $368
jmp plasma
; make lookup happen at page boundary
.org $d00
lookup: