c64: get it small enough

This commit is contained in:
Vince Weaver 2021-01-25 20:37:13 -05:00
parent 666d2a6379
commit a9219f0d41
5 changed files with 128 additions and 47 deletions

View File

@ -11,7 +11,8 @@ appleiibot.dsk: E2.BAS FLAME.BAS FLAME2.BAS \
RASTER4.BAS RASTER5.BAS PUMPKIN.BAS PUMPKIN_SMALL.BAS LADY.BAS \
A2.BAS FOURAM.BAS FLOPPY.BAS QR.BAS A2_4EVER.BAS RLE.BAS RLE2.BAS \
RLEASM.BAS HORIZON.BAS FLYER.BAS STAR.BAS HYPER.BAS FASTAR.BAS \
FASTAR2.BAS BIN.BAS FALLING.BAS SNOW.BAS XMAS.BAS AN3.BAS PLASMA.BAS
FASTAR2.BAS BIN.BAS FALLING.BAS SNOW.BAS XMAS.BAS AN3.BAS PLASMA.BAS \
C64.BAS
cp empty.dsk appleiibot.dsk
$(DOS33) -y appleiibot.dsk BSAVE -a 0x0300 LOAD
# $(DOS33) -y appleiibot.dsk BSAVE -a 0x0C00 FASTAR2
@ -55,6 +56,7 @@ appleiibot.dsk: E2.BAS FLAME.BAS FLAME2.BAS \
$(DOS33) -y appleiibot.dsk SAVE A XMAS.BAS
$(DOS33) -y appleiibot.dsk SAVE A AN3.BAS
$(DOS33) -y appleiibot.dsk SAVE A PLASMA.BAS
$(DOS33) -y appleiibot.dsk SAVE A C64.BAS
###
@ -160,6 +162,11 @@ AN3.BAS: an3.bas
PLASMA.BAS: plasma.bas
$(TOKENIZE) < plasma.bas > PLASMA.BAS
####
C64.BAS: c64.bas
$(TOKENIZE) < c64.bas > C64.BAS
####

2
basic/appleiibot/c64.bas Normal file
View File

@ -0,0 +1,2 @@
1FORI=0TO143:POKE1013+I,4*PEEK(2126+I)-192+(PEEK(2270+I/3)-35)/4^(I-INT(I/3)*3):NEXT
2&",clYe8jlQ0RQ`X0JhZ%NoW56F1QmZX#Vo74mU/^I16?=ZT0Z,70ki0U/Yo`7b1QbWoPo`,ac^l?4:1-?99=06=?1->0Y1-79:10389/-8900.00(02/80'02*21(38%/8%/3+-8(02.46'17S(/#G@W04,W'3#P33-3$+Z(T[7/,/UG/0VT#+M1L@W^^UM5Q

45
graphics/hgr/c64/Makefile Normal file
View File

@ -0,0 +1,45 @@
include ../../../Makefile.inc
DOS33 = ../../../utils/dos33fs-utils/dos33
TOKENIZE = ../../../utils/asoft_basic-utils/tokenize_asoft
LINKER_SCRIPTS = ../../../linker_scripts
all: c64.dsk
c64.dsk: HELLO C64.BAS C64_TINY.BAS C64
cp empty.dsk c64.dsk
$(DOS33) -y c64.dsk SAVE A HELLO
$(DOS33) -y c64.dsk SAVE A C64.BAS
$(DOS33) -y c64.dsk SAVE A C64_TINY.BAS
$(DOS33) -y c64.dsk SAVE A C64_TINY.BAS
$(DOS33) -y c64.dsk BSAVE -a 0x3F5 C64
###
HELLO: hello.bas
$(TOKENIZE) < hello.bas > HELLO
###
C64: c64.o
ld65 -o C64 c64.o -C $(LINKER_SCRIPTS)/apple2_3f5.inc
c64.o: c64.s
ca65 -o c64.o c64.s -l c64.lst
###
C64.BAS: c64.bas
$(TOKENIZE) < c64.bas > C64.BAS
###
C64_TINY.BAS: c64_tiny.bas
$(TOKENIZE) < c64_tiny.bas > C64_TINY.BAS
###
clean:
rm -f *~ *.o *.lst C64.BAS C64_TINY.BAS

View File

@ -1,6 +1,17 @@
; silly c64
; needs to be 146 bytes or less
; 147 initial, top line
; 145 beq instead of jmp, 0 is already in Y
; 141 inline draw
; 146 add READY
; 136 optimize addr calculation
; 150 printing READY and skipping line
; 147 get FF by decrementing 0
; 146 move increment before the draw
; 144 have XPOS in A at beginning of loop
; 142 realize shapes don't have to be aligned at 5
; needs to be 144 bytes or less
; zero page locations
WHICH = $00
@ -50,50 +61,26 @@ dsr_demo:
lda #$D5 ; color blue
jsr HCLR_COLOR
sty WHICH ; = 0
dey ; $ff = white2
sty HGR_COLOR
lda #2
sta HGR_SCALE
lda #0
sta WHICH
;=========================
; draw letters
;=========================
; LDA COLORTBL,X GET COLOR PATTERN
lda #$ff
sta HGR_COLOR
lda #8
sta YPOS
lda #23
sta XPOS
; sta XPOS
; XPOS in A coming in
first_loop:
lda WHICH
tay
lda string,Y
clc
adc #<shape_table
sta shape_smc+1
lda #>shape_table
sta shape2_smc+1
jsr draw
inc WHICH
lda XPOS
clc
adc #8
sta XPOS
cmp #(28*8)+23
bne first_loop
end:
jmp end
draw:
@ -101,26 +88,53 @@ draw:
; need to have co-ords set up with HPOSN
; rotate should be in A
; lda XPOS
clc
adc #8
sta XPOS
tax
; setup X and Y co-ords
ldy #0 ; XPOSH always 0 for us
ldx XPOS
; ldx XPOS
lda YPOS
jsr HPOSN ; X= (y,x) Y=(a)
shape_smc:
ldx #<shape_table ; point to our shape
shape2_smc:
ldy #>shape_table ; code fits in one page so this doesn't change
ldy WHICH
lda string,Y
clc
adc #<shape_table
tax
; ldx #<shape_table ; point to our shape (low)
ldy #>shape_table ; code fits in one page, same always
rot_smc:
lda #0 ; set rotation
jmp DRAW0 ; XDRAW 1 AT X,Y
jsr DRAW0 ; XDRAW 1 AT X,Y
; Both A and X are 0 at exit
inc WHICH
ldy WHICH
lda XPOS
cpy #28
bne no_adjust
sty YPOS ; want 32, 28 is close
lda #$ff
sta XPOS
no_adjust:
cpy #33
bne first_loop
end:
beq end
shape_table:
@ -130,7 +144,7 @@ shape_table:
.byte $3b,$24,$ad,$06,$00 ; D 3
.byte $1f,$24,$35,$07,$00 ; R 4
.byte $3f,$2c,$27,$2d,$00 ; E 5
.byte $23,$24,$00,$00,$00 ; I 6
.byte $23,$24,$00 ; I 6
.byte $02,$00 ; space 7
;.byte $3b,$24,$ad,$06,$00 ; 4 8
@ -146,13 +160,14 @@ shape_table:
string:
; * * * * C O M M O D O R E
.byte 10,10,10,10,35,0, 5,10,10, 5,15, 5,20,25,35
.byte 10,10,10,10,33,0, 5,10,10, 5,15, 5,20,25,33
; 6 4 B A S I C * * * *
.byte 15,10,35,15,10,15,30,0, 35,10,10,10,10
;$3c,$2c,$3c,$3f,$36,$06,$00
;$3f,$27,$2c,$27,$2d,$05,$00
.byte 15,10,33,15,10,15,30,0, 33,10,10,10,10
; 28
; R E A D Y
.byte 20,25,10,15,30
; 5

View File

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