From e55b1147387303db3d6816e2675bf9c7c1e432aa Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Sat, 12 Nov 2022 23:23:32 -0500 Subject: [PATCH] demo: add in apple logo --- demos/demosplash2022/Makefile | 3 +- demos/demosplash2022/apple_logo.s | 37 ++++++ demos/demosplash2022/apple_shape.s | 5 + demos/demosplash2022/draw_letter.s | 7 +- demos/demosplash2022/escape.s | 46 +++++-- demos/demosplash2022/freq.s | 22 ++++ demos/demosplash2022/freq_h.s | 22 ++++ demos/demosplash2022/hardware.inc | 7 +- demos/demosplash2022/logo_intro.s | 184 ++++++---------------------- demos/demosplash2022/mA2E_4.s | 112 +---------------- demos/demosplash2022/tracker_init.s | 3 +- demos/demosplash2022/zp.inc | 14 +-- 12 files changed, 182 insertions(+), 280 deletions(-) create mode 100644 demos/demosplash2022/apple_logo.s create mode 100644 demos/demosplash2022/apple_shape.s create mode 100644 demos/demosplash2022/freq.s create mode 100644 demos/demosplash2022/freq_h.s diff --git a/demos/demosplash2022/Makefile b/demos/demosplash2022/Makefile index 5962cc26..fa4f290b 100644 --- a/demos/demosplash2022/Makefile +++ b/demos/demosplash2022/Makefile @@ -42,7 +42,8 @@ ESCAPE: escape.o escape.o: escape.s \ logo_intro.s zp.inc \ ay3_write_regs.s escape.s interrupt_handler.s \ - play_frame.s \ + play_frame.s draw_letter.s freq.s freq_h.s bamps.s \ + apple_logo.s \ mA2E_4.s mockingboard_constants.s mockingboard_init.s tracker_init.s ca65 -o escape.o escape.s -l escape.lst diff --git a/demos/demosplash2022/apple_logo.s b/demos/demosplash2022/apple_logo.s new file mode 100644 index 00000000..9c89e63e --- /dev/null +++ b/demos/demosplash2022/apple_logo.s @@ -0,0 +1,37 @@ +draw_apple: + + ;============================= + ; draw apple shape table logo + ;============================= + ; rotation in A + + pha + lda #10 + sta HGR_SCALE + + ldy #0 + ldx #70 + lda #60 + + jsr HPOSN ; set screen position to X= (y,x) Y=(a) + + + + ldx #apple_table ; point to top byte of shape address + + ; ROT in A + + ; this will be 0 2nd time through loop, arbitrary otherwise + pla ; ROT + jmp DRAW0 ; XDRAW 1 AT X,Y + ; Both A and X are 0 at exit + ; Z flag set on exit + ; Y varies + + +;apple_table: +;.byte $27,$2c,$35,$8e,$24,$2c +;.byte $35,$be,$09,$24,$2c,$35,$be,$09 +;.byte $20,$24,$8c,$12,$2d,$3c,$37,$2e +;.byte $0d,$25,$24,$4f,$39,$36,$2e,$00 diff --git a/demos/demosplash2022/apple_shape.s b/demos/demosplash2022/apple_shape.s new file mode 100644 index 00000000..e0606bc5 --- /dev/null +++ b/demos/demosplash2022/apple_shape.s @@ -0,0 +1,5 @@ +apple_table: +.byte $27,$2c,$35,$8e,$24,$2c +.byte $35,$be,$09,$24,$2c,$35,$be,$09 +.byte $20,$24,$8c,$12,$2d,$3c,$37,$2e +.byte $0d,$25,$24,$4f,$39,$36,$2e,$00 diff --git a/demos/demosplash2022/draw_letter.s b/demos/demosplash2022/draw_letter.s index 9af37c06..20d39969 100644 --- a/demos/demosplash2022/draw_letter.s +++ b/demos/demosplash2022/draw_letter.s @@ -3,9 +3,10 @@ ;======================== ; so inefficient ; letter to draw in INL:INH + ; A is X offset draw_letter: - + sty LETTER_X ldy #$FF ; iterator letter_loop: @@ -13,7 +14,7 @@ letter_loop: hplot: ; setup X value - iny + iny ; skip the new-line indicator jsr get_x ; get adjusted x-coord in A @@ -21,7 +22,7 @@ hplot: ; setup Y value - jsr get_y + jsr get_y ; get adjusted y-coord in A ldy #0 ; set top of X value (FIXME) diff --git a/demos/demosplash2022/escape.s b/demos/demosplash2022/escape.s index 9bbee76d..79f535e3 100644 --- a/demos/demosplash2022/escape.s +++ b/demos/demosplash2022/escape.s @@ -9,13 +9,11 @@ apple2_desire: - ;================= - ; init vars + ; clear both pages of graphics + jsr HGR + jsr HGR2 - lda #0 ; TODO: move to ay init - sta FRAME - sta WHICH_TRACK - sta BAMP_COUNTDOWN + ; A and Y are 0 now? ;=================== ; music Player Setup @@ -28,20 +26,48 @@ apple2_desire: .include "tracker_init.s" - jsr HGR ; enable lo-res graphics + cli ; enable music .include "logo_intro.s" -game_loop: - jmp game_loop + ;======================== + ; flip pages forever +main_loop: + lda FRAME + and #$80 + clc + rol + rol + tax + lda PAGE1,X + jmp main_loop .include "interrupt_handler.s" .include "mockingboard_constants.s" +.include "apple_logo.s" + +.include "draw_letter.s" + +.include "freq.s" + +letters_x: + .byte 14,62,110,154,176,220 +letters_l: + .byte letter_d,>letter_e,>letter_s,>letter_i,>letter_r,>letter_e + +.include "bamps.s" + +.align $100 + +.include "freq_h.s" + ; logo letter_d: .include "./letters/d.inc" @@ -56,5 +82,5 @@ letter_r: ; music .include "mA2E_4.s" - +.include "apple_shape.s" diff --git a/demos/demosplash2022/freq.s b/demos/demosplash2022/freq.s new file mode 100644 index 00000000..a553db34 --- /dev/null +++ b/demos/demosplash2022/freq.s @@ -0,0 +1,22 @@ +; Octave 0 : 0 0 0 3 0 3 0 3 3 0 16 0 +; Octave 1 : 45 0 0 19 0 23 0 0 0 0 5 0 +; Octave 2 : 14 0 2 6 0 8 0 0 0 0 0 0 +; Octave 3 : 0 0 0 1 0 1 0 2 0 0 2 0 +; Octave 4 : 4 0 1 5 2 5 0 7 0 2 4 0 +; Octave 5 : 3 0 4 1 5 2 0 0 0 0 0 0 +; 30 notes allocated +;.byte 12,55,24,64,10,62,60,15,17,58,22,57,8,7,5,3,53,52,29,27,26,65,63,51,50,48,46,39,41,43, + +frequencies_low: +.byte $D1,$51,$E8,$30,$49,$36,$3D,$36 +.byte $DC,$44,$24,$48,$CF,$18,$B8,$6C +.byte $5B,$60,$6E,$9B,$B3,$2D,$33,$66 +.byte $6C,$7A,$89,$CD,$B7,$A3 + +;frequencies_high: +;.byte $03,$00,$01,$00,$04,$00,$00,$03 +;.byte $02,$00,$02,$00,$04,$05,$05,$06 +;.byte $00,$00,$01,$01,$01,$00,$00,$00 +;.byte $00,$00,$00,$00,$00,$00 +; total len=61 + diff --git a/demos/demosplash2022/freq_h.s b/demos/demosplash2022/freq_h.s new file mode 100644 index 00000000..98c115ff --- /dev/null +++ b/demos/demosplash2022/freq_h.s @@ -0,0 +1,22 @@ +; Octave 0 : 0 0 0 3 0 3 0 3 3 0 16 0 +; Octave 1 : 45 0 0 19 0 23 0 0 0 0 5 0 +; Octave 2 : 14 0 2 6 0 8 0 0 0 0 0 0 +; Octave 3 : 0 0 0 1 0 1 0 2 0 0 2 0 +; Octave 4 : 4 0 1 5 2 5 0 7 0 2 4 0 +; Octave 5 : 3 0 4 1 5 2 0 0 0 0 0 0 +; 30 notes allocated +;.byte 12,55,24,64,10,62,60,15,17,58,22,57,8,7,5,3,53,52,29,27,26,65,63,51,50,48,46,39,41,43, + +;frequencies_low: +;.byte $D1,$51,$E8,$30,$49,$36,$3D,$36 +;.byte $DC,$44,$24,$48,$CF,$18,$B8,$6C +;.byte $5B,$60,$6E,$9B,$B3,$2D,$33,$66 +;.byte $6C,$7A,$89,$CD,$B7,$A3 + +frequencies_high: +.byte $03,$00,$01,$00,$04,$00,$00,$03 +.byte $02,$00,$02,$00,$04,$05,$05,$06 +.byte $00,$00,$01,$01,$01,$00,$00,$00 +.byte $00,$00,$00,$00,$00,$00 +; total len=61 + diff --git a/demos/demosplash2022/hardware.inc b/demos/demosplash2022/hardware.inc index 2143a408..7b2498b8 100644 --- a/demos/demosplash2022/hardware.inc +++ b/demos/demosplash2022/hardware.inc @@ -30,10 +30,13 @@ 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) +DRAW0 = $F601 +XDRAW0 = $F65D +XDRAW1 = $F661 + ;; MONITOR ROUTINES @@ -55,7 +58,7 @@ SETINV = $FE80 ;; INVERSE SETNORM = $FE84 ;; NORMAL COUT = $FDED ;; output A to screen COUT1 = $FDF0 ;; output A to screen - +RESTORE = $FF3F diff --git a/demos/demosplash2022/logo_intro.s b/demos/demosplash2022/logo_intro.s index 273d11bd..850dded6 100644 --- a/demos/demosplash2022/logo_intro.s +++ b/demos/demosplash2022/logo_intro.s @@ -1,169 +1,63 @@ ;================================ ; draw the sorta vectored logo ;================================ - ; 908 bytes -- first display ; 916 bytes -- scroll down ; 914 bytes -- assume < 256 co-ords ; 908 bytes -- assume first co-oord is an HPLOT ; 906 bytes -- save value on stack rather than ZP +; discontinuity when improving the sound code +; 2BD bytes -- after really optimizing the draw code show_logo: - lda #76 + lda #77 sta LETTER_Y -logo_loop: ldx #7 jsr HCOLOR1 ; set color - lda #14 - sta LETTER_X + jsr draw_logo - lda #letter_d sta INH + ldy letters_x,X + txa + pha 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 - + pla + tax + dex + bpl letter_time + rts logo_done: - jmp skip_it - - - - ;======================== - ; draw letter - ;======================== - ; so inefficient - ; letter to draw in INL:INH - -draw_letter: - - ldy #$FF ; iterator -letter_loop: - - -hplot: - - ; setup X value - - iny - - lda (INL),Y ; get X value - asl ; need to multiply by 2 - clc - adc LETTER_X - tax ; put in X - - ; setup Y value - - iny ; point to Y value - - sty SAVE_Y ; save Y value on stack for later - - 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) - - ldy SAVE_Y ; restore pointer - - iny - -hplot_to: - - ; get X value - - lda (INL),Y ; get next value - asl ; mul by 2 - clc - adc LETTER_X ; add in offset - pha ; save for later - - lda #0 ; wrap if > 256 - adc #0 - tax - - ; get Y value - - iny - - sty SAVE_Y ; save Y value - - lda (INL),Y ; get next value - clc ; add Y offset - adc LETTER_Y - tay ; put into Y - - pla ; restore X value - - jsr HGLIN ; line to (X,A),(Y) - - ldy SAVE_Y - - iny - - ; see if at end of line or of whole thing - - lda (INL),Y ; get next value - - bmi letter_done ; if negative, we are done - - cmp #$7F - beq hplot - bne hplot_to - -letter_done: - rts - -skip_it: diff --git a/demos/demosplash2022/mA2E_4.s b/demos/demosplash2022/mA2E_4.s index 161e4584..6572e503 100644 --- a/demos/demosplash2022/mA2E_4.s +++ b/demos/demosplash2022/mA2E_4.s @@ -1,118 +1,10 @@ -; Octave 0 : 0 0 0 3 0 3 0 3 3 0 16 0 -; Octave 1 : 45 0 0 19 0 23 0 0 0 0 5 0 -; Octave 2 : 14 0 2 6 0 8 0 0 0 0 0 0 -; Octave 3 : 0 0 0 1 0 1 0 2 0 0 2 0 -; Octave 4 : 4 0 1 5 2 5 0 7 0 2 4 0 -; Octave 5 : 3 0 4 1 5 2 0 0 0 0 0 0 -; 30 notes allocated -;.byte 12,55,24,64,10,62,60,15,17,58,22,57,8,7,5,3,53,52,29,27,26,65,63,51,50,48,46,39,41,43, -frequencies_low: -.byte $D1,$51,$E8,$30,$49,$36,$3D,$36 -.byte $DC,$44,$24,$48,$CF,$18,$B8,$6C -.byte $5B,$60,$6E,$9B,$B3,$2D,$33,$66 -.byte $6C,$7A,$89,$CD,$B7,$A3 - -frequencies_high: -.byte $03,$00,$01,$00,$04,$00,$00,$03,$02,$00,$02,$00,$04,$05,$05,$06,$00,$00,$01,$01,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00 -; total len=61 - -; pattern 0 -; 0 -> F -; 48-> C -; 50-> A -; 52-> 9 -; 54-> 8 -; 56-> 7 -; 58-> 6 -; 60-> 5 -; 62-> 4 -bamps0: -; 0 15 30 45 48 50 52 54 56 58 60 62 -.byte $FF,$FF,$FF,$3F,$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 -bamps1: -; 0 9 10 20 22 29 30 31 32 40 48 50 52 54 56 58 60 62 -.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 -bamps2: -; 0 13 14 15 16 24 26 28 30 32 45 46 47 48 56 58 60 62 -.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 -bamps3: -; 0 15 24 26 28 30 32 45 46 47 48 56 58 60 62 -.byte $FF,$9F,$2C,$29,$28,$27,$DF,$1C,$1F,$1C,$8F,$2C,$29,$27,$26 - -; pattern4 -; 0->0 -; 60->F -; 61->C -; 62->F -; 63->C - -bamps4: -; 0 15 30 45 60 61 62 63 -.byte $F0,$F0,$F0,$F0,$1F,$1C,$1F,$1C - - -.align $100 channel_a_volume: .byte 14,14,14,14,11,11,10,10 +.align $100 + lengths: .byte 0*8,1*8,2*8,4*8 diff --git a/demos/demosplash2022/tracker_init.s b/demos/demosplash2022/tracker_init.s index 7995a13e..c18b33e0 100644 --- a/demos/demosplash2022/tracker_init.s +++ b/demos/demosplash2022/tracker_init.s @@ -2,8 +2,9 @@ tracker_init: ; setup initial ay-3-8910 values (this depends on song) + ; claer out $70-$90 init_registers_to_zero: - ldx #$13 ; init registers to zero + ldx #$20 ; init registers to zero lda #0 init_loop: sta AY_REGS,X diff --git a/demos/demosplash2022/zp.inc b/demos/demosplash2022/zp.inc index 1cb87916..a30844e7 100644 --- a/demos/demosplash2022/zp.inc +++ b/demos/demosplash2022/zp.inc @@ -10,13 +10,13 @@ BASL = $28 BASH = $29 AY_REGS = $70 +; through = $7D -SONG_L = $80 -SONG_H = $81 -;SONG_OFFSET = $82 +FRAME = $80 +BAMP_COUNTDOWN = $81 +WHICH_TRACK = $82 SONG_COUNTDOWN = $83 -OCTAVE = $84 -REGISTER = $85 + OUR_ROT = $A5 @@ -27,13 +27,11 @@ HGR_COLOR = $E4 HGR_PAGE = $E6 HGR_SCALE = $E7 -BAMP_COUNTDOWN = $F6 + SAVE_Y = $F7 LETTER_X = $F8 LETTER_Y = $F9 COUNT = $FA -FRAME = $FB -WHICH_TRACK = $FC INL = $FD INH = $FE TEMP = $FF