From a90d932f2857b26638d0e0acdd3fd193ccbe4ef5 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Sat, 13 Oct 2018 19:03:38 -0400 Subject: [PATCH] megademo: add in space_bars code --- megademo/Makefile | 1 + megademo/SB_BACKGROUNDC.BIN.lz4 | Bin 0 -> 1366 bytes megademo/megademo.s | 6 +- megademo/screen_split.s | 231 ++++++++++++ megademo/space_bars.s | 641 ++++++++++++++++++++++++++++++++ megademo/text_print.s | 59 +++ 6 files changed, 937 insertions(+), 1 deletion(-) create mode 100644 megademo/SB_BACKGROUNDC.BIN.lz4 create mode 100644 megademo/screen_split.s create mode 100644 megademo/space_bars.s create mode 100644 megademo/text_print.s diff --git a/megademo/Makefile b/megademo/Makefile index 56fe454b..71bf8e01 100644 --- a/megademo/Makefile +++ b/megademo/Makefile @@ -36,6 +36,7 @@ megademo.o: megademo.s \ waterfall.s gr_unrolled_copy.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 diff --git a/megademo/SB_BACKGROUNDC.BIN.lz4 b/megademo/SB_BACKGROUNDC.BIN.lz4 new file mode 100644 index 0000000000000000000000000000000000000000..0d9e230a4ff775d8a5dc3f0c83ae66a3b1c6696d GIT binary patch literal 1366 zcmXw(UuaWT9LIl2(&b~2WD>5hdmfO#WGXPz?VI&yHZ8QHVD&E7=wk;2f>$| zn`Whzj2jajJvU$~lshA8V{YtSRvnrDXvev%B+%)SJE~--i*4@y#I-O7?&M+j@q7M# z&gbyGmRAOQKYr`$Bb@*~WP(0XdC=Uhrd4?lxKEX&g=qmy;D|uqOk(4!M~0TJrtb>C z1#@x|LHEwPkFDT~BXDF|H2$4Ri4o6($1hK_LB5Pr0y1%8br7GX8cyvu^*C4_D&ZrI z*dVwv^F@{BzE$Nf5gZJoastJp?}AILleBVKk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_7kVfGj4JqrJSe~w7-AJffvb^rhX literal 0 HcmV?d00001 diff --git a/megademo/megademo.s b/megademo/megademo.s index 7f600fdc..eb4f0124 100644 --- a/megademo/megademo.s +++ b/megademo/megademo.s @@ -27,6 +27,8 @@ apple_iie: ;=================== jsr HOME + jsr space_bars + ; C64 Opening Sequence jsr c64_opener @@ -61,6 +63,7 @@ apple_iie: jsr mode7_flying ; Fly in space + jsr space_bars ; Arrive @@ -100,9 +103,10 @@ loop_forever: .align $100 .include "gr_putsprite.s" .include "mode7.s" + .include "space_bars.s" .include "takeoff.s" .include "waterfall.s" - + .include "text_print.s" ;============================ ; Include Sprites diff --git a/megademo/screen_split.s b/megademo/screen_split.s new file mode 100644 index 00000000..478eee2c --- /dev/null +++ b/megademo/screen_split.s @@ -0,0 +1,231 @@ +; how quickly can we call this? +; jump table, assuming size to split is in Y? + +; Autogenerate? As we want both HGR/TXT and HGR/GR versions? + + +; 4 NnNnNnNnNnNnNnNnBBBBbbbbNnNnNnNnNnNnNnNnRrrrrr +; 8 NnNnNnNnNnNnNnBBBBNnNnbbbbNnNnNnNnNnNnNnRrrrrr +; 12 NnNnNnNnNnNnBBBBNnNnNnNnbbbbNnNnNnNnNnNnRrrrrr +; 16 NnNnNnNnNnBBBBNnNnNnNnNnNnbbbbNnNnNnNnNnRrrrrr +; 20 NnNnNnNnBBBBNnNnNnNnNnNnNnNnbbbbNnNnNnNnRrrrrr +; 24 NnNnNnBBBBNnNnNnNnNnNnNnNnNnNnbbbbNnNnNnRrrrrr +; 28 NnNnBBBBNnNnNnNnNnNnNnNnNnNnNnNnbbbbNnNnRrrrrr +; 32 NnBBBBNnNnNnNnNnNnNnNnNnNnNnNnNnNnbbbbNnRrrrrr +; 36 BBBBNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnNnbbbbRrrrrr + +; add 23 each time? + + + ; 23 bytes in size? +split_4: + nop + nop + nop + nop + nop + nop + nop + nop + bit LORES + bit HIRES + nop + nop + nop + nop + nop + nop + nop + nop + rts + +split_8: + nop + nop + nop + nop + nop + nop + nop + bit LORES + nop + nop + bit HIRES + nop + nop + nop + nop + nop + nop + nop + rts + +split_12: + nop + nop + nop + nop + nop + nop + bit LORES + nop + nop + nop + nop + bit HIRES + nop + nop + nop + nop + nop + nop + rts + +split_16: + nop + nop + nop + nop + nop + bit LORES + nop + nop + nop + nop + nop + nop + bit HIRES + nop + nop + nop + nop + nop + rts + +split_20: + nop + nop + nop + nop + bit LORES + nop + nop + nop + nop + nop + nop + nop + nop + bit HIRES + nop + nop + nop + nop + rts + +split_24: + nop + nop + nop + bit LORES + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + bit HIRES + nop + nop + nop + rts + +split_28: + nop + nop + bit LORES + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + bit HIRES + nop + nop + rts + +split_32: + nop + bit LORES + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + bit HIRES + nop + rts + +split_36: + bit LORES + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + nop + bit HIRES + rts + + +ss_multiples: +; .byte 0,0,23,46,69,92,115,138,161,184 + .byte 184,184,161,138,115,92,69,46,23,0 + + ; 6 4 25+16+8+16 NNNNNNNN + ; 7 6 25+15+10+15 LNNNNNN + ; 8 8 25+14+12+14 NNNNNNN + ; 9 10 25+13+14+13 LNNNNN + ; 10 12 25+12+16+12 + ; 11 14 25+11+18+11 + ; 12 16 25+10+20+10 + ; 13 18 25+09+22+09 + ; 14 20 25+08+24+08 + ; 15 22 25+07+26+07 + ; 16 24 25+06+28+06 + ; 17 26 25+05+30+05 + ; 18 28 25+04+32+04 + ; 19 30 25+03+34+03 + ; 20 32 25+02+36+02 + ; 21 34 25+01+38+01 + diff --git a/megademo/space_bars.s b/megademo/space_bars.s new file mode 100644 index 00000000..c5fa1446 --- /dev/null +++ b/megademo/space_bars.s @@ -0,0 +1,641 @@ +;===================================== +; Rasterbars in Space +;===================================== + +; Zero Page +;FRAMEBUFFER = $00 ; $00 - $0F + +;; LZ4 addresses + +;LZ4_SRC = $00 +;LZ4_DST = $02 +;LZ4_END = $04 +;COUNT = $06 +;DELTA = $08 + +;CH = $24 +;CV = $25 +;GBASL = $26 +;GBASH = $27 +;BASL = $28 +;BASH = $29 +;MASK = $2E +;COLOR = $30 +;FRAME = $60 +FRAMEH = $61 +;BLARGH = $69 +ZPOS = $78 +;DRAW_PAGE = $EE +;LASTKEY = $F1 +;PADDLE_STATUS = $F2 +;XPOS = $F3 +;YPOS = $F4 +;TEMP = $FA +;TEMPY = $FB +;INL = $FC +;INH = $FD +;OUTL = $FE +;OUTH = $FF + +; Soft Switches +;KEYPRESS= $C000 +;KEYRESET= $C010 +;SET_GR = $C050 ; Enable graphics +;SET_TEXT= $C051 ; Enable text +;FULLGR = $C052 ; Full screen, no text +;PAGE0 = $C054 ; Page0 +;PAGE1 = $C055 ; Page1 +;LORES = $C056 ; Enable LORES graphics +;HIRES = $C057 ; Enable HIRES graphics +;PADDLE_BUTTON0 = $C061 +;PADDL0 = $C064 +;PTRIG = $C070 + + + +; ROM routines + +;TEXT = $FB36 ;; Set text mode +;HOME = $FC58 ;; Clear the text screen +;WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us + + +;.include "../asm_routines/gr_unrle.s" +;.include "../asm_routines/keypress.s" +;.include "gr_copy.s" +;.include "title.s" +;.include "instructions.s" +;.include "game.s" +;.include "text_print.s" +;.include "game_over.s" +;.align $100 +;.include "vapor_lock.s" +;.include "delay_a.s" +;.include "lz4_decode.s" +;.align $100 +;.include "gr_putsprite.s" + +;.align $100 +;.include "mode7_sprites.inc" + + +space_bars: + + ;=================== + ; init screen + bit KEYRESET + + ;=================== + ; init vars + lda #15 + sta XPOS + lda #38 + sta YPOS + + lda #0 + sta FRAMEH + + ;============================= + ; Load graphic hgr + + lda #background_hgr + sta LZ4_SRC+1 + + lda #<(background_hgr_end-8) ; skip checksum at end + sta LZ4_END + lda #>(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 framebuffer + + lda #0 + sta ZPOS + +; lda #$12 +; sta FRAMEBUFFER+0 +; lda #$3f +; sta FRAMEBUFFER+1 +; lda #$56 +; sta FRAMEBUFFER+2 +; lda #$78 +; sta FRAMEBUFFER+3 +; lda #$9A +; sta FRAMEBUFFER+4 +; lda #$BC +; sta FRAMEBUFFER+5 +; lda #$DE +; sta FRAMEBUFFER+6 +; lda #$F0 +; sta FRAMEBUFFER+7 +; lda #$12 +; sta FRAMEBUFFER+8 +; lda #$3f +; sta FRAMEBUFFER+9 +; lda #$56 +; sta FRAMEBUFFER+10 +; lda #$78 +; sta FRAMEBUFFER+11 +; lda #$9A +; sta FRAMEBUFFER+12 + + + + + + + ;============================= + ; Load graphic page1 $800 + + lda #4 + sta DRAW_PAGE + + lda #$22 + jsr clear_gr + + + + + ;============================= + ; Load graphic page2 $c00 + + + lda #8 + sta DRAW_PAGE + + lda #$44 + jsr clear_gr + + + lda #score_text + sta OUTH + + jsr move_and_print + + + lda #0 + sta DRAW_PAGE + + ; GR part + bit PAGE0 + + + ;============================== + ; 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 + + bit SET_GR ; 4 + bit HIRES ; 4 + + + + ; draw sprite at same time + lda #>ship_forward ; 2 + sta INH ; 3 + lda #