pastel: working on poke-free machine code

This commit is contained in:
Vince Weaver 2021-03-10 01:23:03 -05:00
parent 4540a4dd8c
commit 37e0362341
8 changed files with 248 additions and 0 deletions

View File

@ -0,0 +1,47 @@
include ../../../Makefile.inc
DOS33 = ../../../utils/dos33fs-utils/dos33
TOKENIZE = ../../../utils/asoft_basic-utils/tokenize_asoft
EMPTYDISK = ../../../empty_disk/empty.dsk
LINKERSCRIPTS = ../../../linker_scripts/
all: tiny_pastel.dsk
tiny_pastel.dsk: HELLO TINY_PASTEL PASTEL PASTEL.BAS
cp $(EMPTYDISK) tiny_pastel.dsk
$(DOS33) -y tiny_pastel.dsk SAVE A HELLO
$(DOS33) -y tiny_pastel.dsk SAVE A PASTEL.BAS
$(DOS33) -y tiny_pastel.dsk BSAVE -a 0x70 TINY_PASTEL
$(DOS33) -y tiny_pastel.dsk BSAVE -a 0x810 PASTEL
###
HELLO: hello.bas
$(TOKENIZE) < hello.bas > HELLO
###
PASTEL.BAS: pastel.bas
$(TOKENIZE) < pastel.bas > PASTEL.BAS
###
TINY_PASTEL: tiny_pastel.o
ld65 -o TINY_PASTEL tiny_pastel.o -C ./apple2_70_zp.inc
tiny_pastel.o: tiny_pastel.s
ca65 -o tiny_pastel.o tiny_pastel.s -l tiny_pastel.lst
###
PASTEL: pastel.o
ld65 -o PASTEL pastel.o -C apple2_810.inc
pastel.o: pastel.s
ca65 -o pastel.o pastel.s -l pastel.lst
####
clean:
rm -f *~ *.o *.lst HELLO TINY_PASTEL PASTEL.BAS

View File

@ -0,0 +1,12 @@
MEMORY {
ZP: start = $70, size = $90, type = rw;
RAM: start = $70, 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 = ro;
}

View File

@ -0,0 +1,12 @@
MEMORY {
ZP: start = $00, size = $1A, type = rw;
RAM: start = $810, 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

@ -0,0 +1,3 @@
5 HOME
20 PRINT CHR$(4)"CATALOG"

View File

@ -0,0 +1,2 @@
10 CALL +2064
20 ,PTAB(PR#UPSTORESPEED=@JJJHSPEED=XJHSPEED=COLOR=IXHSPEED=HIMEM:ITAB(HROT=`LEFT$STORESPEED=@JJJHSPEED=$JHSPEED=ONERRIXHSPEED=GOSUBI\HROT=`

View File

@ -0,0 +1,130 @@
; Pastel
; pastel colors
; see if we can force into BASIC
; zero page locations
; ROM calls
SETCOL = $F864 ; COLOR=A
PRHEX = $FDE3 ; print hex digit
COUT = $FDED ; output A to screen
SETGR = $FB40 ; set lo-res graphics and clear screen
tiny_xdraw:
bit $C050 ; switch to lo-res graphics
tiny_loop:
txa
eor $50,X ; get value from zero page
tay
lda #$40 ; push return address-1 ($082C)
lsr
lsr
lsr
pha
lda #$58 ; can't be 2B :( 0010 1011
lsr
pha
lda #$A0 ; A0 ^ 58 ; F8 1111 1000
eor #$58
pha
lda #$A3 ; SETCOL = $F864
eor #$C0 ; 63 = 0110 0011
pha
tya
rts
inx
tay
; jsr SETCOL ; set bottom nibble to top
lda #$40 ; want to return to $813 (so $812)
lsr
lsr
lsr
pha
lda #$24
lsr
pha
lda #$A5 ; want 1111 1101
eor #$58
pha
lda #$B0 ; want 1110 1100
eor #$5C
pha ; COUT = $FDED
tya
rts
; jsr COUT ; print to text screen (which is same
; as lo-res graphics screen) with scroll
; NOT ALLOWED: ROL (is ?)
; } turns to ]
; lowercase is uppercased
; 2C ,
; 50 P
; C0 TAB(
; 8A PR#
; 55 U
; 50 P
; A8 STORE
; A9 SPEED=
; 40 @
; 4A J
; 4A J
; 4A J
; 48 H
; A9 SPEED=
; 58 X
; 4A J
; 48 H
; A9 SPEED=
; A0 COLOR=
; 49 I
; 58 X
; 48 H
; A9 SPEED=
; A3 HIMEM:
; 49 I
; C0 TAB(
; 48 H
; 98 ROT=
; 60 `
; E8 LEFT$
; A8 STORE
; A9 SPEED=
; 40 @
; 4A J
; 4A J
; 4A J
; 48 H
; A9 SPEED=
; 24 $
; 4A J
; 48 H
; A9 SPEED=
; A5 ONERR
; 49 I
; 58 X
; 48 H
; A9 SPEED=
; B0 GOSUB
; 49 I
; 5C \
; 48 H
; 98 ROT=
; 60 `
;10 CALL +2064
;20 ,PTAB(PR#UPSTORESPEED=@JJJHSPEED=XJHSPEED=COLOR=IXHSPEED=HIMEM:ITAB(HROT=`LEFT$STORESPEED=@JJJHSPEED=$JHSPEED=ONERRIXHSPEED=GOSUBI\HROT=`

View File

@ -0,0 +1,30 @@
; Tiny Pastel
; draw some scrolling pastel blocks in 16 bytes
; by Vince `deater` Weaver <vince@deater.net>, --- dSr ---
; zero page locations
; ROM calls
SETCOL = $F864 ; COLOR=A
PRHEX = $FDE3 ; print hex digit
COUT = $FDED ; output A to screen
SETGR = $FB40 ; set lo-res graphics and clear screen
.zeropage
tiny_xdraw:
bit $C050 ; switch to lo-res graphics
tiny_loop:
txa
eor $00,X ; get value from zero page
jsr SETCOL ; set bottom nibble to top
jsr COUT ; print to text screen (which is same
; as lo-res graphics screen) with scroll
inx
jmp tiny_loop ; could use bvc to save a byte
; but we can be sure here and we have
; a byte to spare

View File

@ -23,6 +23,7 @@ static int debug=0;
/* a series of bytes either ASCII or tokens (see below) */
/* a $0 char indicating end of line */
/* $9B */
#define NUM_TOKENS 107
/* Starting at 0x80 */
@ -167,6 +168,17 @@ static int find_token(void) {
return 0xBA;
}
// note, on IIe Applesoft uppercases lowercase
// this also extends to the uppper ascii? except for $60 (`)?
// we need to somehow take this into account when comparing
// if (ch>0x60) {
// ch=ch-0x20;
// }
// fprintf(stderr,"%s",line_ptr);
for(i=0;i<NUM_TOKENS;i++) {
if (!strncmp(line_ptr,applesoft_tokens[i],