Advertisement
Skidlz

Defender Disassembly

Feb 17th, 2020
688
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;   Disassembled by:
  2. ;   DASMx object code disassembler
  3. ;   (c) Copyright 1996-1999   Conquest Consultants
  4. ;   Version 1.30 (Oct  6 1999)
  5. ;
  6. ;   File:   C:\Users\Zack\Downloads\Defender Sound Research\defenderb ROM\defend - Copy.snd
  7. ;
  8. ;   Size:   2048 bytes
  9. ;   Checksum:   BB43
  10. ;   CRC-32: 6479F442
  11. ;
  12. ;   Date:   Sun Sep 08 21:11:37 2019
  13. ;
  14. ;   CPU:    Motorola 6808 (6800/6802/6808 family)
  15.     ORG $0000
  16. X0000
  17.     ORG $0001
  18. X0001
  19.     ORG $0002
  20. X0002
  21.     ORG $0003
  22. X0003
  23.     ORG $0004
  24. flg04
  25.     ORG $0005
  26. X0005
  27.     ORG $0006
  28. X0006
  29.     ORG $0007
  30. flg07
  31.     ORG $0008
  32. X0008
  33.     ORG $0009
  34. ALFSR
  35.     ORG $000A
  36. BLFSR
  37.     ORG $000B   ;pointer hi
  38. pnt0B
  39.     ORG $000C   ;lo
  40. p0Blo
  41.     ORG $000D   ;pointer hi
  42. pnt0D
  43.     ORG $000E   ;lo
  44. p0Dlo
  45.     ORG $000F   ;pointer hi
  46. pnt0F
  47.     ORG $0010   ;lo
  48. p0Flo
  49.     ORG $0011
  50. X0011
  51.     ORG $0012
  52. X0012
  53.     ORG $0013   ;$13 - $1B
  54. buf13
  55. X0013
  56.     ORG $0014
  57. X0014
  58.     ORG $0015
  59. X0015
  60.     ORG $0016   ;pointer hi
  61. pnt16
  62. X0016
  63.     ORG $0017   ;lo
  64. p16lo
  65. X0017
  66.     ORG $0018   ;pointer hi
  67. pnt18
  68.     ORG $0019   ;lo
  69. p18lo
  70.     ORG $001A
  71. X001A
  72.     ORG $001B   ;pointer hi
  73. pnt1B
  74.     ORG $001C   ;lo
  75. p1Blo
  76. X001C
  77.     ORG $001D   ;pointer hi
  78. pnt1D
  79. X001D
  80.     ORG $001E   ;lo
  81. p1Dlo
  82.     ORG $001F   ;pointer hi
  83. pnt1F
  84.     ORG $0020   ;lo
  85. p1Flo
  86.     ORG $0021
  87. cnt21
  88.     ORG $0022
  89. cnt22
  90.     ORG $0023
  91. X0023
  92.     ORG $0024
  93. buf24
  94.  
  95.     ORG $0400
  96. PIA_BASE
  97.  
  98.     ORG $0402
  99. PIA_PORB
  100.  
  101.     ORG $F800
  102.  
  103.     nop
  104. RST:
  105.     sei
  106.     lds     #$007F  ;set stack pointer
  107.     ldx     #PIA_BASE
  108.     clr     $01,x   ;set PIA CRA reg, clear inrq, select DDRA
  109.     clr     $03,x   ;set PIA CRB reg, clear inrq, select DDRB
  110.     ldaa    #$FF
  111.     staa    $00,x   ;set PORTA to outputs
  112.     clr     $02,x   ;set PORTB to outputs
  113.     ldaa    #%00110111  ;Set CRB, CB2 goes low as write CR reg-
  114.     staa    $03,x   ;select PORTB, low-to-hi IRQ, enable IRQ
  115.     ldaa    #%00111100  ;Set CRA, CA2 goes hi as write CR reg-
  116.     staa    $01,x   ;select PORTA, disable IRQ
  117.     staa    ALFSR   ;$09 LFSR init?
  118.     clra
  119.     staa    flg07   ;clear x0007
  120.     staa    flg04   ;clear x0004
  121.     staa    X0005   ;clear
  122.     staa    X0006   ;clear
  123.     staa    X0008   ;clear
  124.     cli
  125. LOOP:
  126.     bra LOOP
  127. ;----------------
  128.  
  129. ;A holds value for STEP_PNT0D
  130. ;will multiply by 9
  131. ;subroutine
  132. ;load buf13 from table0
  133. Lod13:
  134. LF82A: 
  135.     tab     ;B = A
  136.     asla
  137.     asla
  138.     asla    ;A *= 8
  139.     aba     ;A = 9A
  140.     ldx     #buf13
  141.     stx     pnt0F   ;init to buf13
  142.     ldx     #TABLE0 ;LFB0A loads pnt0D from here
  143.     jsr     STEP_PNT0D  ;add 9A to pnt0D
  144.     ldab    #$09    ;copy 9 bytes from #TABLE0 to buf13
  145.     jmp     Cpy0F   ;ENDs LF82A Subroutine
  146. ;----------------
  147.  
  148. ;Generate Square wave (Extra life?)
  149. ;$13, $14 hold hi and lo time delays
  150. ;$15 (#0?)
  151. ;$16?, $17?
  152. ;pnt18 hold sync freq
  153. ;$1A
  154. ;$1B holds amplitude
  155. ;subroutine
  156. LF83F: 
  157.     ldaa    pnt1B       ;amplitude
  158.     staa    PIA_BASE    ;store $1B val
  159. LF844:
  160.     ;v delay loop init p1
  161.     ldaa    X0013   ;hi time delay, move to $1C
  162.     staa    X001C   ;store $13 val
  163.     ldaa    X0014   ;lo time delay, move to $1D
  164.     staa    X001D   ;store $14 val
  165. LF84C:
  166.     ldx     pnt18
  167. LF84E: 
  168.     ;V delay loop init p2
  169.     ldaa    X001C
  170.     com     PIA_BASE    ;invert
  171. LF853:
  172.     ;V 'hi' delay
  173.     dex     ;pnt18 val
  174.     beq     LF866   ;sync check
  175.     deca    ;X001C ($13) val
  176.     bne     LF853   ;^
  177.     com     PIA_BASE    ;invert
  178.     ldaa    X001D
  179. LF85E:
  180.     ;V 'lo delay
  181.     dex     ;pnt18 val
  182.     beq     LF866   ;sync check
  183.     deca    ;X001D ($14) val
  184.     bne     LF85E   ;^
  185.     bra     LF84E   ;^^
  186. ;
  187. LF866:
  188.     ldaa    PIA_BASE
  189.     bmi     LF86C   ;if hi, sync square
  190.     coma    ;invert PIA value
  191. LF86C:
  192.     ;^
  193.     adda    #$00    ;is carry ever set??
  194.     staa    PIA_BASE    ;store (inverted?) PIA (+1?)
  195.     ldaa    X001C   ;hi delay val
  196.     adda    X0015   ;add to $1C val (always 0)
  197.     staa    X001C   ;store $15 val + $1C val
  198.    
  199.     ldaa    X001D   ;lo delay val
  200.     adda    X0016   ;add $1D val
  201.     staa    X001D   ;store $1D val + $16
  202.    
  203.     cmpa    X0017
  204.     bne     LF84C
  205.     ldaa    X001A
  206.     beq     LF88B_rts
  207.     adda    X0013   ;add val from $1A
  208.     staa    X0013   ;store $13 val + $1A val
  209.     bne     LF844
  210. LF88B_rts:
  211.     rts
  212. ;END LF83F Subroutine
  213. ;----------------
  214.  
  215. ;White noise routines?
  216. ;Indirect Subroutine offset 3
  217. LF88C:
  218.     ldaa    #$01
  219.     staa    X001A   ;set to #1
  220.     ldab    #$03
  221.     bra     LF89E
  222. ;
  223. ;Indirect Subroutine offset 7
  224. LF894:
  225.     ldaa    #$FE
  226.     staa    X001A   ;set to #$FE (#-2)
  227.     ldaa    #$C0
  228.     ldab    #$10
  229.     bra     LF89E
  230. ;
  231. LF89E:
  232.     ;only called from directly above^
  233.     staa    p18lo       ;a = 1 or -2
  234.     ldaa    #$FF
  235.     staa    PIA_BASE    ;set to max #$FF
  236.     stab    X0015       ;init to #3 or #16
  237. LF8A7:
  238.     ldab    X0015   ;LFSR counter
  239. LF8A9:
  240.     ;Linear Feedback Shift Register??
  241.     ldaa    BLFSR
  242.     lsra
  243.     lsra
  244.     lsra
  245.     eora    BLFSR
  246.     lsra
  247.     ror     ALFSR
  248.     ror     BLFSR
  249.     bcc     LF8BC
  250.     com     PIA_BASE    ;invert
  251. LF8BC:
  252.     ldaa    p18lo
  253. LF8BE:
  254.     deca    ;delay?
  255.     bne     LF8BE
  256.     decb    ;count down from #3 or #16
  257.     bne     LF8A9
  258.     ldaa    p18lo
  259.     adda    X001A   ;add val from $19
  260.     staa    p18lo   ;add val from $1A
  261.     bne     LF8A7
  262.     rts
  263. ;END LF88C and LF894 subroutines
  264. ;----------------
  265.  
  266. ;Indirect Subroutine offset 6
  267. LF8CD:
  268.     ldaa    #$20
  269.     staa    X0015   ;set to #32
  270.     staa    pnt18   ;set to #32
  271.     ldaa    #$01
  272.     ldx     #$0001
  273.     ldab    #$FF
  274.     bra     LF8DC ; jump to very next address?
  275. ;
  276. LF8DC:
  277.     ;only called from directly above^
  278.     staa    X0013   ;init to #1
  279. LF8DE:
  280.     ;local
  281.     stx     pnt16   ;init to #1
  282. LF8E0:
  283.     ;local
  284.     stab    X0014   ;init to #$FF, or store $14-$13. gets written to PIA_BASE
  285.     ldab    X0015   ;LFSR counter
  286. LF8E4:
  287.     ;Linear Feedback Shift Register??
  288.     ldaa    BLFSR
  289.     lsra
  290.     lsra
  291.     lsra
  292.     eora    BLFSR
  293.     lsra
  294.     ror     ALFSR
  295.     ror     BLFSR
  296.     ldaa    #$00
  297.     bcc     LF8F8
  298.     ldaa    X0014       ;load to store in PIA_BASE
  299. LF8F8:
  300.     ;local
  301.     staa    PIA_BASE    ;store #0 or $14 val (noise?)
  302.     ldx     pnt16
  303. LF8FD:
  304.     ;loop
  305.     dex     ;coundt $16 val down to 0, for delay?
  306.     bne     LF8FD   ;loop
  307.     decb    ;$15 or $14 - $13
  308.     bne     LF8E4
  309.     ldab    X0014
  310.     subb    X0013   ;sub #1 from $14 ($13 is always 1 here)
  311.     beq     LF912
  312.     ldx     pnt16
  313.     inx
  314.     ldaa    pnt18   ;should equal #32 here, maybe IRQ can change it?
  315.     beq     LF8E0
  316.     bra     LF8DE
  317. LF912:
  318.     rts
  319. ;END LF8CD Subroutine
  320. ;-----------------
  321.  
  322. ;Indirect Subroutine offset 1
  323. ;jmpd to from LFD12, also in branch table
  324. LF913:
  325.     ldab    #$01    ;to store in $13
  326.     stab    flg04   ;store #1
  327.     clra
  328.     staa    p18lo   ;clear, set to #0
  329.     bra     LF930
  330. ;
  331. ;Indirect Subroutine offset 8
  332. LF91C:
  333.     clra
  334.     staa    p18lo   ;clear, set to #0
  335.     ldab    #$03    ;to store in $13
  336.     bra     LF930
  337. ;
  338. ;Indirect Subroutine offset 9
  339. LF923:
  340.     ldaa    #$01
  341.     staa    p18lo   ;set to #1
  342.     ldx     #$03E8  ;Something external. Speech?
  343.     ldaa    #$01
  344.     ldab    #$FF    ;to store in $13
  345.     bra     LF930
  346. ;
  347. LF930:
  348.     ;only jumpd to from above^
  349.     staa    pnt18   ;LF913 or LF91C a=0, else LF923 a=1
  350.     stab    X0013   ;init to #1, #3, or #255
  351.     stx     pnt16   ;#$03E8  if called by LF923. Else $#F913 or $#F91C
  352.     clr     X0015
  353. LF939:
  354.     ldx     pnt16
  355.     ldaa    PIA_BASE
  356. LF93E:
  357.     ;Linear Feedback Shift Register??
  358.     tab
  359.     lsrb
  360.     lsrb
  361.     lsrb
  362.     eorb    BLFSR
  363.     lsrb
  364.     ror     ALFSR
  365.     ror     BLFSR
  366.     ldab    X0013
  367.     tst     p18lo
  368.     beq     LF954
  369.     andb    ALFSR   ;and with $13 value
  370. LF954:
  371.     ;local
  372.     stab    X0014   ;gets written to PIA_BASE
  373.     ldab    X0015   ;load to add to $14 (?)
  374.     cmpa    BLFSR
  375.     bhi     LF96E
  376. LF95C:
  377.     ;local
  378.     dex
  379.     beq     LF985
  380.     staa    PIA_BASE    ;store $0A val (Noise?)
  381.     addb    X0015   ;add to $15 and $14
  382.     adca    X0014   ;add to $15
  383.     bcs     LF97E
  384.     cmpa    BLFSR
  385.     bls     LF95C
  386.     bra     LF97E
  387. ;
  388. LF96E:
  389.     dex
  390.     beq     LF985
  391.     staa    PIA_BASE
  392.     subb    X0015   ;sub from $15 based val
  393.     sbca    X0014   ;sub from $15
  394.     bcs     LF97E
  395.     cmpa    BLFSR
  396.     bhi     LF96E
  397. LF97E:
  398.     ldaa    BLFSR       ;gets written to PIA_BASE
  399.     staa    PIA_BASE    ;store $0A val (Noise?)
  400.     bra     LF93E
  401. ;
  402. LF985:
  403.     ldab    pnt18
  404.     beq     LF93E
  405.     ldaa    X0013   ;load to combine with $15 val
  406.     ldab    X0015   ;combine with $13
  407.     lsra    ;/2
  408.     rorb    ;shift 3 LSB of $13 val into B MSB
  409.     lsra    ;/4
  410.     rorb
  411.     lsra    ;/8
  412.     rorb
  413.     coma    ;2's comp
  414.     negb
  415.     sbca    #$FF
  416.     addb    X0015
  417.     adca    X0013
  418.     stab    X0015
  419.     staa    X0013
  420.     bne     LF939   ;write noise to PIA_BASE
  421.     cmpb    #$07
  422.     bne     LF939   ;write noise to PIA_BASE
  423.     rts     ;returns from LFA48
  424. ; END LF913, LF91C, LF923 and LFA48 Subroutines
  425. ;----------------
  426.  
  427. ;Indirect Subroutine offset 10
  428. ;write #$FD9A-#$FDA9 to PIA_BASE
  429. LF9A6:
  430.     ldaa    #$FD
  431.     staa    pnt0F   ;init to #$FDXX
  432.     ldx     #$0064  ;#100
  433.     stx     pnt0B   ;init to #100 #$64
  434. LF9AF:
  435.     ;local
  436.     addb    p0Blo
  437.     ldaa    X0011
  438.     adca    pnt0B   ; 256 > $0B > 100
  439.     staa    X0011   ;store $11 val + $0B val + carry from $0C
  440.     ldx     pnt0B
  441.     bcs     LF9BF
  442.     bra     LF9BD   ;jump to very next addr?
  443. LF9BD:
  444.     ;local
  445.     bra     LF9C2
  446. ;
  447. LF9BF:
  448.     ;local
  449.     inx     ;count up from 100
  450.     beq     LF9D3
  451. LF9C2:
  452.     ;local
  453.     stx     pnt0B   ;store $0B (+1)
  454.     anda    #$0F    ;$11 val & %1111
  455.     adda    #$9A
  456.     staa    p0Flo   ;set pnt05 to #$FD9A-#$FDA9
  457.     ldx     pnt0F
  458.     ldaa    $00,x
  459.     staa    PIA_BASE    ;store value from #$FD9A-#$FDA9
  460.     bra     LF9AF
  461. LF9D3:
  462.     rts
  463. ;END F9A6 Subroutine
  464. ;----------------
  465.  
  466. ;Indirect Subroutine offset 11
  467. ;Generates squarewave?
  468. LF9D4:
  469.     clra
  470.     staa    PIA_BASE    ;store 0
  471.     staa    X0011       ;store 0, min delay time/freq for tone
  472. LF9DA:
  473.     clra
  474. LF9DB:
  475.     cmpa    X0011
  476.     bne     LF9E2
  477.     com     PIA_BASE    ;invert value
  478. LF9E2:
  479.     ldab    #$12
  480. LF9E4:
  481.     ;delay loop?
  482.     decb
  483.     bne     LF9E4
  484.     inca
  485.     bpl     LF9DB
  486.     com     PIA_BASE    ;invert value
  487.     inc     X0011       ;decrease pitch
  488.     bpl     LF9DA
  489.     rts
  490. ;END F9D4 Subroutine
  491. ;----------------
  492.    
  493. ;Indirect Subroutine offset 12
  494. LF9F3:
  495.     ldx     #buf13
  496. LF9F6:
  497.     clr     $00,x   ;clear $13-$1B
  498.     inx
  499.     cpx     #$001B
  500.     bne     LF9F6
  501.     ldaa    #$40
  502.     staa    X0013   ;store #64
  503. LFA02:
  504.     ldx     #buf13
  505.     ldaa    #$80
  506.     staa    X0011   ;store #128
  507.     clrb
  508. LFA0A:
  509.     ldaa    $01,x   ;starts at $14
  510.     adda    $00,x   ;starts at $13
  511.     staa    $01,x   ;starts at $14
  512.     bpl     LFA14
  513.     addb    X0011   ;starts at #128
  514. LFA14:
  515.     lsr     X0011   ;divide by 2
  516.     inx
  517.     inx
  518.     cpx     #$001B  ;loop from $13-$1B
  519.     bne     LFA0A
  520.     stab    PIA_BASE    ;store $11 val + /2 $11 val + /2 $11...
  521.     inc     X0012       ;gets written to PIA elsewhere
  522.     bne     LFA02
  523.     ldx     #buf13
  524.     clrb
  525. LFA2A:
  526.     ;local
  527.     ldaa    $00,x
  528.     beq     LFA39 ;v
  529.     cmpa    #$37
  530.     bne     LFA36 ;v
  531.     ldab    #$41
  532.     stab    $02,x   ;store #$41 at $13-$1B + 2
  533. LFA36:
  534.     dec $00,x
  535.     incb
  536. LFA39:
  537.     inx
  538.     inx
  539.     cpx     #$001B
  540.     bne     LFA2A ;^
  541.     tstb
  542.     bne     LFA02 ;reset x to #$13
  543.     rts
  544. ;END F9F3 Subroutine
  545. ;----------------
  546.  
  547. ;Indirect Subroutine offset 13
  548. LFA44:
  549.     dec     X0008
  550.     rts
  551. ; ---------------
  552.  
  553. ;only called from IRQ if $08 val < 0
  554. ;A holds (triggers)loop count #$1E, stored in $11
  555. ;subroutine, rts near LF985?
  556. LFA48:
  557.     clr     X0008
  558.     staa    X0011   ;store trigger values
  559.     ldx     #TABLE1 ;$FDAA start of a table
  560. LFA50:
  561.     ldaa    $00,x   ;load from TABLE1
  562.     beq     LFA81   ;table zero terminated, exit if end
  563.     dec     X0011
  564.     beq     LFA5F   ;if $11 = 0
  565.     inca
  566.     jsr     STEP_PNT0D ;add A to pnt0d
  567.     bra     LFA50
  568. ;
  569. LFA5F:
  570.     inx
  571.     stx     pnt0F   ;set to #TABLE1($FDAA) + 1
  572.     jsr     STEP_PNT0D  ;add A to pnt0d
  573.     stx     pnt0D   ;set to #TABLE1($FDAA) + 1 + A(?)
  574.     ldx     pnt0F   ;load #TABLE1($FDAA) + 1
  575. LFA69:
  576.     ldaa    $00,x   ;val for $15
  577.     staa    X0015
  578.     ldaa    $01,x   ;loop count for LFAB3
  579.     ldx     $02,x   ;val for $13
  580.     stx     X0013   ;set to val from TABLE1?
  581.     bsr     LFAB3
  582.     ldx     pnt0F
  583.     inx
  584.     inx
  585.     inx
  586.     inx
  587.     stx     pnt0F   ;add 4 to x and pnt0F
  588.     cpx     pnt0D
  589.     bne     LFA69
  590. LFA81:
  591.     jmp     LFD0E
  592. ;------------
  593.  
  594. ;Indirect Subroutine offset 14
  595. LFA84:
  596.     ldaa    #$03
  597.     staa    X0008   ;set to #3
  598.     rts
  599. ;END FA84 Subroutine
  600. ;----------------
  601.  
  602. ;only called from IRQ
  603. ;A = #$1D
  604. ;subroutine
  605. LFA89:
  606.     dec     X0008
  607.     beq     LFA9A
  608.     ldab    X0015
  609.     aslb    ;*2
  610.     aslb    ;*4
  611.     aslb    ;*8
  612.     aslb    ;*16
  613.     aba     ;A = #$1D + $15 val * 16
  614.     staa    X0015   ; store #$1D + $15 val * 16
  615.     clra
  616. LFA98:
  617.     ;Loop
  618.     bra     LFA98   ;loop
  619. ;
  620. LFA9A:
  621.     ;$08 = #0
  622.     deca
  623.     cmpa    #$0B    ;TABLE2 length
  624.     bls     LFAA0
  625.     clra
  626. LFAA0:
  627.     ldx     #TABLE2     ;$FE41
  628.     jsr     STEP_PNT0D
  629.     ldaa    $00,x       ;load from TABLE2 + A(?)
  630.     ldx     #$FFFF
  631.     stx     X0013       ;set to #$FFFF for LFADB
  632.     bsr     LFAB3       ;A holds rate
  633. LFAAF:
  634.     ;loop
  635.     bsr     LFADB
  636.     bra     LFAAF   ;loop
  637. ;----------------
  638.  
  639.  
  640. ;A = delay time
  641. ;subroutine, bsr to here
  642. ;generates delay routine in ram
  643. LFAB3:
  644.     ldx     #$0016  ;delay routine starts here
  645. LFAB6:
  646.     ;v
  647.     cmpa    #$00
  648.     beq     LFACF   ;v
  649.     cmpa    #$03
  650.     beq     LFAC7   ;v
  651.     ldab    #$01    ;write NOPs to RAM to generate dynamic delay
  652.     stab    $00,x   ;store NOP at x init to #$16
  653.     inx
  654.     suba    #$02
  655.     bra     LFAB6   ;^
  656. ;
  657. LFAC7:
  658.     ;^
  659.     ldab    #$91   
  660.     stab    $00,x   ;write CMPA $0000 to RAM x=(A-3)/2 + #$16
  661.     clr     $01,x
  662.     inx
  663.     inx
  664. LFACF:
  665.     ;^
  666.     ldab    #$7E    ;write JMP $FADD to RAM ($16 if a=0) ($18 if a=3)
  667.     stab    $00,x   ;store #$7E
  668.     ldab    #$FA
  669.     stab    $01,x   ;store #$FA
  670.     ldab    #$DD
  671.     stab    $02,x   ;store #$DD
  672.  
  673. ;$12 = PIA start value
  674. ;$13 = loop count (#$FFFF)
  675. LFADB:
  676.     ;subroutine, bsr to here from LFAAF
  677.     ldx     X0013   ;$13 = #$FFFF
  678.     ;FADD
  679.     clra
  680.     db $F6,$00,$12
  681.     ;ldab   $0012
  682.     incb    ;$12 + 1
  683.     stab    X0012   ;$12 + 1
  684.     andb    X0015   ;and with $12
  685.     lsrb    ;\2
  686.     adca    #$00
  687.     lsrb    ;\4
  688.     adca    #$00
  689.     lsrb    ;\8
  690.     adca    #$00
  691.     lsrb    ;\16
  692.     adca    #$00
  693.     lsrb    ;\32
  694.     adca    #$00
  695.     lsrb    ;\64
  696.     adca    #$00
  697.     lsrb    ;\128
  698.     adca    #$00    ;A = count of 1s in B
  699.     aba     ;A = A + B
  700.     asla    ;*2
  701.     asla    ;*4
  702.     asla    ;*8
  703.     asla    ;A * 16
  704.     staa    PIA_BASE    ;store manipulated $12 val
  705.     dex     ;$13 val -1
  706.     beq     LFB09   ;return
  707.     jmp     pnt16   ;jump to dynamic delay routine in RAM
  708. LFB09:
  709.     rts
  710. ;END LFA89 and LFAB3 Subroutines
  711. ;-----------------
  712.  
  713. ;subroutine. Ends LF82A, called from LFC75 too
  714. Cpy0F:
  715. LFB0A:
  716.     psha
  717. LFB0B:
  718.     ;copy from pnt0d to pnt0f
  719.     ;B holds number of bytes
  720.     ;x points to TABLE0, if called from LF82A
  721.     ldaa    $00,x   ;x = pnt18 val + 1, if called from LFC75
  722.     stx     pnt0D
  723.     ldx     pnt0F
  724.     staa    $00,x   ;x = pnt0F
  725.     inx
  726.     stx     pnt0F
  727.     ldx     pnt0D
  728.     inx
  729.     decb
  730.     bne     LFB0B   ;^
  731.     pula
  732.     rts
  733. ;END LFB0A and LF82A Subroutines
  734. ;-------------------------
  735.  
  736. ;Indirect Subroutine offset 5
  737. LFB1E:
  738.     clra
  739.     staa    flg04   ;clear
  740.     staa    X0005   ;clear
  741.     rts
  742. ;-------------------------
  743.  
  744. ;Indirect Subroutine offset 2
  745. LFB24:
  746.     clr     flg04
  747.     ldaa    X0005
  748.     anda    #$7F
  749.     cmpa    #$1D
  750.     bne     LFB30
  751.     clra
  752. LFB30:
  753.     inca
  754.     staa    X0005   ;store 1 or val +1
  755.     rts
  756. ;END LFB24 Subroutine
  757. ;----------------
  758.  
  759. LFB34:
  760.     ldaa    #$0E
  761.     jsr     LFB81   ;Loads a set of values from TABLE4
  762.     ldaa    X0005   ;$05 can = 0-29
  763.     asla
  764.     asla
  765.     coma    ;A = -($05 val * 4)
  766.     jsr     LFC39   ;store A in X0023
  767. LFB41:
  768.     ;Loop
  769.     inc     p16lo
  770.     jsr     LFC3B
  771.     bra     LFB41   ;Loop
  772. ;----------------
  773.  
  774. ;Indirect Subroutine offset 0
  775. ;subroutine that never rts. Loop instead?
  776. LFB49:
  777.     ldaa    #$03
  778.     jsr     Lod13   ;load buf13 from table0 offset 3
  779.     ldab    X0006
  780.     cmpb    #$1F
  781.     bne     LFB55
  782.     clrb
  783. LFB55:
  784.     ;local
  785.     incb
  786.     stab    X0006   ;inc $06, set to #1 if = 31
  787.     ldaa    #$20
  788.     sba     ;A -= B
  789.     clrb
  790. LFB5C:
  791.     ;local
  792.     cmpa    #$14
  793.     bls     LFB65
  794.     addb    #$0E
  795.     deca
  796.     bra     LFB5C
  797. ;
  798. LFB65:
  799.     ;local
  800.     addb    #$05
  801.     deca
  802.     stab    X0013   ;param for LF83F sbrt
  803.     bne     LFB65
  804. LFB6C:
  805.     ;Loop
  806.     jsr     LF83F   ;Write $1B(#$FF) to PIA_BASE, $13, $14, $15, $16
  807.     bra     LFB6C   ;Loop
  808. ;-----------------
  809.  
  810. ;Indirect Subroutine offset 4
  811.     ldaa    flg07   ;exit routine if != 0
  812.     bne     LFB7E
  813.     inc     flg07   ;set to #1
  814.     ldaa    #$0D    ;will become $5B and work to inc PNT0D
  815.     bsr     LFB81   ;loads values from TABLE4
  816.     bra     LFBE7   ;Writes buf24 sample to PIA_BASE
  817. LFB7E:
  818.     jmp     LFC2E
  819. ;
  820. ;A holds value for STEP_PNT0D
  821. ;loads set of values from TABLE4
  822. ;subroutine
  823. LFB81:
  824.     tab     ;B = A
  825.     aslb    ;double B
  826.     aba     ;A += B
  827.     aba
  828.     aba
  829.     ldx     #TABLE4
  830.     jsr     STEP_PNT0D  ;A = A * 7, will add to pointer
  831.     ldaa    $00,x   ;load from TABLE4 +(A*7)
  832.     tab     ;B = A
  833.     anda    #$0F    ;low nyble > $14
  834.     staa    X0014   ;used in LFBE7 count/delay?
  835.     lsrb    ;/2
  836.     lsrb    ;/4
  837.     lsrb    ;/8
  838.     lsrb    ;/16
  839.     stab    X0013   ;store hi nyble in $13
  840.     ldaa    $01,x   ;load from TABLE4 +1
  841.     tab     ;B = A
  842.     lsrb    ;/2
  843.     lsrb    ;/4
  844.     lsrb    ;/8
  845.     lsrb    ;/16
  846.     stab    X0015   ;$15 gets hi nyble (flag for LFBE7)
  847.     anda    #$0F
  848.     staa    X0011   ;$11 gets lo nyble
  849.     stx     pnt0B   ;#TABLE4 (+1?)
  850.     ldx     #TABLE3 ;$FE4D
  851. LFBAB:
  852.     ;loop, get address of wave to subtract
  853.     dec     X0011   ;max 6
  854.     bmi     LFBB8   ;if $11 < 0
  855.     ldaa    $00,x   ;load wav length from TABLE3
  856.     inca   
  857.     jsr     STEP_PNT0D  ;add length + 1 to addr to get next wave
  858.     bra     LFBAB   ;loop
  859. ;
  860. LFBB8:
  861.     ;local
  862.     stx     pnt18   ;#TABLE3 wave to subtract
  863.     jsr     LDWAV   ;copy pnt18(TABLE3) # bytes to #$24
  864.     ldx     pnt0B   ;TABLE4 + (?)
  865.     ldaa    $02,x   ;TABLE4 subtraction multiplier
  866.     staa    X001A   ;subtraction multiplier (used for volume?)
  867.     jsr     SubWAV  ;subtract pnt18 wave from buf24 wave
  868.     ldx     pnt0B
  869.     ldaa    $03,x   ;TABLE4 hi pointer?
  870.     staa    pnt16
  871.     ldaa    $04,x   ;TABLE4
  872.     staa    p16lo   ;load from somewhere in TABLE4???
  873.     ldaa    $05,x   ;TABLE4
  874.     tab
  875.     ldaa    $06,x   ;TABLE4, offset for TABLE5
  876.     ldx     #TABLE5 ;$FF55
  877.     jsr     STEP_PNT0D
  878.     tba
  879.     stx     pnt1B   ;TABLE5 + A
  880.     clr     X0023
  881.     jsr     STEP_PNT0D
  882.     stx     pnt1D   ;TABLE5 end
  883.     rts
  884. ; END LFB81 Subroutine
  885. ;----------------
  886.  
  887. ;$13 hold loop counter
  888. ;$16 & $17 hold loop countes
  889. ;$1B holds pointer
  890. ; subroutine
  891. LFBE7:
  892.     ldaa    X0013   ;loop count
  893.     staa    cnt22   ;store $13 for loop count
  894. LFBEB:
  895.     ldx     pnt1B   ;TABLE5 pointer
  896.     stx     pnt0D   ;TABLE5 pointer
  897. LFBEF:
  898.     ;local
  899.     ldx     pnt0D   ;TABLE5
  900.     ldaa    $00,x   ;load from TABLE5
  901.     adda    X0023   ;add to TABLE5 val (init 0)
  902.     staa    cnt21   ;store delay/speed value
  903.     cpx     pnt1D   ;TABLE5 end
  904.     beq     LFC21
  905.     ldab    X0014   ;0 - 16
  906.     inx     ;inc pnt0D
  907.     stx     pnt0D   ;TABLE5
  908. LFC00:
  909.     ;local
  910.     ldx     #buf24
  911. LFC03:
  912.     ;local
  913.     ldaa    cnt21
  914. LFC05:
  915.     deca    ;delay
  916.     bne     LFC05
  917.     ldaa    $00,x   ;load from buf24
  918.     staa    PIA_BASE
  919.     inx
  920.     cpx     pnt1F   ;end of sample
  921.     bne     LFC03
  922.     decb    ;dec val from $14
  923.     beq     LFBEF   ;local ^
  924.     inx     ;delay
  925.     dex
  926.     inx
  927.     dex
  928.     inx
  929.     dex
  930.     inx
  931.     dex
  932.     nop
  933.     nop
  934.     bra     LFC00   ;local ^
  935. ;
  936. LFC21:
  937.     ldaa    X0015   ;subtraction multiplier
  938.     bsr     SubWAV  ;subtract pnt18 wave from buf24 wave
  939.     dec     cnt22
  940.     bne     LFBEB
  941.     ldaa    flg07   ;return if $07 != #0
  942.     bne     LFC74   ;return
  943. LFC2E:
  944.     ldaa    pnt16   ;return if $16 = 0
  945.     beq     LFC74   ;return
  946.     dec     p16lo   ;return if $17 = 0
  947.     beq     LFC74   ;return
  948.     adda    X0023   ;add to $16 val
  949. LFC39:
  950.     ;subroutine, only called from LFB34
  951.     staa    X0023   ;store $23+$16 or -($05 *4)
  952. LFC3B:
  953.     ;subroutine
  954.     ldx     pnt1B   ;TABLE5?
  955.     clrb
  956. LFC3E:
  957.     ldaa    X0023
  958.     tst     pnt16
  959.     bmi     LFC4B
  960.     adda    $00,x   ;add to $23 val
  961.     bcs     LFC51
  962.     bra     LFC56
  963. ;
  964. LFC4B:
  965.     adda    $00,x
  966.     beq     LFC51
  967.     bcs     LFC56
  968. LFC51:
  969.     tstb
  970.     beq     LFC5C
  971.     bra     LFC65
  972. ;
  973. LFC56:
  974.     tstb
  975.     bne     LFC5C
  976.     stx     pnt1B   ;TABLE5?
  977.     incb
  978. LFC5C:
  979.     inx
  980.     cpx     pnt1D   ;TABLE5 end
  981.     bne     LFC3E
  982.     tstb
  983.     bne     LFC65
  984.     rts     ;END LFBE7, LFC39 and LFC3B Subroutines
  985. ;
  986. LFC65:
  987.     stx     pnt1D   ;TABLE5 end?
  988.     ldaa    X0015
  989.     beq     LFC71
  990.     bsr     LDWAV   ;loads a wave into buf24
  991.     ldaa    X001A   ;subtraction multiplier
  992.     bsr     SubWAV  ;subtract pnt18 wave from buf24 wave
  993. LFC71:
  994.     jmp     LFBE7   ;Writes buf24 sample to PIA_BASE
  995. LFC74:
  996.     rts
  997. ;END LFBE7, LFC39 and LFC3B Subroutines
  998. ;----------------
  999.  
  1000. ;subroutine start
  1001. ;   copy from pnt18 to $24
  1002. LDWAV:
  1003. LFC75:
  1004.     ldx     #buf24
  1005.     stx     pnt0F   ;store #$24, destination for copy
  1006.     ldx     pnt18   ;Points to TABLE3($FE4D) if called from LFBB8
  1007.     ldab    $00,x   ;x = pnt18, load #bytes to copy in LFB0A
  1008.     inx
  1009.     jsr     Cpy0F   ;copy B bytes from pnt18 to $24
  1010.     ldx     pnt0F
  1011.     stx     pnt1F   ;store pnt0F val
  1012.     rts
  1013. ;END LFC75 Subroutine
  1014. ;----------------
  1015.  
  1016. ;A holds val for $12 and $11 subtraction multiplier
  1017. ;pnt18 points to wave to subtract from buf24
  1018. ;pnt1F holds end of sample in buf24 array
  1019. ;subroutine start
  1020. ;   subtract pnt18 wave from buf24
  1021. SubWAV:
  1022. LFC87:
  1023.     tsta
  1024.     beq     LFCB5
  1025.     ldx     pnt18   ;load to write to pnt0D
  1026.     stx     pnt0D   ;store pnt18 val
  1027.     ldx     #buf24
  1028.     staa    X0012
  1029. LFC93:
  1030.     stx     pnt0F   ;init to #$24
  1031.     ldx     pnt0D   ;counts up from pnt18 val
  1032.     ldab    X0012
  1033.     stab    X0011   ;store $12 val
  1034.     ldab    $01,x   ;x = pnt0D
  1035.     lsrb    ;/2
  1036.     lsrb    ;/4
  1037.     lsrb    ;/8
  1038.     lsrb    ;/16
  1039.     inx
  1040.     stx     pnt0D   ;pnt0d + 1
  1041.     ldx     pnt0F
  1042.     ldaa    $00,x   ;buf24
  1043. LFCA8:
  1044.     ;local
  1045.     sba     ;A -= B
  1046.     dec     X0011   ;A -= B * $11 val
  1047.     bne     LFCA8
  1048.     staa    $00,x   ;buf24
  1049.     inx
  1050.     cpx     pnt1F   ;end of buf24 sample
  1051.     bne     LFC93
  1052. LFCB5:
  1053.     rts
  1054. ;END LFBE7 and LFC87 Subroutines
  1055. ;----------------
  1056.  
  1057. IRQ:
  1058.     lds     #$007F  ;set stack pointer
  1059.     ldaa    PIA_PORB    ;$0402 Trigger inputs
  1060.     cli
  1061.     coma    ;invert A
  1062.     anda    #$1F    ;0b011111, lowest 5 bits
  1063.     ldab    X0008
  1064.     beq     LFCCD   ;$08 = 0
  1065.     bpl     LFCC9   ;$08 > 0
  1066.     jsr     LFA48   ;$08 < 0, clrs $08
  1067. LFCC9:
  1068.     ;$08 > 0
  1069.     deca
  1070.     jsr     LFA89   ;writes $12(after manip) to PIA_BASE, dec $08
  1071. LFCCD:
  1072.     ;$08 = 0
  1073.     clrb
  1074.     cmpa    #$0E    ;0b1110
  1075.     beq     LFCD4   ;V
  1076.     stab    X0006   ;clear
  1077. LFCD4:
  1078.     ;^
  1079.     cmpa    #$12    ;0b10010
  1080.     beq     LFCDA   ;V
  1081.     stab    flg07   ;clear
  1082. LFCDA:
  1083.     ;^
  1084.     ldab    $EFFD   ;speech synth ROM ???
  1085.     cmpb    #$7E    ;check it is present?
  1086.     bne     LFCE4   ;leave if not?
  1087.     jsr     $EFFD   ;call speech synth?
  1088. LFCE4:
  1089.     ;^
  1090.     tsta
  1091.     beq     LFD0E
  1092.     deca
  1093.     cmpa    #$0C    ;0b1100
  1094.     bhi     LFCF4   ;if A > #$0C
  1095.     jsr     LFB81   ;loads a set of values from TABLE4
  1096.     jsr     LFBE7   ;Writes $24 & $1B val to PIA_BASE
  1097.     bra     LFD0E
  1098. ;
  1099. LFCF4:
  1100.     ;a > #12
  1101.     cmpa    #$1B    ;0b11011 #27
  1102.     bhi     LFD06
  1103.     ;a <= #27
  1104.     suba    #$0D    ;sub 13 from a, now a >= 0 && a <=14
  1105.     asla            ;double, a>=0 && a <= 28
  1106.     ldx     #JSR_TAB    ;start of branch table
  1107.     bsr     STEP_PNT0D  ;add A to X and pnt0D
  1108.     ldx     $00,x   ;$FD58 + ?
  1109.     jsr     $00,x   ;indirect branch
  1110.     bra     LFD0E
  1111. ;
  1112. LFD06:
  1113.     suba    #$1C    ;0 <= (A-28) < 3
  1114.     jsr     Lod13   ;load buf13 from table0, ($1B always = #$FF?)
  1115.     jsr     LF83F   ;Writes $1B(#$FF?) to PIA_BASE (Extra life sound?)
  1116. LFD0E:
  1117.     ldaa    flg04  
  1118.     oraa    X0005   ;or with flg04 value
  1119. LFD12:
  1120.     beq     LFD12   ;loop if flg04 & $05 = 0
  1121.     clra
  1122.     staa    flg07   ;clear
  1123.     ldaa    flg04
  1124.     beq     LFD1E
  1125.     jmp     LF913
  1126. LFD1E:
  1127.     jmp     LFB34
  1128. ;
  1129. ;A holds value to add to add to p0Dlo
  1130. ;subroutine, add a to counter, inc pnt0D when overflow
  1131. STEP_PNT0D:
  1132. LFD21:
  1133.     stx     pnt0D
  1134.     adda    p0Dlo
  1135.     staa    p0Dlo
  1136.     bcc     LFD2C
  1137.     inc     pnt0D   ;overflow
  1138. LFD2C:
  1139.     ldx     pnt0D
  1140.     rts
  1141. ;END LFD21 Subroutine
  1142. ;-----------------
  1143.  
  1144. ;FOR DEBUGGING
  1145. NMI:
  1146.     sei
  1147.     lds     #$007F  ;setup stack pointer
  1148.     ldx     #$FFFF
  1149.     clrb
  1150. LFD37:
  1151.     adcb    $00,x
  1152.     dex
  1153.     cpx     #$F800
  1154.     bne     LFD37
  1155.     cmpb    $00,x
  1156.     beq     LFD44
  1157.     wai             ;wait for interrupt
  1158. LFD44:
  1159.     ldaa    #$01
  1160.     jsr     Lod13   ;load buf13 from table0, offset 1
  1161.     jsr     LF83F   ;Writes $1B(#$FF?) to PIA_BASE (Extra Life sound?)
  1162.     ldab    $EFFA   ;speech synth ROM???
  1163.     cmpb    #$7E    ;$7E = jmp
  1164.     bne     NMI
  1165.     jsr     $EFFA   ;speech synth ROM???
  1166.     bra     NMI
  1167.    
  1168.     ORG $FD58 ;Branch table
  1169. JSR_TAB:
  1170. ;LFD58:
  1171.     dw  $FB49 ;subroutine addresses
  1172.     dw  $F913 ;1
  1173.     dw  $FB24 ;2
  1174.     dw  $F88C ;3
  1175.     dw  $FB71 ;4
  1176.     dw  $FB1E ;5
  1177.     dw  $F8CD ;6
  1178.     dw  $F894 ;7
  1179.     dw  $F91C ;8
  1180.     dw  $F923 ;9
  1181.     dw  $F9A6 ;10
  1182.     dw  $F9D4 ;11
  1183.     dw  $F9F3 ;12
  1184.     dw  $FA44 ;13
  1185.     dw  $FA84 ;14
  1186.    
  1187.     ORG $FD76   ;square wave params?, gets put in buf13
  1188. TABLE0:
  1189.     db $40  ;$13 hi delay
  1190.     db $01  ;$14 lo delay
  1191.     db $00  ;$15 hi change
  1192.     db $10  ;$16 lo change
  1193.     db $E1  ;$17 max low delay (#$E1-#$01)/#$10 = 14 syncs?
  1194.     db $00  ;pnt18 sync frequency
  1195.     db $80  ;p18lo sync
  1196.     db $FF  ;$1A hi change 2
  1197.     db $FF  ;$1B amplitude
  1198.     db $28,$01,$00,$08,$81,$02,$00,$FF,$FF;store in $13 - $1B
  1199.     db $28,$81,$00,$FC,$01,$02,$00,$FC,$FF
  1200.     db $FF,$01,$00,$18,$41,$04,$80,$00,$FF
  1201.    
  1202.     ORG $FD9A   ;loaded by LF9C2 into PIA_BASE
  1203.     db $8C,$5B,$B6,$40,$BF,$49,$A4,$73,$73,$A4,$49,$BF,$40,$B6,$5B,$8C
  1204.    
  1205.     ORG $FDAA
  1206. TABLE1:
  1207.     db $0C  ;0- linked list, offset to next element
  1208.     db $7F  ;1 store in $15
  1209.     db $1D  ;2 loop count for LFAB3
  1210.     db $0F  ;3 store in $13 pointer
  1211.     db $FB  ;4 lo byte of $13 pointer
  1212.     db $7F,$23,$0F,$15  ;$15, LFAB3, $13, $14
  1213.     db $FE,$08,$50,$8B  ;FDB3
  1214.     ;FDB7
  1215.     db $88  ;0- point to end of table
  1216.     db $3E  ;1 $15
  1217.     db $3F  ;2 loop count for LFAB3
  1218.     db $02  ;3 $13 pointer
  1219.     db $3E  ;4 lo $13 pointer
  1220.     db $7C,$04,$03,$FF  ;$15, LFAB3, $13, $14
  1221.     db $3E,$3F,$2C,$E2  ;FDC0
  1222.     db $7C,$12,$0D,$74  ;FDC4
  1223.     db $7C,$0D,$0E,$41  ;FDC8
  1224.     db $7C,$23,$0B,$50  ;FDCC
  1225.     db $7C,$1D,$29,$F2  ;FDD0
  1226.     db $7C,$3F,$02,$3E
  1227.     db $F8,$04,$03,$FF
  1228.     db $7C,$3F,$2C,$E2
  1229.     db $F8,$12,$0D,$74
  1230.     db $F8,$0D,$0E,$41
  1231.     db $F8,$23,$0B,$50
  1232.     db $F8,$1D,$2F,$F2
  1233.     db $F8,$23,$05,$A8
  1234.     db $F8,$12,$06,$BA
  1235.     db $F8,$04,$07,$FF
  1236.     db $7C,$37,$04,$C1
  1237.     db $7C,$23,$05,$A8
  1238.     db $7C,$12,$06,$BA
  1239.     db $3E,$04,$07,$FF
  1240.     db $3E,$37,$04,$C1
  1241.     db $3E,$23,$05,$A8
  1242.     db $1F,$12,$06,$BA
  1243.     db $1F,$04,$07,$FF
  1244.     db $1F,$37,$04,$C1
  1245.     db $1F,$23,$16,$A0
  1246.     db $FE,$1D,$17,$F9
  1247.     db $7F,$37,$13,$06
  1248.     db $7F,$3F,$08,$FA
  1249.     db $FE,$04,$0F,$FF
  1250.     db $FE,$0D,$0E,$41
  1251.     db $FE,$23,$0B,$50
  1252.     db $FE,$1D,$5F,$E4
  1253.     ;FE40
  1254.     db $00 ;zero terminated
  1255.    
  1256.     ORG $FE41 ;rate table
  1257. TABLE2:
  1258.     db $47,$3F,$37,$30,$29,$23,$1D,$17,$12,$0D,$08,$04
  1259.    
  1260.     ORG $FE4D ;audible waveforms
  1261. TABLE3:
  1262.     db $08  ;sample length
  1263.     ORG $FE4E   ;hi amp small sinewave
  1264.     db $7F,$D9,$FF,$D9,$7F,$24,$00,$24
  1265.    
  1266.     ORG $FE56   ;fragmented wave
  1267.     db $08  ;sample length
  1268.     db $00,$40,$80,$00,$FF,$00,$80,$40
  1269.    
  1270.     db $10  ;sample length
  1271.     ORG $FE60   ;small sine
  1272.     db $7F,$B0,$D9,$F5,$FF,$F5,$D9,$B0,$7F,$4E,$24,$09,$00,$09,$24,$4E
  1273.    
  1274.     db $10  ;sample length
  1275.     ORG $FE69   ;wiggly sine wave
  1276.     db $7F,$C5,$EC,$E7,$BF,$8D,$6D,$6A,$7F,$94,$92,$71,$40,$17,$12,$39
  1277.    
  1278.     db $10  ;sample length
  1279.     ORG $FE82 ;max amp big square wave
  1280.     db $FF,$FF,$FF,$FF,$00,$00,$00,$00,$FF,$FF,$FF,$FF,$00,$00,$00,$00
  1281.    
  1282.     db $48  ;sample length
  1283.     ORG $FE93 ;large sine
  1284.     db $8A,$95,$A0,$AB,$B5,$BF,$C8,$D1,$DA,$E1,$E8,$EE,$F3,$F7,$FB,$FD
  1285.     db $FE,$FF,$FE,$FD,$FB,$F7,$F3,$EE,$E8,$E1,$DA,$D1,$C8,$BF,$B5,$AB
  1286.     db $A0,$95,$8A,$7F,$75,$6A,$5F,$54,$4A,$40,$37,$2E,$25,$1E,$17,$11
  1287.     db $0C,$08,$04,$02,$01,$00,$01,$02,$04,$08,$0C,$11,$17,$1E,$25,$2E
  1288.     db $37,$40,$4A,$54,$5F,$6A,$75,$7F
  1289.    
  1290.     ORG $‭FEDB‬ ;small sine#2
  1291.     db $10  ;sample length
  1292.     db $59,$7B,$98,$AC,$B3,$AC,$98,$7B,$59,$37,$19,$06,$00,$06,$19,$37
  1293.    
  1294.     ORG $FEEC ;
  1295. TABLE4:
  1296.     db $81  ;0 store in $14, and $13
  1297.     db $24  ;1 hi in $15, lo in $11 = wave to subtract ($FE82 ;max amp big square wave)
  1298.     db $00  ;2 store in $1A = subtraction multipler
  1299.     db $00  ;3 store in $16
  1300.     db $00  ;4 store in $17
  1301.     db $16  ;5 store in pnt1D + #TABLE5 (table length)
  1302.     db $31  ;6 TABLE5 pitch envelope offset ($FF86 ;non-linear bigger ramp)
  1303.    
  1304.     db $12  ;0-
  1305.     db $05  ;1  ($FE93 ;large sine)
  1306.     db $1A  ;2 subtraction multipler
  1307.     db $FF  ;3
  1308.     db $00  ;4
  1309.     db $27  ;5 length
  1310.     db $6D  ;6 TABLE5 $FFC2 ;low amp expo triangle
  1311.    
  1312.     db $11  ;0-
  1313.     db $05  ;1  ($FE93 ;large sine)
  1314.     db $11  ;2 subtraction multipler
  1315.     db $01  ;3
  1316.     db $0F  ;4
  1317.     db $01  ;5 length
  1318.     db $47  ;6 TABLE5 $FF9C ;low amp small square
  1319.    
  1320.     db $11  ;0-
  1321.     db $31  ;1  ($FE56  ;fragmented wave)
  1322.     db $00  ;2 subtraction multipler
  1323.     db $01  ;3
  1324.     db $00  ;4
  1325.     db $0D  ;5 length
  1326.     db $1B  ;6 TABLE5 $FF70 ;low amp saw wave table
  1327.    
  1328.     db $F4  ;0-
  1329.     db $12  ;1  ($FE60  ;small sine)
  1330.     db $00  ;2 subtraction multipler
  1331.     db $00  ;3
  1332.     db $00  ;4
  1333.     db $14  ;5 length
  1334.     db $47  ;6 TABLE5 $FF9C ;low amp small square
  1335.    
  1336.     db $41  ;0-
  1337.     db $45  ;1  ($FE93 ;large sine)
  1338.     db $00  ;2 subtraction multipler
  1339.     db $00  ;3
  1340.     db $00  ;4
  1341.     db $0F  ;5 length
  1342.     db $5B  ;6 TABLE5 $FFB0 ;low amp ramp with 'blip'
  1343.    
  1344.     db $21  ;0-
  1345.     db $35  ;1  ($FE93 ;large sine)
  1346.     db $11  ;2 subtraction multipler
  1347.     db $FF  ;3
  1348.     db $00  ;4
  1349.     db $0D  ;5 length
  1350.     db $1B  ;6 TABLE5 $FF70 ;low amp saw wave table
  1351.    
  1352.     db $15  ;0-
  1353.     db $00  ;1  ($FE4E  ;hi amp small sinewave)
  1354.     db $00  ;2 subtraction multipler
  1355.     db $FD  ;3
  1356.     db $00  ;4
  1357.     db $01  ;5 length
  1358.     db $69  ;6 TABLE5 $FFBE ;???
  1359.    
  1360.     db $31  ;0-
  1361.     db $11  ;1  ($FE56  ;fragmented wave)
  1362.     db $00  ;2 subtraction multipler
  1363.     db $01  ;3
  1364.     db $00  ;4
  1365.     db $03  ;5 length
  1366.     db $6A  ;6 TABLE5 $FFBF ;???
  1367.    
  1368.     db $01  ;0-
  1369.     db $15  ;1  ($FE93 ;large sine)
  1370.     db $01  ;2 subtraction multipler
  1371.     db $01  ;3
  1372.     db $01  ;4
  1373.     db $01  ;5 length
  1374.     db $47  ;6 TABLE5 $FF9C ;low amp small square
  1375.    
  1376.     db $F6  ;0-
  1377.     db $53  ;1  ($FE69  ;wiggly sine wave)
  1378.     db $03  ;2 subtraction multipler
  1379.     db $00  ;3
  1380.     db $02  ;4
  1381.     db $06  ;5 length
  1382.     db $94  ;6 TABLE5 $FFE9 ;very low amp saw
  1383.    
  1384.     db $6A  ;0-
  1385.     db $10  ;1  ($FE4E  ;hi amp small sinewave)
  1386.     db $02  ;2 subtraction multipler
  1387.     db $00  ;3
  1388.     db $02  ;4
  1389.     db $06  ;5 length
  1390.     db $9A  ;6 TABLE5 $FFEF ;???
  1391.    
  1392.     db $1F  ;0-
  1393.     db $12  ;1  ($FE60  ;small sine)
  1394.     db $00  ;2 subtraction multipler
  1395.     db $FF  ;3
  1396.     db $10  ;4
  1397.     db $04  ;5 length
  1398.     db $69  ;6 TABLE5 $FFBE ;sub-ramp
  1399.    
  1400.     db $31  ;0-
  1401.     db $11  ;1  ($FE56  ;fragmented wave)
  1402.     db $00  ;2 subtraction multipler
  1403.     db $FF  ;3
  1404.     db $00  ;4
  1405.     db $0D  ;5 length
  1406.     db $00  ;6 TABLE5 $FF55 ;ramp
  1407.    
  1408.     db $12  ;0-
  1409.     db $06  ;1  ($‭FEDB‬ ;small sine#2)
  1410.     db $00  ;2 subtraction multipler
  1411.     db $FF  ;3
  1412.     db $01  ;4
  1413.     db $09  ;5 length
  1414.     db $28  ;6 TABLE5 $FF7D ;low amp tri table
  1415.    
  1416.     ORG $FF55 ;modulation envelopes
  1417. TABLE5:
  1418.     ;ramp table - $0D long?
  1419.     db $A0,$98,$90,$88,$80,$78,$70,$68,$60,$58,$50,$44,$40
  1420.    
  1421.     ORG $FF63 ;hi amp expo ramp table
  1422.     db $01,$01,$02,$02,$04,$04,$08,$08,$10,$10,$30,$60,$C0,$E0,$01,$01
  1423.    
  1424.     ORG $FF70 ;low amp ramp table - $0D long?
  1425.     db $02,$02,$03,$04,$05,$06,$07,$08,$09,$0A,$0C
  1426.    
  1427.     ORG $FF7D ;low amp tri table - $9-$0D long?
  1428.     db $80,$7C,$78,$74,$70,$74,$78,$7C,$80
  1429.    
  1430.     ORG $FF86 ;non-linear bigger ramp - $16 long
  1431.     db $01,$01,$02,$02,$04,$04,$08,$08,$10,$20,$28,$30,$00,$38,$08,$40
  1432.     db $48,$50,$60,$70,$80,$A0
  1433.    
  1434.     ORG $FF9C ;low amp small square - $1-$14 long?
  1435.     db $B0,$C0,$08,$40,$08,$40,$08,$40,$08,$40,$08,$40,$08,$40,$08,$40
  1436.     db $08,$40,$08,$40,$08,$40
  1437.    
  1438.     ORG $FFB0 ;low amp ramp with 'blip' - $0F long
  1439.     db $01,$02,$04,$08,$09,$0A,$0B,$0C,$0E,$0F,$10,$12,$14,$16
  1440.     ORG $FFBE ;sub-ramp - $1-$4 long
  1441.     db $40
  1442.     ORG $FFBF ;?sub sub-ramp - $3 long
  1443.     $10,$08,$01
  1444.    
  1445.     ORG $FFC2 ;low amp expo triangle - $27 long
  1446.     db $01,$01,$01,$01,$02,$02,$03,$03,$04,$04,$05,$06,$08,$0A,$0C,$10
  1447.     db $14,$18,$20,$30,$40,$50,$40,$30,$20,$10,$0C,$0A,$08,$07,$06,$05
  1448.     db $04,$03,$02,$02,$01,$01,$01
  1449.    
  1450.     ORG $FFE9 ;very low amp ramp  with 'blip' in middle - $6 long?
  1451.     db $07,$08,$09,$0A,$0C,$08,$17
  1452.     ORG $FFEF ;?? - $6 long?
  1453.     db $18,$19,$1A,$1B,$1C,$00,$00
  1454.     db $00
  1455.  
  1456.     ORG $FFF8
  1457.     dw $FCB6 ;IRQ
  1458.     dw $F801 ;SoI
  1459.     dw $FD2F ;NMI
  1460.     dw $F801 ;RST
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement