diff --git a/data/charset.raw b/data/charset.raw new file mode 100644 index 0000000..e2ba547 Binary files /dev/null and b/data/charset.raw differ diff --git a/data/death.raw b/data/death.raw new file mode 100644 index 0000000..1bf861b Binary files /dev/null and b/data/death.raw differ diff --git a/includes/be_driver.asm b/includes/be_driver.asm new file mode 100644 index 0000000..01b3ec4 --- /dev/null +++ b/includes/be_driver.asm @@ -0,0 +1,145 @@ +; +; BEEPER ENGINE MUSIC DRIVER +; + + +; Reset the music driver +be_track_reset lda #$00 + sta be_pattn_cnt + +; Fetch the next pattern to play from track data +be_pattn_fetch ldx be_pattn_cnt + lda be_track_00,x + cmp #eod + beq be_track_reset + + asl + tax + lda be_pattn_pos+$00,x + sta be_pattn_read+$01 + lda be_pattn_pos+$01,x + sta be_pattn_read+$02 + + inc be_pattn_cnt + + rts + + +; Read the next byte of the pattern +be_pattn_read lda be_pattn_00 + cmp #eod + bne be_pattn_bump + + jsr be_pattn_fetch + jmp be_pattn_read + +be_pattn_bump inc be_pattn_read+$01 + bne *+$05 + inc be_pattn_read+$02 + rts + + +; Fetch and play the next note +be_pattn_play jsr be_pattn_read + tax + lda be_note_freqs,x + sta be_snd_freq + jsr be_pattn_read + sta be_snd_dur + + cpx #off + beq be_snd_off_play + +; Zapac's tone generator +be_snd_on_play lda speaker + ldx be_snd_freq +be_snd_on_loop dex + beq be_snd_on_play + nop + nop + dey + bne be_snd_on_loop + dec be_snd_dur + bne be_snd_on_loop + rts + +; Dummy loop for "off" (so the timing is the same) +be_snd_off_play nop + nop + ldx be_snd_freq +be_snd_off_loop dex + beq be_snd_off_play + nop + nop + dey + bne be_snd_off_loop + dec be_snd_dur + bne be_snd_off_loop + rts + + +; Note frequency table +be_note_freqs !byte $ff,$f1,$e3,$d6,$ca,$bf,$b4,$aa,$a1,$98,$8f,$87 + !byte $80,$79,$72,$6c,$66,$60,$5b,$55,$51,$4c,$48,$44 + !byte $40,$3c,$39,$36,$33,$30,$2d,$2b,$28,$26,$24,$22 + +; Note commands for the music data - x is a sharp +c_1 = $00 +cx1 = $01 +d_1 = $02 +dx1 = $03 +e_1 = $04 +f_1 = $05 +fx1 = $06 +g_1 = $07 +gx1 = $08 +a_1 = $09 +ax1 = $0a +b_1 = $0b + +c_2 = $0c +cx2 = $0d +d_2 = $0e +dx2 = $0f +e_2 = $10 +f_2 = $11 +fx2 = $12 +g_2 = $13 +gx2 = $14 +a_2 = $15 +ax2 = $16 +b_2 = $17 + +c_3 = $18 +cx3 = $19 +d_3 = $1a +dx3 = $1b +e_3 = $1c +f_3 = $1d +fx3 = $1e +g_3 = $1f +gx3 = $20 +a_3 = $21 +ax3 = $22 +b_3 = $23 + +off = $3f +eod = $ff + +; Duration commands for the music data +dur01 = $0e +dur02 = dur01*$02 +dur03 = dur01*$03 +dur04 = dur01*$04 +dur05 = dur01*$05 +dur06 = dur01*$06 +dur07 = dur01*$07 +dur08 = dur01*$08 +dur09 = dur01*$09 +dur0a = dur01*$0a +dur0b = dur01*$0b +dur0c = dur01*$0c +dur0d = dur01*$0d +dur0e = dur01*$0e +dur0f = dur01*$0f +dur10 = dur01*$10 diff --git a/includes/be_mps.asm b/includes/be_mps.asm new file mode 100644 index 0000000..4ae58f7 --- /dev/null +++ b/includes/be_mps.asm @@ -0,0 +1,164 @@ +; +; MICRPROSE SOCCER (INDOOR) - TUNE 9 +; + + +; Track data +be_track_00 !byte $00,$01,$00,$02,$00,$03,$00,$04 + !byte eod + +; Pattern reference table +be_pattn_pos !byte be_pattn_00 + !byte be_pattn_01 + !byte be_pattn_02 + !byte be_pattn_03 + !byte be_pattn_04 + +; Pattern data +be_pattn_00 !byte g_2,dur01 + !byte g_1,dur05 + !byte off,dur04 + !byte g_3,dur01 + !byte g_2,dur05 + !byte off,dur04 + !byte g_2,dur01 + !byte g_1,dur05 + !byte off,dur04 + !byte g_3,dur01 + !byte g_2,dur05 + !byte off,dur04 + !byte g_2,dur01 + !byte g_1,dur05 + !byte off,dur04 + !byte g_3,dur01 + !byte g_2,dur05 + !byte off,dur04 + !byte g_2,dur01 + !byte g_1,dur05 + !byte off,dur04 + !byte g_3,dur01 + !byte g_2,dur05 + !byte off,dur04 + !byte eod + +be_pattn_01 !byte g_2,dur01 + !byte g_1,dur05 + !byte off,dur04 + !byte g_3,dur01 + !byte g_2,dur05 + !byte off,dur04 + !byte g_2,dur01 + !byte g_1,dur05 + !byte off,dur04 + !byte g_3,dur01 + !byte g_2,dur05 + !byte off,dur04 + !byte g_2,dur01 + !byte g_1,dur05 + !byte off,dur04 + !byte g_3,dur01 + !byte g_2,dur05 + !byte off,dur04 + + !byte g_2,dur01 + !byte g_1,dur05 + !byte off,dur04 + !byte g_3,dur01 + !byte g_2,dur01 + !byte g_2,dur01 + !byte g_1,dur05 + !byte off,dur02 + !byte eod + +be_pattn_02 !byte g_2,dur01 + !byte g_1,dur05 + !byte off,dur04 + !byte g_3,dur01 + !byte g_2,dur05 + !byte off,dur04 + !byte g_2,dur01 + !byte g_1,dur05 + !byte off,dur04 + !byte g_3,dur01 + !byte g_2,dur05 + !byte off,dur04 + !byte g_2,dur01 + !byte g_1,dur05 + !byte off,dur04 + !byte g_3,dur01 + !byte g_2,dur05 + !byte off,dur04 + + !byte g_2,dur01 + !byte g_1,dur04 + !byte f_2,dur01 + !byte f_1,dur04 + !byte g_3,dur01 + !byte g_2,dur01 + !byte f_2,dur01 + !byte f_1,dur05 + !byte off,dur02 + !byte eod + +be_pattn_03 !byte g_2,dur01 + !byte g_1,dur05 + !byte off,dur04 + !byte g_3,dur01 + !byte g_2,dur05 + !byte off,dur04 + !byte g_2,dur01 + !byte g_1,dur05 + !byte off,dur04 + !byte g_3,dur01 + !byte g_2,dur05 + !byte off,dur04 + !byte g_2,dur01 + !byte g_1,dur05 + !byte off,dur04 + !byte g_3,dur01 + !byte g_2,dur05 + !byte off,dur04 + + !byte g_2,dur01 + !byte g_1,dur04 + !byte ax2,dur01 + !byte ax1,dur04 + !byte g_3,dur01 + !byte g_2,dur01 + !byte g_2,dur01 + !byte g_1,dur05 + !byte off,dur02 + !byte eod + +be_pattn_04 !byte g_2,dur01 + !byte g_1,dur05 + !byte off,dur04 + !byte g_3,dur01 + !byte g_2,dur05 + !byte off,dur04 + !byte g_2,dur01 + !byte g_1,dur05 + !byte off,dur04 + !byte g_3,dur01 + !byte g_2,dur05 + !byte off,dur04 + + !byte f_3,dur01 + !byte f_2,dur04 + !byte f_2,dur01 + !byte f_1,dur04 + !byte g_3,dur01 + !byte g_2,dur01 + !byte f_2,dur01 + !byte f_1,dur05 + !byte off,dur02 + !byte e_3,dur01 + !byte e_2,dur04 + !byte e_2,dur01 + !byte e_1,dur04 + !byte g_3,dur01 + !byte g_2,dur01 + !byte e_2,dur01 + !byte e_1,dur05 + !byte off,dur02 + !byte eod \ No newline at end of file diff --git a/includes/be_mps_alt.asm b/includes/be_mps_alt.asm new file mode 100644 index 0000000..a2036db --- /dev/null +++ b/includes/be_mps_alt.asm @@ -0,0 +1,111 @@ +; +; MICRPROSE SOCCER (INDOOR) - TUNE 9 +; + + +; Track data +be_track_00 !byte $00,$01,$00,$02,$00,$03,$00,$04 + !byte eod + +; Pattern reference table +be_pattn_pos !byte be_pattn_00 + !byte be_pattn_01 + !byte be_pattn_02 + !byte be_pattn_03 + !byte be_pattn_04 + +; Pattern data +be_pattn_00 !byte g_1,dur05 + !byte off,dur05 + !byte g_2,dur05 + !byte off,dur05 + !byte g_1,dur05 + !byte off,dur05 + !byte g_2,dur05 + !byte off,dur05 + !byte g_1,dur05 + !byte off,dur05 + !byte g_2,dur05 + !byte off,dur05 + !byte g_1,dur05 + !byte off,dur05 + !byte g_2,dur05 + !byte off,dur05 + !byte eod + +be_pattn_01 !byte g_1,dur05 + !byte off,dur05 + !byte g_2,dur05 + !byte off,dur05 + !byte g_1,dur05 + !byte off,dur05 + !byte g_2,dur05 + !byte off,dur05 + !byte g_1,dur05 + !byte off,dur05 + !byte g_2,dur05 + !byte off,dur05 + !byte g_1,dur05 + !byte off,dur05 + !byte g_2,dur02 + !byte g_1,dur05 + !byte off,dur03 + !byte eod + +be_pattn_02 !byte g_1,dur05 + !byte off,dur05 + !byte g_2,dur05 + !byte off,dur05 + !byte g_1,dur05 + !byte off,dur05 + !byte g_2,dur05 + !byte off,dur05 + !byte g_1,dur05 + !byte off,dur05 + !byte g_2,dur05 + !byte off,dur05 + !byte g_1,dur05 + !byte f_1,dur05 + !byte g_2,dur02 + !byte f_1,dur05 + !byte off,dur03 + !byte eod + +be_pattn_03 !byte g_1,dur05 + !byte off,dur05 + !byte g_2,dur05 + !byte off,dur05 + !byte g_1,dur05 + !byte off,dur05 + !byte g_2,dur05 + !byte off,dur05 + !byte g_1,dur05 + !byte off,dur05 + !byte g_2,dur05 + !byte off,dur05 + !byte g_1,dur05 + !byte ax1,dur05 + !byte g_2,dur02 + !byte g_1,dur05 + !byte off,dur03 + !byte eod + +be_pattn_04 !byte g_1,dur05 + !byte off,dur05 + !byte g_2,dur05 + !byte off,dur05 + !byte g_1,dur05 + !byte off,dur05 + !byte g_2,dur05 + !byte off,dur05 + !byte f_2,dur05 + !byte f_1,dur05 + !byte g_2,dur02 + !byte f_1,dur05 + !byte off,dur03 + !byte e_2,dur05 + !byte e_1,dur05 + !byte g_2,dur02 + !byte e_1,dur05 + !byte off,dur03 + !byte eod \ No newline at end of file diff --git a/includes/registers.asm b/includes/registers.asm new file mode 100644 index 0000000..28d3c34 --- /dev/null +++ b/includes/registers.asm @@ -0,0 +1,22 @@ +; SYSTEM EQUATES +kbd_read = $c000 +kbd_strobe_clr = $c010 + +rd_vbl_bar = $c019 + + +; Speaker toggle +speaker = $c030 + + +; Mode controllers +txtclr = $c050 ; select bitmap mode +txtset = $c051 ; select text mode +mixclr = $c052 ; full screen +mixset = $c053 ; split screen (last four lines are text) + +txtpage1 = $c054 ; select text buffer 1 ($0400) +txtpage2 = $c055 ; select text buffer 2 ($0x00) + +lores = $c056 ; display low res graphics +hires = $c057 ; display high res graphics \ No newline at end of file diff --git a/septic#060812 b/septic#060812 new file mode 100644 index 0000000..25dceff Binary files /dev/null and b/septic#060812 differ diff --git a/septic.asm b/septic.asm new file mode 100644 index 0000000..508a1e9 --- /dev/null +++ b/septic.asm @@ -0,0 +1,182 @@ +; +; SEPTIC +; + + +; Code, graphics, wiring and music driver by T.M.R/Cosine +; Beeper code by Zapac +; Original music by Martin Galway + +; Built around a simple, one channel music driver originally based on the +; code and frequncy tables from http://eightbitsoundandfury.ld8.org/ +; which was then updated to use Zapac's tidier reworking of that code. + + +; This source code is formatted for the ACME cross assembler from +; http://sourceforge.net/projects/acme-crossass/ + + +; Select an output filename + !to "septic#060812",plain + + +; Standard A2 register declarations + !src "includes/registers.asm" + +; Beeper sound labels +be_snd_freq = $03f0 +be_snd_dur = $03f1 +be_pattn_cnt = $03f2 + +; Demo labels +text_tmr = $03f3 + +text_bmp = $2000 + + +; Yank in binary data + * = $2000 + !binary "data/death.raw" + +font_data !binary "data/charset.raw" + + +; Set origin point (must be the same as the last four bytes of !to) + * = $0812 + +; Code entry point +entry jsr be_track_reset + jsr reset + +; Enable bitmapped graphics mode + lda #$00 + sta txtclr + sta hires + + +; The main loop of the demo +main_loop jsr be_pattn_play + +; Check to see if the pattern counter has gone up... + lda be_pattn_cnt + cmp text_tmr + beq main_loop + sta text_tmr + +; ...and if so, update the message line + ldx #$00 +mread lda scroll_text + bne okay + jsr reset + jmp mread +okay sta $0400,x + inc mread+$01 + bne *+$05 + inc mread+$02 + inx + cpx #$28 + bne mread + +; Write the new text to bitmap + ldx #$00 +bmp_draw ldy $0400,x + lda font_data+$000,y + sta text_bmp+$0000,x + lda font_data+$040,y + sta text_bmp+$0400,x + lda font_data+$080,y + sta text_bmp+$0800,x + lda font_data+$0c0,y + sta text_bmp+$0c00,x + lda font_data+$100,y + sta text_bmp+$1000,x + lda font_data+$140,y + sta text_bmp+$1400,x + lda font_data+$180,y + sta text_bmp+$1800,x + lda font_data+$1c0,y + sta text_bmp+$1c00,x + + lda font_data+$200,y + sta text_bmp+$0080,x + lda font_data+$240,y + sta text_bmp+$0480,x + lda font_data+$280,y + sta text_bmp+$0880,x + lda font_data+$2c0,y + sta text_bmp+$0c80,x + lda font_data+$300,y + sta text_bmp+$1080,x + lda font_data+$340,y + sta text_bmp+$1480,x + lda font_data+$380,y + sta text_bmp+$1880,x + lda font_data+$3c0,y + sta text_bmp+$1c80,x + inx + cpx #$28 + bne bmp_draw + + jmp main_loop + + +; Reset the "scrolling" message +reset lda #scroll_text + sta mread+$02 + rts + + +; Include the music driver and tune data + !src "includes/be_driver.asm" + !src "includes/be_mps.asm" + + +; The "scrolling" message text +scroll_text !scr " beep beep beepy beeeeep... " + !scr "welcome to -=- septic -=- from cosine!" + !scr " " + + !scr "okay, this release isn't much to look at" + !scr "but playing even these simple notes will" + !scr "tie up the cpu! the source code can be" + !scr " examined over at github for anyone who " + !scr "fancies trying to improve on the driver." + !scr " " + + !scr "code, driver and cosmetics ....... t.m.r" + !scr "tone playing routine ............. zapac" + !scr "one voice tune ........... martin galway" + !scr "nicked from microprose soccer on the c64" + !scr " " + + !scr " cosine's a-z greetings meander towards " + !scr "abyss connection, arkanix labs, artstate" + !scr " ate bit, booze design, camelot, chorus " + !scr " chrome, cncd, cpu, crescent, crest " + !scr " covert bitops, defence force " + !scr "dekadence, desire, dac, dmagic, dualcrew" + !scr " exclusive on, fairlight, fire, focus " + !scr " french touch, funkscientist, " + !scr " genesis project, gheymaid inc., hitmen " + !scr " hokuto force, level64, m and m " + !scr " maniacs of noise, meanteam, metalvotze " + !scr " noname, nostalgia, nuance, offence " + !scr " onslaught, orb, oxyron, padua, plush " + !scr " psytronik, reptilia, resource " + !scr " rgcd, secure, shape, side b, slash " + !scr " slipstream, success and trc, style " + !scr " suicyco industries, taquart, tempest " + !scr " tek, triad, trsi, viruz, vision, wow " + !scr " wrath, xenon and anyone we forgot! " + !scr " " + + !scr "don't forget to visit the cosine website" + !scr "for 8-bit delights http://cosine.org.uk/" + !scr " " + + !scr "-=- t.m.r signing off - 2015-12-15 -=-" + !scr " " + + !byte $00 ; end of text diff --git a/septic.do b/septic.do new file mode 100644 index 0000000..6ca6bf1 Binary files /dev/null and b/septic.do differ