tfv: more commenting of duet

This commit is contained in:
Vince Weaver 2017-05-03 00:40:33 -04:00
parent ab1c70b37c
commit b52890bfeb
2 changed files with 30 additions and 26 deletions

View File

@ -25,14 +25,15 @@
; These are all "Free" zero page locations
LOC6 EQU $06
LOC7 EQU $07
LOC8 EQU $08
DURATION EQU $08
LOC9 EQU $09
LOC1D EQU $1D
LOC1E EQU $1E
LOC1F EQU $1F
MADDRL EQU $1E
MADDRH EQU $1F
LOC4E EQU $4E
LOC4F EQU $4F
play_ed:
LDA #$01 ; 900: A9 01 ; 2 *!*
STA LOC9 ; 902: 85 09 ; 3
STA LOC1D ; 904: 85 1D ; 3
@ -42,39 +43,41 @@ LOC4F EQU $4F
BNE label1 ; 909: D0 15 ; 4 *!*
label2:
INY ; 90B: C8 ; 2
LDA (LOC1E),Y ; 90C: B1 1E ; 5 *!*
LDA (MADDRL),Y ; 90C: B1 1E ; 5 *!*
STA LOC9 ; 90E: 85 09 ; 3
INY ; 910: C8 ; 2
LDA (LOC1E),Y ; 911: B1 1E ; 5 *!*
LDA (MADDRL),Y ; 911: B1 1E ; 5 *!*
STA LOC1D ; 913: 85 1D ; 3
loop:
LDA LOC1E ; 915: A5 1E ; 3 *!*
LDA MADDRL ; 915: A5 1E ; 3 *!*
CLC ; 917: 18 ; 2
ADC #$03 ; 918: 69 03 ; 2 *!*
STA LOC1E ; 91A: 85 1E ; 3
STA MADDRL ; 91A: 85 1E ; 3
BCC label1 ; 91C: 90 02 ; 4 *!*
INC LOC1F ; 91E: E6 1F ; 5
INC MADDRH ; 91E: E6 1F ; 5
label1:
LDY #$00 ; 920: A0 00 ; 2 *!*
LDA (LOC1E),Y ; 922: B1 1E ; 5 *!*
CMP #$01 ; 924: C9 01 ; 2
BEQ label2 ; 926: F0 E3 ; 4 *!*
BCS label3 ; 928: B0 0D ; 4 *!*
PLA ; 92A: 68 ; 4
PLA ; 92B: 68 ; 4
PLA ; 92C: 68 ; 4
LDY #$00 ; 920: A0 00 ; 2 *!* Set Y to zero
LDA (MADDRL),Y ; 922: B1 1E ; 5 *!* Load first byte
CMP #$01 ; 924: C9 01 ; 2 Compare to 1
BEQ label2 ; 926: F0 E3 ; 4 *!* If one ?
BCS play_note ; 928: B0 0D ; 4 *!* If >1, then duration
PLA ; 92A: 68 ; 4 POP
PLA ; 92B: 68 ; 4 POP
PLA ; 92C: 68 ; 4 POP
sub1:
LDX #$49 ; 92D: A2 49 ; 2 *!*
INY ; 92F: C8 ; 2
LDA (LOC1E),Y ; 930: B1 1E ; 5 *!*
BNE label4 ; 932: D0 02 ; 4 *!*
LDX #$C9 ; 934: A2 C9 ; 2 *!*
LDX #$49 ; 92D: A2 49 ; 2 *!* X=0x49 (EOR opcode)
INY ; 92F: C8 ; 2 increment to next byte
LDA (MADDRL),Y ; 930: B1 1E ; 5 *!* load next byte
BNE label4 ; 932: D0 02 ; 4 *!* if not zero
LDX #$C9 ; 934: A2 C9 ; 2 *!* X=0xC9 (CMP opcode)
label4:
RTS ; 936: 60 ; 6
label3:
STA LOC8 ; 937: 85 08 ; 3
RTS ; 936: 60 ; 6 return
play_note:
STA DURATION ; 937: 85 08 ; 3
JSR sub1 ; 939: 20 2D09 ; 6
STX $0983 ; 93C: 8E 8309 ; 4 ; self-modify
STX $0983 ; 93C: 8E 8309 ; 4 self-modify EOR/CMP
STA LOC6 ; 93F: 85 06 ; 3
LDX LOC9 ; 941: A6 09 ; 3 *!*
label5:
@ -139,7 +142,7 @@ label16:
label17:
DEC LOC4F ; 999: C6 4F ; 5
BNE label18 ; 99B: D0 11 ; 4 *!*
DEC LOC8 ; 99D: C6 08 ; 5
DEC DURATION ; 99D: C6 08 ; 5
BNE label18 ; 99F: D0 0D ; 4 *!*
BVC label19 ; 9A1: 50 03 ; 4 *!*
BIT $C030 ; 9A3: 2C 30C0 ; 4 SPEAKER
@ -166,3 +169,4 @@ label23:
BVS label99 ; 9BD: 70 A3 ; 4 *!*
NOP ; 9BF: EA ; 2
BVC label8 ; 9C0: 50 A3 ; 4 *!*

Binary file not shown.