From 17a14f292f041dfaf7aa92574922e92d8cb50af6 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 16 Apr 2025 20:39:07 -0500 Subject: [PATCH] 6502 command stream player, part 3 does not compile --- .gitignore | 2 + src/asm/6502/6502base.i | 20 +++++++ src/asm/6502/6502base.ini | 2 + src/asm/6502/pattern.s | 73 ----------------------- src/asm/6502/stream.s | 122 +++++++++++++++++++++++--------------- 5 files changed, 98 insertions(+), 121 deletions(-) create mode 100644 src/asm/6502/6502base.i create mode 100644 src/asm/6502/6502base.ini delete mode 100644 src/asm/6502/pattern.s diff --git a/.gitignore b/.gitignore index f31a9c094..40b50f48f 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,5 @@ res/docpdf/.venv res/docpdf/htmldoc/ res/fonts/compressed/ res/furnace.appdata.xml +src/asm/6502/*.o +src/asm/6502/*.bin diff --git a/src/asm/6502/6502base.i b/src/asm/6502/6502base.i new file mode 100644 index 000000000..2536ce473 --- /dev/null +++ b/src/asm/6502/6502base.i @@ -0,0 +1,20 @@ +; this defines a base 6502 machine with 64K RAM across the entire address space. +; use for testing! + +.MEMORYMAP +DEFAULTSLOT 0 +SLOT 0 START $0000 SIZE $2000 +SLOT 1 START $2000 SIZE $2000 +SLOT 2 START $4000 SIZE $2000 +.ENDME + +.ROMBANKMAP +BANKSTOTAL 3 +BANKSIZE $2000 +BANKS 2 +BANKSIZE $C000 +BANKS 1 +.ENDRO + +.BANK 1 SLOT 1 +.ORGA $2000 diff --git a/src/asm/6502/6502base.ini b/src/asm/6502/6502base.ini new file mode 100644 index 000000000..67e134b64 --- /dev/null +++ b/src/asm/6502/6502base.ini @@ -0,0 +1,2 @@ +[objects] +stream.o diff --git a/src/asm/6502/pattern.s b/src/asm/6502/pattern.s deleted file mode 100644 index ab1fc4f7b..000000000 --- a/src/asm/6502/pattern.s +++ /dev/null @@ -1,73 +0,0 @@ -patPos=$90 -tempByte=$80 - -nextNote=$a0 -nextIns=$a1 -nextVolume=$b0 -nextRow=$b1 -nextEffect1=$c0 -nextEffect2=$d0 -nextEffect3=$e0 -nextEffect4=$f0 - -.macro nextByte - lda (patPos,x) - inc patPos,x - bcc :+ - inc patPos+1,x -: clc -.endmacro - -; read next row. -; load X with channel<<1 -readNext: - lda #$ff - sta nextNote,x ; clear last values - sta nextIns,x - sta nextVolume,x - sta nextEffect1,x - sta nextEffect2,x - sta nextEffect3,x - sta nextEffect4,x - nextByte - sta tempByte ; temporary store - beq endOfPat - lda #$20 ; start pattern check - bit tempByte ; NVI..EEE - bpl :+ - php ; read note - nextByte - sta nextNote,x - plp -: bvc :+ - php ; read volume - nextByte - sta nextVolume,x - plp -: bne :+ - nextByte ; read instrument - sta nextIns,x -: lda tempByte - and #7 - tay - txa - pha - clv -readEffectLoop: - dey ; check if we're done - beq readLength - nextByte ; effect - sta nextEffect1,x - nextByte ; effect val - sta nextEffect1+1,x - txa ; add 16 to offset - adc #$10 - tax - bvc readEffectLoop -readLength: - pla - tax - nextByte - sta nextRow,x -endOfPat: - rts diff --git a/src/asm/6502/stream.s b/src/asm/6502/stream.s index 82dda24ef..46152184d 100644 --- a/src/asm/6502/stream.s +++ b/src/asm/6502/stream.s @@ -10,10 +10,12 @@ ; - short pointers only ; - little-endian only! +.include "6502base.i" + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; constants -FCS_MAX_CHANS=8 ; maximum number of channels (up to 127, but see below!) +FCS_MAX_CHAN=8 ; maximum number of channels (up to 127, but see below!) FCS_MAX_STACK=16 ; stack depth per channel (FCS_MAX_STACK*FCS_MAX_CHAN<256) ; player constants - change if necessary @@ -55,8 +57,8 @@ chanVibratoPos=fcsAddrBase+24+(FCS_MAX_CHAN*4) ; char ; may be used for driver detection fcsDriverInfo: - .byte "Furnace" - .byte 0 + .db "Furnace" + .db 0 ; note on null fcsNoteOnNull: @@ -80,6 +82,9 @@ fcsOneByteDispatch: jsr fcsDispatchCmd rts +fcsNoOp: + rts + ; x: channel*2 ; y: command fcsDispatchCmd: @@ -91,24 +96,33 @@ fcsDispatchCmd: ; check for zero lda fcsTempPtr ora fcsTempPtr - beq :+ ; get out + beq + ; get out ; handle command in dispatch code jmp (fcsTempPtr) ; only if pointer is zero -: rts ++ rts ; x: channel*2 ; a is set to next byte fcsReadNext: + ; a=chanPC[x]+fcsPtr + clc + lda chanPC,x + adc #>fcsPtr + sta fcsTempPtr lda chanPC+1,x + adc #