From f8a3b7cba82bd664275317aa15eeb5ade7de9e94 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Sat, 12 Nov 2022 14:31:56 -0500 Subject: [PATCH] demo: working on logo drawing --- demos/demosplash2022/escape.s | 58 ++++++++ demos/demosplash2022/hardware.inc | 95 +++++++++++++ demos/demosplash2022/letters/Makefile | 40 ++++++ demos/demosplash2022/letters/d.points | 17 +++ demos/demosplash2022/letters/e.points | 21 +++ demos/demosplash2022/letters/i.points | 11 ++ demos/demosplash2022/letters/logo.points | 112 +++++++++++++++ demos/demosplash2022/letters/make_points.c | 83 +++++++++++ demos/demosplash2022/letters/r.points | 22 +++ demos/demosplash2022/letters/s.points | 27 ++++ demos/demosplash2022/logo_intro.s | 156 +++++++++++++++++++++ demos/demosplash2022/zp.inc | 37 +++++ music/tiny_tracker6/amp.s | 78 +++++++++++ 13 files changed, 757 insertions(+) create mode 100644 demos/demosplash2022/escape.s create mode 100644 demos/demosplash2022/hardware.inc create mode 100644 demos/demosplash2022/letters/Makefile create mode 100644 demos/demosplash2022/letters/d.points create mode 100644 demos/demosplash2022/letters/e.points create mode 100644 demos/demosplash2022/letters/i.points create mode 100644 demos/demosplash2022/letters/logo.points create mode 100644 demos/demosplash2022/letters/make_points.c create mode 100644 demos/demosplash2022/letters/r.points create mode 100644 demos/demosplash2022/letters/s.points create mode 100644 demos/demosplash2022/logo_intro.s create mode 100644 demos/demosplash2022/zp.inc create mode 100644 music/tiny_tracker6/amp.s diff --git a/demos/demosplash2022/escape.s b/demos/demosplash2022/escape.s new file mode 100644 index 00000000..12502e63 --- /dev/null +++ b/demos/demosplash2022/escape.s @@ -0,0 +1,58 @@ +; Apple II graphics/music in 1k + +; by deater (Vince Weaver) + +; Zero Page + .include "zp.inc" + .include "hardware.inc" + + +d4: + ;================= + ; init vars + + lda #0 + sta FRAME + sta WHICH_TRACK + + ;=================== + ; music Player Setup + +tracker_song = peasant_song + + ; assume mockingboard in slot#4 + + ; inline mockingboard_init + +.include "mockingboard_init.s" + +.include "tracker_init.s" + + jsr HGR ; enable lo-res graphics + + cli ; enable music + + +.include "logo_intro.s" + +game_loop: + jmp game_loop + + +.include "interrupt_handler.s" +.include "mockingboard_constants.s" + +; music +.include "mA2E_4.s" + +; logo +letter_d: +.include "./letters/d.inc" +letter_e: +.include "./letters/e.inc" +letter_s: +.include "./letters/s.inc" +letter_i: +.include "./letters/i.inc" +letter_r: +.include "./letters/r.inc" diff --git a/demos/demosplash2022/hardware.inc b/demos/demosplash2022/hardware.inc new file mode 100644 index 00000000..2143a408 --- /dev/null +++ b/demos/demosplash2022/hardware.inc @@ -0,0 +1,95 @@ +;; HARDWARE LOCATIONS + +KEYPRESS = $C000 +KEYRESET = $C010 + +;; SOFT SWITCHES +CLR80COL = $C000 ; PAGE0/PAGE1 normal +SET80COL = $C001 ; PAGE0/PAGE1 switches PAGE0 in Aux instead +EIGHTYCOLOFF = $C00C +EIGHTYCOLON = $C00D +SPEAKER = $C030 +SET_GR = $C050 +SET_TEXT = $C051 +FULLGR = $C052 +TEXTGR = $C053 +PAGE1 = $C054 +PAGE2 = $C055 +LORES = $C056 ; Enable LORES graphics +HIRES = $C057 ; Enable HIRES graphics +AN3 = $C05E ; Annunciator 3 + +PADDLE_BUTTON0 = $C061 +PADDL0 = $C064 +PTRIG = $C070 + +;; BASIC ROUTINES + +NORMAL = $F273 +HGR = $F3E2 +HGR2 = $F3D8 +HCLR = $F3F2 +HPOSN = $F411 ; (Y,X),(A) (values stores in HGRX,XH,Y) +XDRAW0 = $F65D +HPLOT0 = $F457 ; plot at (Y,X), (A) +HCOLOR1 = $F6F0 ; set HGR_COLOR to value in X +HGLIN = $F53A ; line to (X,A),(Y) + +;; MONITOR ROUTINES + +HLINE = $F819 ;; HLINE Y,$2C at A +VLINE = $F828 ;; VLINE A,$2D at Y +CLRSCR = $F832 ;; Clear low-res screen +CLRTOP = $F836 ;; clear only top of low-res screen +SETGR = $FB40 ;; GR +SETCOL = $F864 ;; COLOR=A +TEXT = $FB36 +TABV = $FB5B ;; VTAB to A +BELL = $FBDD ;; ring the bell +BASCALC = $FBC1 ;; +VTAB = $FC22 ;; VTAB to CV +HOME = $FC58 ;; Clear the text screen +WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us +CROUT1 = $FD8B +SETINV = $FE80 ;; INVERSE +SETNORM = $FE84 ;; NORMAL +COUT = $FDED ;; output A to screen +COUT1 = $FDF0 ;; output A to screen + + + + + + +COLOR_BLACK = 0 +COLOR_RED = 1 +COLOR_DARKBLUE = 2 +COLOR_PURPLE = 3 +COLOR_DARKGREEN = 4 +COLOR_GREY = 5 +COLOR_MEDIUMBLUE = 6 +COLOR_LIGHTBLUE = 7 +COLOR_BROWN = 8 +COLOR_ORANGE = 9 +COLOR_GREY2 = 10 +COLOR_PINK = 11 +COLOR_LIGHTGREEN = 12 +COLOR_YELLOW = 13 +COLOR_AQUA = 14 +COLOR_WHITE = 15 + +COLOR_BOTH_BLACK = $00 +COLOR_BOTH_RED = $11 +COLOR_BOTH_DARKBLUE = $22 +COLOR_BOTH_DARKGREEN = $44 +COLOR_BOTH_GREY = $55 +COLOR_BOTH_MEDIUMBLUE = $66 +COLOR_BOTH_LIGHTBLUE = $77 +COLOR_BOTH_BROWN = $88 +COLOR_BOTH_ORANGE = $99 +COLOR_BOTH_PINK = $BB +COLOR_BOTH_LIGHTGREEN = $CC +COLOR_BOTH_YELLOW = $DD +COLOR_BOTH_AQUA = $EE +COLOR_BOTH_WHITE = $FF + diff --git a/demos/demosplash2022/letters/Makefile b/demos/demosplash2022/letters/Makefile new file mode 100644 index 00000000..2cfb3471 --- /dev/null +++ b/demos/demosplash2022/letters/Makefile @@ -0,0 +1,40 @@ +include ../../../Makefile.inc + +DOS33 = ../../utils/dos33fs-utils/dos33 +TOKENIZE = ../../utils/asoft_basic-utils/tokenize_asoft +EMPTYDISK = ../../empty_disk/empty.dsk +PICTUREDSK = ~/research/picturedsk.git/picturedsk +LINKER_SCRIPTS = ../../linker_scripts/ + +all: make_points d.inc e.inc s.inc i.inc r.inc + + +#### + +d.inc: make_points d.points + ./make_points < d.points 14 77 > d.inc + +e.inc: make_points e.points + ./make_points < e.points 220 77 > e.inc + +s.inc: make_points s.points + ./make_points < s.points 108 77 > s.inc + +i.inc: make_points i.points + ./make_points < i.points 154 77 > i.inc + +r.inc: make_points r.points + ./make_points < r.points 176 77 > r.inc + +#### + +make_points: make_points.o + $(CC) -o make_points make_points.o + +make_points.o: make_points.c + $(CC) $(CFLAGS) -c make_points.c + +#### + +clean: + rm -f *~ *.o make_points *.inc diff --git a/demos/demosplash2022/letters/d.points b/demos/demosplash2022/letters/d.points new file mode 100644 index 00000000..be732942 --- /dev/null +++ b/demos/demosplash2022/letters/d.points @@ -0,0 +1,17 @@ +282 14 77 56 77 ; D + 58 79 + 58 136 + 60 138 + 60 140 + 14 140 + 18 136 + 18 82 + 14 82 + 14 77 +282 26 90 40 90 + 42 92 + 42 129 + 36 129 + 32 125 + 32 90 + 0 diff --git a/demos/demosplash2022/letters/e.points b/demos/demosplash2022/letters/e.points new file mode 100644 index 00000000..ab99d41d --- /dev/null +++ b/demos/demosplash2022/letters/e.points @@ -0,0 +1,21 @@ +282 234 91 264 91 ; E + 264 80 + 258 77 + 220 77 + 222 83 + 222 133 + 220 140 + 270 140 + 264 134 + 264 116 + 248 116 + 248 127 + 246 129 + 240 129 + 238 127 + 238 91 +282 242 98 250 98 + 250 111 + 242 111 + 242 98 +0 diff --git a/demos/demosplash2022/letters/i.points b/demos/demosplash2022/letters/i.points new file mode 100644 index 00000000..4496a8d6 --- /dev/null +++ b/demos/demosplash2022/letters/i.points @@ -0,0 +1,11 @@ +282 154 77 176 77 ; I + 172 86 + 158 86 + 154 77 +282 156 89 156 134 + 154 140 + 176 140 + 172 134 + 172 89 + 156 89 +0 diff --git a/demos/demosplash2022/letters/logo.points b/demos/demosplash2022/letters/logo.points new file mode 100644 index 00000000..77ca347f --- /dev/null +++ b/demos/demosplash2022/letters/logo.points @@ -0,0 +1,112 @@ +282 14 77 56 77 ; D + 58 79 + 58 136 + 60 138 + 60 140 + 14 140 + 18 136 + 18 82 + 14 82 + 14 77 +282 26 90 40 90 + 42 92 + 42 129 + 36 129 + 32 125 + 32 90 +282 74 91 104 91 ; E + 104 81 + 100 77 + 62 77 + 62 81 + 64 83 + 64 130 + 62 140 + 104 140 + 104 116 + 90 116 + 90 129 + 78 129 + 78 91 +282 82 98 92 98 + 92 111 + 82 111 + 82 98 +282 108 77 148 77 ; S + 150 79 + 150 101 + 136 101 + 136 90 + 134 88 + 124 88 + 124 101 + 128 105 + 148 105 + 150 107 + 150 133 + 152 140 + 110 140 + 108 139 + 108 116 + 124 116 + 124 125 + 128 129 + 132 129 + 136 125 + 136 113 + 114 113 + 110 109 + 110 84 + 108 77 +282 154 77 176 77 ; I + 172 86 + 158 86 + 154 77 +282 156 89 156 134 + 154 140 + 176 140 + 172 134 + 172 89 + 156 89 +282 176 77 216 77 ; R + 218 79 + 218 102 + 216 104 + 218 106 + 218 140 + 200 140 + 204 136 + 204 114 + 194 114 + 194 140 + 176 140 + 178 136 + 178 82 + 176 77 +282 190 88 202 88 + 204 90 + 204 105 + 196 105 + 194 103 + 194 88 +282 234 91 264 91 ; E + 264 80 + 258 77 + 220 77 + 222 83 + 222 133 + 220 140 + 270 140 + 264 134 + 264 116 + 248 116 + 248 127 + 246 129 + 240 129 + 238 127 + 238 91 +282 242 98 250 98 + 250 111 + 242 111 + 242 98 +0 diff --git a/demos/demosplash2022/letters/make_points.c b/demos/demosplash2022/letters/make_points.c new file mode 100644 index 00000000..c95d6db6 --- /dev/null +++ b/demos/demosplash2022/letters/make_points.c @@ -0,0 +1,83 @@ +#include +#include + +#define LINE_VALUE 282 +#define STOP_VALUE 0 +#define MODE_VALUE 3 + +static int debug=1; + +int main(int argc, char **argv) { + + char buffer[1024]; + char *ptr; + int a1,a2,a3,a4,a5; + unsigned char output[1024]; + int out_ptr=0; + int add=0; + int xadjust=0; + int yadjust=0; + int xdiv=2; + int ydiv=1; + int i; + + if (argc>1) { + xadjust=atoi(argv[1]); + } + + if (argc>2) { + yadjust=atoi(argv[2]); + } + + if (debug) { + fprintf(stderr,"Using xdiv=%d add=%d xadjust=%d\n", + xdiv,add,xadjust); + } + + while(1) { + + ptr=fgets(buffer,1024,stdin); + if (ptr==NULL) break; + if (buffer[0]=='#') continue; + sscanf(buffer,"%d %d %d %d %d", + &a1,&a2,&a3,&a4,&a5); + if (debug) fprintf(stderr,"%d %d %d %d %d\n",a1,a2,a3,a4,a5); + if (a1==LINE_VALUE) { + output[out_ptr]=((a1)/xdiv)+add; + output[out_ptr+1]=((a2-xadjust)/xdiv)+add; + output[out_ptr+2]=((a3-yadjust)/ydiv)+add; + output[out_ptr+3]=((a4-xadjust)/xdiv)+add; + output[out_ptr+4]=((a5-yadjust)/ydiv)+add; + out_ptr+=5; + } + else if (a1==MODE_VALUE) { + output[out_ptr]=((a1-xadjust)/xdiv)+add; + out_ptr+=1; + } + else if (a1==STOP_VALUE) { + output[out_ptr]=((a1-xadjust)/xdiv)+add; + out_ptr+=1; + break; + } + else { + output[out_ptr]=((a1-xadjust)/xdiv)+add; + output[out_ptr+1]=((a2-yadjust)/ydiv)+add; + out_ptr+=2; + } + } + output[out_ptr-1]=0xff; + + for(i=0;iletter_d + sta INH + jsr draw_letter + + lda #62 + sta LETTER_X + lda #letter_e + sta INH + jsr draw_letter + + lda #110 + sta LETTER_X + lda #letter_s + sta INH + jsr draw_letter + + lda #154 + sta LETTER_X + lda #letter_i + sta INH + jsr draw_letter + + lda #176 + sta LETTER_X + lda #letter_r + sta INH + jsr draw_letter + + lda #220 + sta LETTER_X + lda #letter_e + sta INH + jsr draw_letter + + inc LETTER_Y + lda LETTER_Y + cmp #77 + bne logo_loop + + + +logo_done: + jmp skip_it + + + ;======================== + ; draw letter + ;======================== + ; so inefficient + ; letter to draw in INL:INH + +draw_letter: + + ldy #0 ; iterator +letter_loop: + lda (INL),Y + + cmp #$FF + beq letter_done + + cmp #$8D + bne hplot_to +hplot: + iny + + lda (INL),Y ; get X value + asl ; need to multiply by 2 + clc + adc LETTER_X + tax ; put in X + + iny ; point to Y value + + tya ; save Y value on stack for later + pha + + lda (INL),Y ; get Y value + clc + adc LETTER_Y + + ldy #0 ; set top of X value (FIXME) + + jsr HPLOT0 ; plot at (Y,X), (A) + + pla ; restore pointer + tay + + iny + +hplot_to: + + lda (INL),Y + asl + clc + adc LETTER_X + sta TEMP + + lda #0 + adc #0 + tax + + iny + + tya + pha + + lda (INL),Y + clc + adc LETTER_Y + tay + + lda TEMP + + jsr HGLIN ; line to (X,A),(Y) + + pla + tay + + iny + + jmp letter_loop +letter_done: + rts + +skip_it: diff --git a/demos/demosplash2022/zp.inc b/demos/demosplash2022/zp.inc new file mode 100644 index 00000000..021460b0 --- /dev/null +++ b/demos/demosplash2022/zp.inc @@ -0,0 +1,37 @@ +; zero page + +; pre-defined applesoft vars + +CH = $24 +CV = $25 +GBASL = $26 +GBASH = $27 +BASL = $28 +BASH = $29 + +AY_REGS = $70 + +SONG_L = $80 +SONG_H = $81 +SONG_OFFSET = $82 +SONG_COUNTDOWN = $83 +OCTAVE = $84 +REGISTER = $85 + +OUR_ROT = $A5 + +HGR_X = $E0 +HGR_XH = $E1 +HGR_Y = $E2 +HGR_COLOR = $E4 +HGR_PAGE = $E6 +HGR_SCALE = $E7 + +LETTER_X = $F8 +LETTER_Y = $F9 +COUNT = $FA +FRAME = $FB +WHICH_TRACK = $FC +INL = $FD +INH = $FE +TEMP = $FF diff --git a/music/tiny_tracker6/amp.s b/music/tiny_tracker6/amp.s new file mode 100644 index 00000000..23daa326 --- /dev/null +++ b/music/tiny_tracker6/amp.s @@ -0,0 +1,78 @@ +; pattern 0 +; 0 -> F +; 48-> C +; 50-> A +; 52-> 9 +; 54-> 8 +; 56-> 7 +; 58-> 6 +; 60-> 5 +; 62-> 4 +.byte $FF,$FF,$FF,$2C,$2A,$29,$28,$27,$26,$25,$24 + +; pattern 1 +; 0 -> F +; 9 -> C +;10 -> F +;20 -> C +;22 -> F +;29 -> C +;30 -> F +;31 -> C +;32 -> F +;40 -> C +; 48-> A +; 50-> 9 +; 52-> 8 +; 54-> 7 +; 56-> 6 +; 58-> 5 +; 60-> 4 +; 62-> 3 +.byte $9F,$1C,$AF,$2C,$7F,$1C,$1F,$1C,$8F,$8C,$2A,$29,$28,$27,$26,$25,$24,$23 + +; pattern 2 +; 0 ->F +; 13->C +; 14->F +; 15->C +; 16->F +; 24->C +; 26->9 +; 28->8 +; 30->7 +; 32->F +; 45->C +; 46->F +; 47->C +; 48->F +; 56->C +; 58->9 +; 60->7 +; 62->6 +.byte $DF,$1C,$1F,$1C,$8F,$2C,$29,$28,$27,$DF,$1C,$1F,$1C,$8F,$2C,$29,$27,$26 + +; pattern3 +; 0->F +; 24->C +; 26->9 +; 28->8 +; 30->7 +; 32->F +; 45->C +; 46->F +; 47->C +; 48->F +; 56->C +; 58->9 +; 60->7 +; 62->6 +.byte $FF,$8F,$2C,$29,$28,$27,$DF,$1C,$1F,$1C,$8F,$2C,$29,$27,$26 + +; pattern4 +; 0->0 +; 60->F +; 61->C +; 62->F +; 63->C +.byte $F0,$F0,$F0,$C0,$1F,$1C,$1F,$1C