diff --git a/xmas_2018/Makefile b/xmas_2018/Makefile index 6dee6596..293bbe3b 100644 --- a/xmas_2018/Makefile +++ b/xmas_2018/Makefile @@ -7,35 +7,21 @@ PNG_TO_RLE = ../gr-utils/png2rle all: xmas2018.dsk -xmas2018.dsk: wreath.img -# $(DOS33) -y xmas2018.dsk BSAVE -a 0x4000 XMAS2018 +xmas2018.dsk: XMAS2018 wreath.img + $(DOS33) -y xmas2018.dsk BSAVE -a 0x4000 XMAS2018 $(DOS33) -y xmas2018.dsk BSAVE -a 0x2000 wreath.img WREATH.IMG #### -MEGADEMO: megademo.o - ld65 -o MEGADEMO megademo.o -C ../linker_scripts/apple2_4000.inc +XMAS2018: xmas2018.o + ld65 -o XMAS2018 xmas2018.o -C ../linker_scripts/apple2_4000.inc -megademo.o: megademo.s \ +xmas2018.o: xmas2018.s \ zp.inc hardware.inc \ - gr_hline.s gr_offsets.s vapor_lock.s delay_a.s wait_keypress.s \ + vapor_lock.s delay_a.s wait_keypress.s \ mockingboard.s \ - c64_opener.s c64.img.lz4 \ - falling_apple.s apple_40_96.inc \ - starring.s starring1.inc starring2.inc starring3.img.lz4\ - starring_people.s sp_names.inc fs.inc FS_HGRC.BIN.lz4 \ - deater.inc DEATER_HGRC.BIN.lz4 lg.inc LG_HGRC.BIN.lz4 \ - check_email.s email_40_96.inc \ - leaving.s leaving.inc tfv_sprites.inc \ - arrival.s arrival.inc \ - bird_mountain.s letters.s \ - waterfall.s waterfall_page1.inc waterfall_page2.inc \ - takeoff.s takeoff.inc takeoff.img.lz4 \ - mode7.s \ - space_bars.s text_print.s \ - fireworks.s fw_background.inc fw_state_machine.s fw.s \ - hgr.s random16.s move_letters.s - ca65 -o megademo.o megademo.s -l megademo.lst + wreath.img.lz4 + ca65 -o xmas2018.o xmas2018.s -l xmas2018.lst #### diff --git a/xmas_2018/hardware.inc b/xmas_2018/hardware.inc new file mode 100644 index 00000000..69ea5b93 --- /dev/null +++ b/xmas_2018/hardware.inc @@ -0,0 +1,84 @@ +;; 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 +PAGE0 = $C054 +PAGE1 = $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 + +;; 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 +SETCOL = $F864 ;; COLOR=A +TEXT = $FB36 +TABV = $FB5B ;; VTAB to A +BASCALC = $FBC1 ;; +VTAB = $FC22 ;; VTAB to CV +HOME = $FC58 ;; Clear the text screen +WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us +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/xmas_2018/hello.bas b/xmas_2018/hello.bas new file mode 100644 index 00000000..91addeae --- /dev/null +++ b/xmas_2018/hello.bas @@ -0,0 +1,10 @@ + 5 PRINT "VMW PRODUCTIONS 2018 CHRISTMAS DEMO" + 10 PRINT + 10 PRINT "ONLY 22 YEARS SINCE THE LAST ONE" + 20 PRINT + 30 PRINT "* CODE: DEATER" + 40 PRINT "* DISK/LZ4: QKUMBA" + 50 PRINT "* MUSIC: F. MENDELSSOHN" + 60 PRINT "* PICTURES: " + 90 PRINT: X=PEEK(49237) + 100 PRINT CHR$ (4)"BRUN XMAS2018" diff --git a/xmas_2018/mockingboard.s b/xmas_2018/mockingboard.s new file mode 100644 index 00000000..bb47812c --- /dev/null +++ b/xmas_2018/mockingboard.s @@ -0,0 +1,209 @@ +; ZP addresses + +; left channel +MOCK_6522_1_ORB = $C400 ; 6522 #1 port b data +MOCK_6522_1_ORA = $C401 ; 6522 #1 port a data +MOCK_6522_1_DDRB = $C402 ; 6522 #1 data direction port B +MOCK_6522_1_DDRA = $C403 ; 6522 #1 data direction port A +MOCK_6522_1_T1C_L = $C404 ; 6522 #1 Low-order counter +MOCK_6522_1_T1C_H = $C405 ; 6522 #1 High-order counter +MOCK_6522_1_T1L_L = $C406 ; 6522 #1 Low-order latch +MOCK_6522_1_T1L_H = $C407 ; 6522 #1 High-order latch +MOCK_6522_1_T2C_L = $C408 ; 6522 #1 Timer2 Low-order Latch/Counter +MOCK_6522_1_T2C_H = $C409 ; 6522 #1 Timer2 High-order Latch/Counter +MOCK_6522_1_SR = $C40A ; 6522 #1 Shift Register +MOCK_6522_1_ACR = $C40B ; 6522 #1 Auxiliary Control Register +MOCK_6522_1_PCR = $C40C ; 6522 #1 Peripheral Control Register +MOCK_6522_1_IFR = $C40D ; 6522 #1 Interrupt Flag Register +MOCK_6522_1_IER = $C40E ; 6522 #1 Interrupt Enable Register +MOCK_6522_1_ORAN = $C40F ; 6522 #1 port a data, no handshake + +; right channel +MOCK_6522_2_ORB = $C480 ; 6522 #2 port b data +MOCK_6522_2_ORA = $C481 ; 6522 #2 port a data +MOCK_6522_2_DDRB = $C482 ; 6522 #2 data direction port B +MOCK_6522_2_DDRA = $C483 ; 6522 #2 data direction port A +MOCK_6522_2_T1C_L = $C484 ; 6522 #2 Low-order counter +MOCK_6522_2_T1C_H = $C485 ; 6522 #2 High-order counter +MOCK_6522_2_T1L_L = $C486 ; 6522 #2 Low-order latch +MOCK_6522_2_T1L_H = $C487 ; 6522 #2 High-order latch +MOCK_6522_2_T2C_L = $C488 ; 6522 #2 Timer2 Low-order Latch/Counter +MOCK_6522_2_T2C_H = $C489 ; 6522 #2 Timer2 High-order Latch/Counter +MOCK_6522_2_SR = $C48A ; 6522 #2 Shift Register +MOCK_6522_2_ACR = $C48B ; 6522 #2 Auxiliary Control Register +MOCK_6522_2_PCR = $C48C ; 6522 #2 Peripheral Control Register +MOCK_6522_2_IFR = $C48D ; 6522 #2 Interrupt Flag Register +MOCK_6522_2_IER = $C48E ; 6522 #2 Interrupt Enable Register +MOCK_6522_2_ORAN = $C48F ; 6522 #2 port a data, no handshake + + +; AY-3-8910 commands on port B +; RESET BDIR BC1 +MOCK_AY_RESET = $0 ; 0 0 0 +MOCK_AY_INACTIVE = $4 ; 1 0 0 +MOCK_AY_READ = $5 ; 1 0 1 +MOCK_AY_WRITE = $6 ; 1 1 0 +MOCK_AY_LATCH_ADDR = $7 ; 1 1 1 + + + ;======================== + ; Mockingboard Init + ;======================== + ; Initialize the 6522s + ; set the data direction for all pins of PortA/PortB to be output + +mockingboard_init: + lda #$ff ; all 8 pins output (1), portA + + sta MOCK_6522_1_DDRA + sta MOCK_6522_2_DDRA + ; only 3 pins output (1), port B + lda #$7 + sta MOCK_6522_1_DDRB + + sta MOCK_6522_2_DDRB + + +reset_ay_both: + ;====================== + ; Reset Left AY-3-8910 + ;====================== +reset_ay_left: + lda #MOCK_AY_RESET + sta MOCK_6522_1_ORB + lda #MOCK_AY_INACTIVE + sta MOCK_6522_1_ORB + + ; AY-3-8913: Wait 5 us + nop + nop + nop + nop + nop + + ;====================== + ; Reset Right AY-3-8910 + ;====================== +reset_ay_right: + lda #MOCK_AY_RESET + sta MOCK_6522_2_ORB + lda #MOCK_AY_INACTIVE + sta MOCK_6522_2_ORB + + ; AY-3-8913: Wait 5 us + nop + nop + nop + nop + nop + + ;========================= + ; Setup initial conditions + ;========================= + + ; 7: ENABLE + ldx #7 + lda #$38 ; noise disabled, ABC enabled + sta MB_VALUE + jsr write_ay_both + + ;========================= + ; Setup Interrupt Handler + ;========================= + ; Vector address goes to 0x3fe/0x3ff + ; FIXME: should chain any existing handler + + lda #interrupt_handler + sta $03ff + + ;============================ + ; Enable 60Hz clock on 6522 + ;============================ + + sei ; disable interrupts just in case + + lda #$40 ; Continuous interrupts, don't touch PB7 + sta $C40B ; ACR register + lda #$7F ; clear all interrupt flags + sta $C40E ; IER register (interrupt enable) + + lda #$C0 + sta $C40D ; IFR: 1100, enable interrupt on timer one oflow + sta $C40E ; IER: 1100, enable timer one interrupt + + lda #$1a + sta $C404 ; write into low-order latch + lda #$41 + sta $C405 ; write into high-order latch, + ; load both values into counter + ; clear interrupt and start counting + + ; 9c40 / 1e6 = .040s, 25Hz + ; 4fe7 / 1e6 = .020s, 50Hz + ; 411a / 1e6 = .016s, 60Hz + + rts + +interrupt_handler: + ; A saved by firmware in $45 +; sta $45 + txa + pha ; save X + tya + pha ; save Y + + bit $C404 ; clear 6522 interrupt by reading T1C-L ; 4 + + jsr play_music + + pla + tay ; restore Y + pla + tax ; restore X + lda $45 ; restore A + + rti ; return from interrupt ; 6 + + + ;========================================= + ; Write Right/Left to save value AY-3-8910 + ;========================================= + ; register in X + ; value in MB_VALUE + +write_ay_both: + ; address + stx MOCK_6522_1_ORA ; put address on PA1 ; 4 + stx MOCK_6522_2_ORA ; put address on PA2 ; 4 + lda #MOCK_AY_LATCH_ADDR ; latch_address on PB1 ; 2 + sta MOCK_6522_1_ORB ; latch_address on PB1 ; 4 + sta MOCK_6522_2_ORB ; latch_address on PB2 ; 4 + lda #MOCK_AY_INACTIVE ; go inactive ; 2 + sta MOCK_6522_1_ORB ; 4 + sta MOCK_6522_2_ORB ; 4 + ;=========== + ; 28 + ; value + lda MB_VALUE ; 3 + sta MOCK_6522_1_ORA ; put value on PA1 ; 4 + sta MOCK_6522_2_ORA ; put value on PA2 ; 4 + lda #MOCK_AY_WRITE ; ; 2 + sta MOCK_6522_1_ORB ; write on PB1 ; 4 + sta MOCK_6522_2_ORB ; write on PB2 ; 4 + lda #MOCK_AY_INACTIVE ; go inactive ; 2 + sta MOCK_6522_1_ORB ; 4 + sta MOCK_6522_2_ORB ; 4 + ;=========== + ; 31 + + rts ; 6 + ;=========== + ; 65 + +mockingboard_mute: + ldx #7 + lda #$ff + sta MB_VALUE + jmp write_ay_both diff --git a/xmas_2018/vapor_lock.s b/xmas_2018/vapor_lock.s new file mode 100644 index 00000000..fb9ceb3b --- /dev/null +++ b/xmas_2018/vapor_lock.s @@ -0,0 +1,240 @@ +; This took a while to track down +; On Apple II/II+ the horiz blanking addr are $1000 higher than on IIe +; So on II+ were outside video area, so unlikely to be our set value +; (unless I foolishly use $ff which some uninitialized mem is set to) +; Lots of this color fiddling is to make sure you don't accidentally +; get runs of colors on IIe due to the horiz blank + +; 0-5 aqua 6-12 = grey, 13 - 20 = yellow, 21-23 = aqua rainbow 14 +; +; +;16 0 YA +;17 1 YA +;18 2 YA +;19 3 YA +;20 4 YA +;21 5 AA +;22 6 AG +;23 7 AG +;0 8 AG +;1 9 AG +;2 10 AG +;3 11 AG +;4 12 AG +;5 13 AY **** +;6 14 GY RAINBOW +;7 15 GY +;8 16 GY +;9 17 GY +;10 18 GY +;11 19 GY +;12 20 GY +;13 21 YA +;14 22 YA +;15 23 YA + + + + ;============================== + ; setup graphics for vapor lock + ;============================== +vapor_lock: + + ; Clear Page0 + lda #$0 + sta DRAW_PAGE + lda #$ee ; full screen white $ff + jsr clear_gr + + lda #$dd + ldy #40 + jsr clear_page_loop ; make bottom half yellow $dd + + lda #$aa + ldy #24 + jsr clear_page_loop ; make middle grey2 $aa + + lda #$ee + ldy #10 + jsr clear_page_loop ; make top half aqua $ee + + ; set up a rainbow to aid in exact lock + + ldy #00 +rainbow_loop: + tya + sta $728+20,Y + iny + cpy #20 + bne rainbow_loop + +;btt: +; jmp btt + + + ;===================================================== + ; attempt vapor lock + ; by reading the "floating bus" we can see most recently + ; written value of the display + ;===================================================== + ; See: + ; Have an Apple Split by Bob Bishop + ; Softalk, October 1982 + + ; Challenges: each scan line scans 40 bytes. + ; The blanking happens at the *beginning* + ; So 65 bytes are scanned, starting at adress of the line - 25 + + ; the scan takes 8 cycles, look for 4 repeats of the value + ; to avoid false positive found if the horiz blanking is mirroring + ; the line (max 3 repeats in that case) + +vapor_lock_loop: + + ; first make sure we have a full line of $aa + + lda #$aa ; 2 +zxloop: + ldx #$04 ; 2 +wiloop: + cmp $C051 ; read the floating bus ; 4 + bne zxloop ; if not, start from scratch ; 2/3 + dex ; we were, dec ; 2 + bne wiloop ; if not 4 of them, restart ; 3/2 + + ; if we get here we read 4 proper pixels, 11 apart (2+4+2+2+3) + ; 0 11 22 33, clock at 34 + ; 1 12 23 34, clock at 35 + ; 2 13 24 35, clock at 36 + ; 3 14 25 36, clock at 37 + ; 4 15 26 37, clock at 38 + ; 5 16 27 38, clock at 39 + ; 6 17 28 39, clock at 40 + + +; X X X X +; X X X X +; X X X X +; X X X X +; X X X X +; X X X X +; X X X X +; 0123456789012345678901234 0123456789012345678901234567890123456789 +; 1 2 1 2 3 +; hsync pixels +; XXXXXXXXXXXXXXXXXXXXXXXXX 4444444444444444444444444444440123456789 + + ; now look for the color change that + ; happens at line 13*8 = 104 + + lda #$dd ; 2 +zloop: + ldx #$04 ; 2 +qloop: + cmp $C051 ; read floating bus ; 4 + bne zloop ; 2/3 + dex ; 2 + bne qloop ; 3/2 + ;============ + ; 11 + + ; Found it! + ; if we get here we read 4 proper pixels, 11 apart (2+4+2+2+3) + ; 0 11 22 33, clock at 34 + ; 1 12 23 34, clock at 35 + ; 2 13 24 35, clock at 36 + ; 3 14 25 36, clock at 37 + ; 4 15 26 37, clock at 38 + ; 5 16 27 38, clock at 39 + ; 6 17 28 39, clock at 40 + + + + +;btt: +; jmp btt + + ; In theory near end of line 104 + + ; now skip ahead 8 lines and read from the rainbow pattern we set + ; up to find our exact location + + ; delay 65 * 8 = 520 + ; we back off a few to make sure we're not in the horiz blank + ; try to delay 510 + + ; *NOTE* sometimes we end up going one (or rarely, two??) lines too far + ; so instead try going 7 lines ahead, and if still dd then one more + + ; so single step until we get a rainbow color + + ; go to next line, -10 + lda #28 ; 2 + jsr delay_a ; delay 25+28 = 53 + ; total delay = 55 + +vl_try_again: + lda #29 ; 2 + jsr delay_a ; delay 25+29 = 54 + ; total delay = 56 + + + + lda $C051 ; 4 + cmp #$dd ; 2 + beq vl_try_again ; 3 + ; -1 + + + ; now near end of line 112 + ;lda $0 ; nop to match old code ; 3 +; nop ; nop to match old code ; 2 + + lda $C051 ; 4 +;kbb: +; jmp kbb + + ; we are in theory on line $728 = 14*8 = 112 + ; so 112*65 = 7280 cycles from start + + ; we are actualy 25+20+A pixels in + ; 7325+A + + ; Our goal is line 114 at 7410 cycles + ; 7410 - 7325 = 85 + + ; so kill 85-A cycles + ; -6 to do subtraction + ; -6 for rts + ; -25 for delay_a overhead + + ; +1 for fallthrough from previous loop? + + eor #$ff ; 2 + sec ; 2 + adc #48 ; 2 + + jsr delay_a ; should total 48 cycles + + +done_vapor_lock: + rts ; 6 + + + + + ; Some random related work + ; Docs: + ; Lancaster + ; Bishop + ; Sather + + ; Vaguely relevant but no help with the Apple II+ issue + ; + ; Eamon: Screen display and timing synchronization + ; on the Apple IIe and Apple IIgs + ; + ; Adams: Visually presented verbal stimuli by assembly + ; language on the Apple II computer. + ; Cavanagh and Anstis: Visual psychophysics on the + ; Apple II: Getting started diff --git a/xmas_2018/wreath.s b/xmas_2018/wreath.s new file mode 100644 index 00000000..d0d2054b --- /dev/null +++ b/xmas_2018/wreath.s @@ -0,0 +1,659 @@ +;===================================== +; XMAS2018 -- Wreath Part +;===================================== + + +wreath: + + ;=================== + ; init screen + + ;=================== + ; init vars + lda #15 + sta XPOS + lda #38 + sta YPOS + + lda #0 + sta FRAME + sta FRAMEH + + ;============================= + ; Load graphic hgr + + lda #sb_background_hgr + sta LZ4_SRC+1 + + lda #<(sb_background_hgr_end-8) ; skip checksum at end + sta LZ4_END + lda #>(sb_background_hgr_end-8) ; skip checksum at end + sta LZ4_END+1 + + lda #<$2000 + sta LZ4_DST + lda #>$2000 + sta LZ4_DST+1 + + jsr lz4_decode + + ;============================== + ; setup graphics for vapor lock + ;============================== + + jsr vapor_lock ; 6 + + ; vapor lock returns with us at beginning of hsync in line + ; 114 (7410 cycles), so with 5070 lines to go + + ; so we have 5070 + 4550 = 9620 to kill + + jsr gr_copy_to_current ; 6+ 9292 + + ; now we have 322 left + + ; GR part + bit LORES ; 4 + bit SET_GR ; 4 + bit FULLGR ; 4 + + ; 322 - 12 = 310 + ; - 3 for jmp + ; 307 + + ; Try X=9 Y=6 cycles=307 + + ldy #6 ; 2 +sbloopA:ldx #9 ; 2 +sbloopB:dex ; 2 + bne sbloopB ; 2nt/3 + dey ; 2 + bne sbloopA ; 2nt/3 + + jmp sb_begin_loop +.align $100 + + + ;================================================ + ; Spacebars Loop + ;================================================ + ; each scan line 65 cycles + ; 1 cycle each byte (40cycles) + 25 for horizontal + ; Total of 12480 cycles to draw screen + ; Vertical blank = 4550 cycles (70 scan lines) + ; Total of 17030 cycles to get back to where was + +sb_begin_loop: + +sb_display_loop: + + +; 1 2 3 +;0123456789012345678901234567890123456789 +;LEVEL: 6 LIVES: 2 SCORE: 01978 HI: 02018 + + ; 0-7 = text mode + ; 8-87 = hgr + ; 88 - 168 = split + ; 169 - 191 = gr + + + ; 8 lines of text mode + + + ldy #8 ; 2 + +sb_text_loop: + bit SET_TEXT ; 4 + lda #29 ; 2 + jsr delay_a ; 25+29 + + dey ; 2 + bne sb_text_loop ; 3 + ;================ + ; 65 + + + ; -1 + + +sb_hgr_loop: + ; delay 80*65 = 5200 + ; 2180 + ; -2 + ; +1 + ; -8 + ;========================= + ; 3011 + ; -1038 play_music + ;================================ + ; 1973 + + bit SET_GR ; 4 + bit HIRES ; 4 + + + + ; draw sprite at same time + lda #>ship_forward ; 2 + sta INH ; 3 + lda #ship_forward + sta INH + lda #ship_small + sta INH + lda #ship_tiny + sta INH + lda # + +.include "zp.inc" +.include "hardware.inc" + +; external routines + +play_music=$1000 +mockingboard_init=$1100 +mockingboard_mute=$11a1 + + +megademo_start: ; this should end up at $4000 + + ;=================== + ; Check for Apple II and patch + ;=================== + + lda $FBB3 ; IIe and newer is $06 + cmp #6 + beq apple_iie + + lda #$54 ; patch the check_email font code + sta ce_patch+1 + + +apple_iie: + + ;================== + ; Init mockingboard + ;================== + + lda #0 + sta MB_PATTERN + lda #$60 + sta MB_FRAME + + jsr mockingboard_init + + ;=================== + ; set graphics mode + ;=================== + jsr HOME + +; jsr space_bars + +; jsr arriving_there + +; jsr fireworks + + ; C64 Opening Sequence + + jsr c64_opener + + ; Falling Apple II + + jsr falling_apple + + ; Starring Screens + jsr starring + + jsr setup_people_fs + jsr starring_people + jsr setup_people_deater + jsr starring_people + jsr setup_people_lg + jsr starring_people + + ; E-mail arriving + jsr check_email + + ; Leaving house + jsr leaving_home + + ; Riding bird + jsr bird_mountain + + ; Waterfall + jsr waterfall + + ; Enter ship + jsr rocket_takeoff + + ; mode7 (???) + jsr mode7_flying + + ; Fly in space + jsr space_bars + + ; Arrive + jsr arriving_there + + ; Fireworks + jsr fireworks + + ;================== + ; Game over + ;================== + ; we never get here +;game_over_man: +; jmp game_over_man + + +.align $100 + .include "lz4_decode.s" + .include "c64_opener.s" + .include "falling_apple.s" + .include "gr_unrle.s" + .include "gr_copy.s" + .include "starring.s" + .include "starring_people.s" + .include "check_email.s" +.align $100 + .include "gr_offsets.s" + .include "gr_hline.s" + .include "vapor_lock.s" + .include "delay_a.s" +; .include "wait_keypress.s" + .include "random16.s" +.align $100 + .include "fireworks.s" + .include "hgr.s" + .include "bird_mountain.s" + .include "move_letters.s" +.align $100 + .include "gr_putsprite.s" + .include "mode7.s" + .include "space_bars.s" + .include "takeoff.s" + .include "leaving.s" + .include "arrival.s" + .include "waterfall.s" + .include "text_print.s" +.align $100 + .include "screen_split.s" + +;============================ +; Include Sprites +;============================ +.align $100 + .include "tfv_sprites.inc" + .include "mode7_sprites.inc" + +;================================= +; Include Text for Sliding Letters +; *DONT CROSS PAGES* +;================================= +.include "letters.s" + +;============================ +; Include Lores Graphics +; No Alignment Needed +;============================ + +; falling_apple +.include "apple_40_96.inc" + +; starring +.include "starring1.inc" +.include "starring2.inc" +.include "fs.inc" +.include "deater.inc" +.include "lg.inc" +.include "sp_names.inc" + +; e-mail +.include "email_40_96.inc" + +; leaving +.include "leaving.inc" + +; waterfall +.include "waterfall_page1.inc" +.include "waterfall_page2.inc" + +; takeoff +.include "takeoff.inc" + +; arrival +.include "arrival.inc" + +;background: +.include "fw_background.inc" + +;============================ +; Include Hires Graphics +; No Alignment Needed +; FIXME: we can save 8 bytes per file by stripping checksums off end +;============================ + +; starring +starring3: +.incbin "starring3.img.lz4",11 +starring3_end: +fs_hgr: +.incbin "FS_HGRC.BIN.lz4",11 +fs_hgr_end: +deater_hgr: +.incbin "DEATER_HGRC.BIN.lz4",11 +deater_hgr_end: +lg_hgr: +.incbin "LG_HGRC.BIN.lz4",11 +lg_hgr_end: + +; bird mountain +katahdin: +.incbin "KATC.BIN.lz4",11 ; skip the header +katahdin_end: + +; takeoff +takeoff_hgr: +.incbin "takeoff.img.lz4",11 +takeoff_hgr_end: + +; spacebars +sb_background_hgr: +.incbin "SB_BACKGROUNDC.BIN.lz4",11 +sb_background_hgr_end: + + + + diff --git a/xmas_2018/zp.inc b/xmas_2018/zp.inc new file mode 100644 index 00000000..4c4ad4b4 --- /dev/null +++ b/xmas_2018/zp.inc @@ -0,0 +1,168 @@ +;; Zero Page + +FRAMEBUFFER = $00 ; $00 - $0F + +;; LZ4 addresses + +LZ4_SRC = $00 +LZ4_DST = $02 +LZ4_END = $04 +COUNT = $06 +DELTA = $08 + +;; Zero page monitor routines addresses + +WNDLFT = $20 +WNDWDTH = $21 +WNDTOP = $22 +WNDBTM = $23 +CH = $24 +CV = $25 +GBASL = $26 +GBASH = $27 +BASL = $28 +BASH = $29 +H2 = $2C +V2 = $2D +MASK = $2E +COLOR = $30 + ;INVFLG = $32 + +; dos33 zero page = 26-2f, 35-38, 3e 3f 40-4d +; overlap applesoft 67-6a,6f,70,af,b0,ca-cd,d8 + + +; DOS33: Confirmed kills $68 + +RWTSL = $60 +RWTSH = $61 +DOSBUFL = $62 +DOSBUFH = $63 +FILEML = $64 +FILEMH = $65 + + +FRAME = $60 +FRAMEH = $61 +WAITING = $62 +LETTERL = $63 +LETTERH = $64 +LETTERX = $65 +LETTERY = $66 +LETTERD = $67 +LETTER = $68 +BLARGH = $69 + + ;FACTOR_I = $66 + ;FACTOR_F = $67 + ;DX_I = $68 + ;DX_F = $69 + ;SPACEX_I = $6A + ;SPACEX_F = $6B + ;CX_I = $6C + ;CX_F = $6D + ;DY_I = $6E + ;DY_F = $6F + + +ZPOS = $78 + +REGISTER_DUMP = $70 +A_FINE_TONE = $70 +A_COARSE_TONE = $71 +B_FINE_TONE = $72 +B_COARSE_TONE = $73 +C_FINE_TONE = $74 +C_COARSE_TONE = $75 +NOISE = $76 +ENABLE = $77 +A_VOLUME = $78 +B_VOLUME = $79 +C_VOLUME = $7A +ENVELOPE_FINE = $7B +ENVELOPE_COARSE = $7C +ENVELOPE_SHAPE = $7D + + +COPY_OFFSET = $7E +DECODER_STATE = $7F + + +REGISTER_DUMP2 = $80 +A_FINE_TONE2 = $80 +A_COARSE_TONE2 = $81 +B_FINE_TONE2 = $82 +B_COARSE_TONE2 = $83 +C_FINE_TONE2 = $84 +C_COARSE_TONE2 = $85 +NOISE2 = $86 +ENABLE2 = $87 +A_VOLUME2 = $88 +B_VOLUME2 = $89 +C_VOLUME2 = $8A +ENVELOPE_FINE2 = $8B +ENVELOPE_COARS2 = $8C +ENVELOPE_SHAPE2 = $8D +LYRICSL = $8E +LYRICSH = $8F + +FRAME_COUNT = $90 +MB_VALUE = $91 +MB_ADDRL = $91 +MB_ADDRH = $92 +DONE_PLAYING = $93 +MB_CHUNK_OFFSET = $94 +MB_FRAME = $94 +MB_PATTERN = $95 +CHUNKSIZE = $95 +LZ4_DONE = $96 +DECODE_ERROR = $97 +COPY_TIME = $98 +DECOMPRESS_TIME = $99 +TIME_TAKEN = $9A +LYRICS_ACTIVE = $9B +;FORTYCOL = $9C +CURSOR = $9D + +; More zero-page addresses +; we try not to conflict with anything DOS, MONITOR or BASIC related + + ;COLOR1 = $E0 + ;COLOR2 = $E1 + ;MATCH = $E2 +XX = $E3 +YY = $E4 +HGR_COLOR = $E4 + ;SHIPY = $E4 + ;YADD = $E5 + ;LOOP = $E6 + ;MEMPTRL = $E7 + ;MEMPTRH = $E8 + ;NAMEL = $E9 + ;NAMEH = $EA + ;NAMEX = $EB + ;CHAR = $EC +STATE = $ED +DISP_PAGE = $ED +DRAW_PAGE = $EE +OFFSET = $EF + + ;FIRST = $F0 + +LASTKEY = $F1 +PADDLE_STATUS = $F2 + +SPRITETEMP = $F2 +XPOS = $F3 +YPOS = $F4 +TEMP = $FA +TEMPY = $FB +INL = $FC +INH = $FD +OUTL = $FE +OUTH = $FF + + + + +