Whisket

Atari Adventure

Oct 8th, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.       processor 6502                                                                                              
  2. ;Default 2600 Constants set up by dissasembler..                                                                  
  3. VSYNC   =  $00                                                                                                    
  4. VBLANK  =  $01                                                                                                    
  5. WSYNC   =  $02                                                                                                    
  6. RSYNC   =  $03                                                                                                    
  7. NUSIZ0  =  $04                                                                                                    
  8. NUSIZ1  =  $05                                                                                                    
  9. COLUP0  =  $06                                                                                                    
  10. COLUP1  =  $07                                                                                                    
  11. COLUPF  =  $08                                                                                                    
  12. COLUBK  =  $09                                                                                                    
  13. CTRLPF  =  $0A                                                                                                    
  14. PF0     =  $0D                                                                                                    
  15. PF1     =  $0E                                                                                                    
  16. PF2     =  $0F                                                                                                    
  17. RESP0   =  $10                                                                                                    
  18. AUDC0   =  $15                                                                                                    
  19. AUDF0   =  $17                                                                                                    
  20. AUDV0   =  $19                                                                                                    
  21. AUDV1   =  $1A                                                                                                    
  22. GRP0    =  $1B                                                                                                    
  23. GRP1    =  $1C                                                                                                    
  24. ENAM0   =  $1D                                                                                                    
  25. ENAM1   =  $1E                                                                                                    
  26. ENABL   =  $1F                                                                                                    
  27. HMP0    =  $20                                                                                                    
  28. VDEL01  =  $26                                                                                                    
  29. HMOVE   =  $2A                                                                                                    
  30. HMCLR   =  $2B                                                                                                    
  31. CXCLR   =  $2C                                                                                                    
  32. CXP0FB  =  $32                                                                                                    
  33. CXP1FB  =  $33                                                                                                    
  34. CXM0FB  =  $34                                                                                                    
  35. CXM1FB  =  $35                                                                                                    
  36. CXBLPF  =  $36                                                                                                    
  37. CXPPMM  =  $37                                                                                                    
  38. INPT4   =  $3C                                                                                                    
  39. SWCHA   =  $0280                                                                                                  
  40. SWCHB   =  $0282                                                                                                  
  41. INTIM   =  $0284                                                                                                  
  42. TIM64T  =  $0296                                                                                                  
  43.                                                                                                                    
  44.        ORG $F000                                                                                                  
  45.                                                                                                                    
  46. START:                                                                                                            
  47.        JMP    StartGame           ;Jump To Start Game                                                        ;3    
  48.                                                                                                                    
  49.                                                                                                                    
  50. ;Alternate Start                                                                                                  
  51.       .byte $78,$D8,$4C,$06,$F3  ;Setup for 6507, Start with no Variable Initialisation.                      
  52.                                                                                                                    
  53. ;Print Display                                                                                                    
  54. PrintDisplay:                                                                                                            
  55.        STA    HMCLR               ;Clear horzontal motion.                                                   ;3    
  56.        LDA    $86                 ;Position Player00 Sprite To                                               ;3    
  57.        LDX    #$00                ;      the X Coordinate of Object1.                                        ;2    
  58.        JSR    PosSpriteX                                                                                     ;6    
  59.                                                                                                                    
  60.        LDA    $88                 ;Position Player01 Sprite to                                               ;3    
  61.        LDX    #$01                ;      the X Coordinate of Object2.                                        ;2    
  62.        JSR    PosSpriteX                                                                                     ;6    
  63.                                                                                                                    
  64.        LDA    $8B                 ;Position Ball Strite to                                                   ;3    
  65.        LDX    #$04                ;      the X Coordinate of the Man.                                        ;2    
  66.        JSR    PosSpriteX                                                                                     ;6    
  67.                                                                                                                    
  68.        STA    WSYNC               ;Wait for horizontal Blank.                                                ;3    
  69.        STA    HMOVE               ;Apply Horizontal Motion.                                                  ;3    
  70.        STA    CXCLR               ;Clear Collision Latches.                                                  ;3    
  71.                                                                                                                    
  72.        LDA    $8C                 ;Get the Y Coordinate of the Man.                                          ;3    
  73.        SEC                                                                                                   ;2    
  74.        SBC    #$04                ;And Adjust it (By Four Scan Lines)                                        ;2    
  75.        STA    $8D                 ;      for printing (so Y Coordinate Specifies Middle)                     ;3    
  76.                                                                                                                    
  77. PrintDisplay_1:
  78.      LDA    INTIM               ;Wait for end of the                                                       ;4    
  79.        BNE    PrintDisplay_1      ;      current fame.                                                       ;2    
  80.                                                                                                                    
  81.        LDA    #$00                                                                                           ;2    
  82.        STA    $90                 ;Set Player00 definition index.                                            ;3    
  83.        STA    $91                 ;Set Player01 definition index.                                            ;3    
  84.        STA    $8F                 ;Set room definition index.                                                ;3    
  85.        STA    GRP1                ;Clear any graphics for Player01.                                          ;3    
  86.        LDA    #$01                                                                                           ;2    
  87.        STA    VDEL01              ;vertically delay Player 01                                                ;3    
  88.        LDA    #$68                                                                                           ;2    
  89.        STA    $8E                 ;Set Scan Lind Count.                                                      ;3    
  90.                                                                                                                    
  91. ;Print top line of Room.                                                                                          
  92.        LDY    $8F                 ;Get room definition index.                                                ;3    
  93.        LDA    ($80),Y             ;Get first room definition byte.                                           ;5    
  94.        STA    PF0                 ;      and display.                                                        ;3    
  95.        INY                                                                                                   ;2    
  96.        LDA    ($80),Y             ;Get Next room definition byte.                                            ;5    
  97.        STA    PF1                 ;      and display.                                                        ;3    
  98.        INY                                                                                                   ;2    
  99.        LDA    ($80),Y             ;Get Last room defintion byte.                                             ;5    
  100.        STA    PF2                 ;      and display.                                                        ;3    
  101.        INY                                                                                                   ;2    
  102.        STY    $8F                 ;Save for Next Time.                                                       ;3    
  103.                                                                                                                    
  104.        STA    WSYNC               ;Wait for Horizontal Blank.                                                ;3    
  105.        LDA    #$00                                                                                           ;2    
  106.        STA    VBLANK              ;Clear any Vertical Blank.                                                 ;3    
  107.        JMP    PrintPlayer00                                                                                          ;3    
  108.                                                                                                                    
  109.                                                                                                                    
  110. ;Print Player01 (Object 02)                                                                                        
  111. PrintPlayer01:
  112.        LDA    $8E                 ;Get Current Scan Line.                                                    ;3    
  113.        SEC                        ;Have we reached Object2's                                                 ;2    
  114.        SBC    $89                 ;      Y Coordinate?                                                       ;3    
  115.        STA    WSYNC               ;      Wait for Horzonal Blank.                                            ;3    
  116.        BPL    PrintPlayer00       ;If Not, Branch.                                                           ;2    
  117.                                                                                                                    
  118.        LDY    $91                 ;Get the Player01 definition index.                                        ;3    
  119.        LDA    ($84),Y             ;Get the Next Player01 Definition byte                                     ;5    
  120.        STA    GRP1                ;      and display.                                                        ;3    
  121.        BEQ    PrintPlayer00       ;If Zero then Definition finished.                                         ;2    
  122.                                                                                                                    
  123.        INC    $91                 ;Goto next Player01 definition byte.                                       ;5    
  124.                                                                                                                    
  125. ;Print Player00 (Object01), Ball (Man) and Room.
  126. PrintPlayer00:                                                                  
  127.      LDX    #$00                                                                                           ;2    
  128.        LDA    $8E                 ;Get the Current Scan Line.                                                ;3    
  129.        SEC                        ;Have we reached the Object1's                                             ;2    
  130.        SBC    $87                 ;      Y coordinate?                                                       ;3    
  131.        BPL    PrintPlayer00_1     ;If not then Branch.                                                       ;2    
  132.                                                                                                                    
  133.        LDY    $90                 ;Get Player00 definition index.                                            ;3    
  134.        LDA    ($82),Y             ;Get the Next Player00 definition byte.                                    ;5    
  135.        TAX                                                                                                   ;2    
  136.        BEQ    PrintPlayer00_1     ;If Zero then Definition finished.                                         ;2    
  137.                                                                                                                    
  138.        INC    $90                 ;Go to Next Player00 definition byte.                                      ;5    
  139.  
  140. PrintPlayer00_1:                                                                                                                  
  141.      LDY    #$00                ;Disable Ball Graphic.                                                     ;2    
  142.        LDA    $8E                 ;Get Scan line count.                                                      ;3    
  143.        SEC                        ;Have we reached the Man's                                                 ;2    
  144.        SBC    $8D                 ;      Y Coordinate?                                                       ;3    
  145.        AND    #$FC                ;Mask value to four either side (getting depth of 8)                       ;2    
  146.        BNE    PrintPlayer00_2     ;If Not, Branch.                                                           ;2    
  147.                                                                                                                    
  148.        LDY    #$02                ;Enable Ball Graphic.                                                      ;2    
  149.  
  150. PrintPlayer00_2:                                                                                                                  
  151.        LDA    $8E                 ;Get Scan Line Count.                                                      ;3    
  152.        AND    #$0F                ;Have we reached a sixteenth scan line.                                    ;2    
  153.        BNE    PrintPlayer00_4     ;If not, Branch.                                                           ;2    
  154.                                                                                                                    
  155.        STA    WSYNC               ;Wait for Horzontal Blank.                                                 ;3    
  156.        STY    ENABL               ;Enable Ball (If Wanted)                                                   ;3    
  157.        STX    GRP0                ;Display Player 00 definition byte (if wanted)                             ;3    
  158.                                                                                                                    
  159.        LDY    $8F                 ;Get room definition index.                                                ;3    
  160.        LDA    ($80),Y             ;Get first room definition byte,                                           ;5    
  161.        STA    PF0                 ;      and display.                                                        ;3    
  162.        INY                                                                                                   ;2    
  163.        LDA    ($80),Y             ;Get next room definition byte,                                            ;5    
  164.        STA    PF1                 ;      and display.                                                        ;3    
  165.        INY                                                                                                   ;2    
  166.        LDA    ($80),Y             ;Get next room definition byte,                                            ;5    
  167.        STA    PF2                 ;      and display.                                                        ;3    
  168.        INY                                                                                                   ;2    
  169.        STY    $8F                 ;Save for Next Time.                                                       ;3    
  170.  
  171. PrintPlayer00_3:                                                                                                                  
  172.        DEC    $8E                 ;Goto next scan line.                                                      ;5    
  173.        LDA    $8E                 ;Get the scan line.                                                        ;3    
  174.        CMP    #$08                ;Have we reached to within 8 scanlines of the bottom?                      ;2    
  175.        BPL    PrintPlayer01       ;If not, Branch.                                                           ;2    
  176.                                                                                                                    
  177.        STA    VBLANK              ;Turn on VBLANK                                                            ;3    
  178.        JMP    TidyUp                                                                                        ;3    
  179.                                                                                                                    
  180. ;Print Player00 (Object 01) and Ball (Man)  
  181. PrintPlayer00_4:                                                                      
  182.        STA    WSYNC               ;Wait for Horzontal blank.                                                 ;3    
  183.        STY    ENABL               ;Enable Ball (If Wanted.)                                                  ;3    
  184.        STX    GRP0                ;Display Player00 definition byte (if Wanted).                             ;3    
  185.        JMP    PrintPlayer00_3                                                                                          ;3    
  186.                                                                                                                    
  187. ;Tidy Up                                                                                                          
  188. TidyUp:
  189.        LDA    #$00                                                                                           ;2    
  190.        STA    GRP1                ;Clear any graphics for Player01                                           ;3    
  191.        STA    GRP0                ;Clear any graphics for Player00                                           ;3    
  192.        LDA    #$20                                                                                           ;2    
  193.        STA    TIM64T              ;Stat Timing this frame using                                              ;4    
  194.        RTS                        ;      the 64 bit counter.                                                 ;6    
  195.                                                                                                                    
  196.                                                                                                                    
  197. ;Position Sprite X horizontally.
  198. PosSpriteX:                                                                                  
  199.        LDY    #$02                ;Start with 10 clock cycles (to avoid HBLANK)                              ;2    
  200.        SEC                        ;Divide the Coordinate.                                                    ;2    
  201. PosSpriteX_1:
  202.        INY                        ;      Wanted by Fifteen I.E.                                              ;2    
  203.        SBC    #$0F                ;      Get Course Horizontal                                               ;2    
  204.        BCS    PosSpriteX_1        ;      Value (In Multiples of 5 Clock Cycles                               ;2    
  205.                                   ;      (Therefore giving 15 Color Cycles)                                      
  206.        EOR    #$FF                ;Flip remanter to positive value (inverted).                               ;2    
  207.        SBC    #$06                ;Convert to left or right of current position.                             ;2    
  208.        ASL                                                                                                   ;2    
  209.        ASL                        ;Move to high nybble for TIA                                               ;2    
  210.        ASL                        ;      horizontal motion.                                                  ;2    
  211.        ASL                                                                                                   ;2    
  212.        STY    WSYNC               ;Wait for horozontal blank.                                                ;3    
  213.  
  214. PosSpriteX_2:                                                                                                                  
  215.        DEY                        ;Count down the color                                                      ;2    
  216.        BPL    PosSpriteX_2        ;      cycles (these are 5 machine/15 color cycles).                       ;2    
  217.                                                                                                                    
  218.        STA    RESP0,X             ;Reset the sprite, thus positioning it coursely.                           ;4    
  219.        STA    HMP0,X              ;Set horizontal (fine) motion of sprite.                                   ;4    
  220.        RTS                                                                                                   ;6    
  221.                                                                                                                    
  222.                                                                                                                    
  223. ;Preform VSYNC  
  224. DoVSYNC:                                                                                                  
  225.        LDA    INTIM               ;Get Timer Output                                                          ;4    
  226.        BNE    DoVSYNC             ;Wait for Time-Out                                                         ;2    
  227.        LDA    #$02                                                                                           ;2    
  228.        STA    WSYNC               ;Wait for horizonal blank.                                                 ;3    
  229.        STA    VBLANK              ;Start Vertical Blanking.                                                  ;3    
  230.        STA    WSYNC               ;Wait for horizonal blank.                                                 ;3    
  231.        STA    WSYNC               ;Wait for horizonal blank.                                                 ;3    
  232.        STA    WSYNC               ;Wait for horizonal blank.                                                 ;3    
  233.        STA    VSYNC               ;Start verticle sync.                                                      ;3    
  234.        STA    WSYNC               ;Wait for horizonal blank.                                                 ;3    
  235.        STA    WSYNC               ;Wait for horizonal blank.                                                 ;3    
  236.        LDA    #$00                                                                                           ;2    
  237.        STA    WSYNC               ;Wait for horizonal blank.                                                 ;3    
  238.        STA    VSYNC               ;End Vertical sync.                                                        ;3    
  239.        LDA    #$2A                ;Set clock interval to                                                     ;2    
  240.        STA    TIM64T              ;Countdown next frame.                                                     ;4    
  241.        RTS                                                                                                   ;6    
  242.                                                                                                                    
  243. ;Setup a room for print.                                                                                          
  244. SetupRoomPrint:
  245.        LDA    $8A                 ;Get current room number.                                                  ;3    
  246.        JSR    RoomNumToAddress    ;Convert it to an address.                                                 ;6    
  247.        LDY    #$00                                                                                           ;2    
  248.        LDA    ($93),Y             ;Get low pointer to room                                                   ;5    
  249.        STA    $80                 ;      Graphics                                                            ;3    
  250.        LDY    #$01                                                                                           ;2    
  251.        LDA    ($93),Y             ;Get high pointer to room                                                  ;5    
  252.        STA    $81                 ;      Graphics                                                            ;3    
  253.                                                                                                                    
  254. ;Check B&W Switch for foom graphics.                                                                              
  255.        LDA    SWCHB               ;Get console switches.                                                     ;4    
  256.        AND    #$08                ;Check black and white switch                                              ;2    
  257.        BEQ    UseBW               ;Branch if B&W.                                                            ;2    
  258.                                                                                                                    
  259. ;Use Color                                                                                                        
  260.        LDY    #$02                                                                                           ;2    
  261.        LDA    ($93),Y             ;Get room color                                                            ;5    
  262.        JSR    ChangeColor         ;Change if necessary                                                       ;6    
  263.        STA    COLUPF              ;Put in Playfiled color register.                                          ;3    
  264.        JMP    UseColor                                                                                          ;3    
  265.                                                                                                                    
  266. ;Use B&W                                                                                                          
  267. UseBW:
  268.        LDY    #$03                                                                                           ;2    
  269.        LDA    ($93),Y             ;Get B&W Color                                                             ;5    
  270.        JSR    ChangeColor         ;Change if necessary                                                       ;6    
  271.        STA    COLUPF              ;Put in the Playfield color register.                                      ;3    
  272.                                                                                                                    
  273. ;Color Background.
  274. UseColor:                                                                                                
  275.        LDA    #$08                ;Get light grey background                                                 ;2    
  276.        JSR    ChangeColor         ;Change if necessary                                                       ;6    
  277.        STA    COLUBK              ;Put it in the Background color register.                                  ;3    
  278.                                                                                                                    
  279. ;Playfield Control.                                                                                                
  280.        LDY    #$04                                                                                           ;2    
  281.        LDA    ($93),Y             ;Get the playfield control value.                                          ;5    
  282.        STA    CTRLPF              ;And put in the playfield control register.                                ;3    
  283.        AND    #$C0                ;Get the "this wall" flag.                                                 ;2    
  284.        LSR                                                                                                   ;2    
  285.        LSR                                                                                                   ;2    
  286.        LSR                        ;Get the first bit into position.                                          ;2    
  287.        LSR                                                                                                   ;2    
  288.        LSR                                                                                                   ;2    
  289.        STA    ENAM1               ;Enable right hand thin wall. (if wanted - missile01)                      ;3    
  290.        LSR                                                                                                   ;2    
  291.        STA    ENAM0               ;Enable left hand thin wall (if wanted - missle00)                         ;3    
  292.                                                                                                                    
  293. ;Get objects to display.                                                                                          
  294.        JSR    CacheObjects        ;Get next two objects to display.                                          ;6    
  295.                                                                                                                    
  296. ;Sort out their order.                                                                                            
  297.        LDA    $95                 ;If the object1 is the                                                     ;3    
  298.        CMP    #$00                ;Invisible surround                                                        ;2    
  299.        BEQ    SwapPrintObjects    ;Then branch to swap (we want it as player01)                              ;2    
  300.                                                                                                                    
  301.        CMP    #$5A                ;If the first object is the bridge then                                    ;2    
  302.        BNE    SetupObjectPrint    ;Swap the objects (we want it as player01)                                 ;2    
  303.                                                                                                                    
  304.        LDA    $96                 ;If the object2 is the                                                     ;3    
  305.        CMP    #$00                ;Invisble surround then branch to leave                                    ;2    
  306.        BEQ    SetupObjectPrint    ;it (we want it as player01)                                               ;2    
  307.  
  308. SwapPrintObjects:                                                                                                                  
  309.        LDA    $95                                                                                            ;3    
  310.        STA    $D8                                                                                            ;3    
  311.        LDA    $96                                                                                            ;3    
  312.        STA    $95                 ;Swap the objects to print.                                                ;3    
  313.        LDA    $D8                                                                                            ;3    
  314.        STA    $96                                                                                            ;3    
  315.                                                                                                                    
  316. ;Setup Object1 to print.                                                                                          
  317. SetupObjectPrint:
  318.        LDX    $95                 ;Get Object1                                                               ;3    
  319.        LDA    Store1,X             ;Get low pointer to it's dynamic information.                              ;4    
  320.        STA    $93                                                                                            ;3    
  321.        LDA    Store2,X             ;Get high pointer to it's dynamic informtion.                              ;4    
  322.        STA    $94                                                                                            ;3    
  323.                                                                                                                    
  324.        LDY    #$01                                                                                           ;2    
  325.        LDA    ($93),Y             ;Get Object1's X coordinate                                                ;5    
  326.        STA    $86                 ;and Store for print.                                                      ;3    
  327.        LDY    #$02                                                                                           ;2    
  328.        LDA    ($93),Y             ;Get Object1's Y coordinate                                                ;5    
  329.        STA    $87                 ;and Store for print.                                                      ;3    
  330.                                                                                                                    
  331.        LDA    Store3,X             ;Get low pointer to state value.                                           ;4    
  332.        STA    $93                                                                                            ;3    
  333.        LDA    Store4,X             ;Get high pointer to state value.                                          ;4    
  334.        STA    $94                                                                                            ;3    
  335.        LDY    #$00                                                                                           ;2    
  336.        LDA    ($93),Y             ;Retrieve Object1's current state.                                         ;5    
  337.        STA    $DC                                                                                            ;3    
  338.                                                                                                                    
  339.        LDA    Store5,X             ;Get low pointer to state information.                                     ;4    
  340.        STA    $93                                                                                            ;3    
  341.        LDA    Store6,X             ;Get high pointer to state information.                                    ;4    
  342.        STA    $94                                                                                            ;3    
  343.        JSR    GetObjectState      ;Find current state in the state information.                              ;6    
  344.                                                                                                                    
  345.        INY                        ;Index to the state's corresponding graphic pointer.                       ;2    
  346.        LDA    ($93),Y             ;Get Object1's low graphic address                                         ;5    
  347.        STA    $82                 ;and store for print.                                                      ;3    
  348.        INY                                                                                                   ;2    
  349.        LDA    ($93),Y             ;Get Object1's high graphic address                                        ;5    
  350.        STA    $83                 ;and store for print.                                                      ;3    
  351.                                                                                                                    
  352. ;Check B&W for object01                                                                                            
  353.        LDA    SWCHB               ;Get console switches                                                      ;4    
  354.        AND    #$08                ;Check B&W switches.                                                       ;2    
  355.        BEQ    MakeObjectBW        ;Branch if B&W.                                                            ;2    
  356.                                                                                                                    
  357. ;Colour                                                                                                            
  358.        LDA    Store7,X             ;Get Object1's Color.                                                      ;4    
  359.        JSR    ChangeColor         ;Change if necessary.                                                      ;6    
  360.        STA    COLUP0              ;And set color luminance00.                                                ;3    
  361.        JMP    ResizeObject                                                                                          ;3    
  362.                                                                                                                    
  363. ;B&W
  364. MakeObjectBW:                                                                                                              
  365.        LDA    Store8,X             ;Get Object's B&W Color.                                                   ;4    
  366.        JSR    ChangeColor         ;Change if necessary.                                                      ;6    
  367.        STA    COLUP0              ;Set color luminance00.                                                    ;3    
  368.                                                                                                                    
  369. ;Object1 Size
  370. ResizeObject:                                                                                                    
  371.        LDA    Store9,X             ;Get Object1's Size                                                        ;4    
  372.        ORA    #$10                ;And set to larger size if necessary.                                      ;2    
  373.        STA    NUSIZ0              ;(Used by bridge and invisible surround)                                   ;3    
  374.                                                                                                                    
  375. ;Setup Object 2 to Print.                                                                                          
  376.        LDX    $96                 ;Get Object 2                                                              ;3    
  377.        LDA    Store1,X                                                                                        ;4    
  378.        STA    $93                 ;Get low pointer to it's dynamic information.                              ;3    
  379.        LDA    Store2,X                                                                                        ;4    
  380.        STA    $94                 ;Get high pointer to it's dynamic information.                             ;3    
  381.        LDY    #$01                                                                                           ;2    
  382.        LDA    ($93),Y             ;Get Object2's X coordinate                                                ;5    
  383.        STA    $88                 ;and store for print.                                                      ;3    
  384.        LDY    #$02                                                                                           ;2    
  385.        LDA    ($93),Y             ;Get Object2's Y coordinate                                                ;5    
  386.        STA    $89                 ;and store for print.                                                      ;3    
  387.        LDA    Store3,X             ;Get low pointer to state value.                                           ;4    
  388.        STA    $93                                                                                            ;3    
  389.        LDA    Store4,X             ;Get high pointer to state value.                                          ;4    
  390.        STA    $94                                                                                            ;3    
  391.                                                                                                                    
  392.                                                                                                                    
  393.        LDY    #$00                                                                                           ;2    
  394.        LDA    ($93),Y             ;Retrieve Object2's current state.                                         ;5    
  395.        STA    $DC                                                                                            ;3    
  396.        LDA    Store5,X             ;Get low pointer to state information.                                     ;4    
  397.        STA    $93                                                                                            ;3    
  398.        LDA    Store6,X             ;Get high pointer to state information.                                    ;4    
  399.        STA    $94                                                                                            ;3    
  400.        JSR    GetObjectState      ;Find the current state in the state information.                          ;6    
  401.                                                                                                                    
  402.        INY                        ;Index to the state's corresponding graphic pointer.                       ;2    
  403.        LDA    ($93),Y                                                                                        ;5    
  404.        STA    $84                 ;Get Object2's low graphic address.                                        ;3    
  405.        INY                                                                                                   ;2    
  406.        LDA    ($93),Y             ;Get Object2's high graphic address.                                       ;5    
  407.        STA    $85                                                                                            ;3    
  408.                                                                                                                    
  409. ;Check B&W for Object2                                                                                            
  410.        LDA    SWCHB               ;Get Console Switches                                                      ;4    
  411.        AND    #$08                ;Check B&W Switch.                                                         ;2    
  412.        BEQ    MakeObject2BW       ;If B&W then Branch.                                                       ;2    
  413.                                                                                                                    
  414. ;Color                                                                                                            
  415.        LDA    Store7,X             ;Get Object2;s Color                                                       ;4    
  416.        JSR    ChangeColor         ;Change if Necessary.                                                      ;6    
  417.        STA    COLUP1              ;and set color luminance01.                                                ;3    
  418.        JMP    ResizeObject2                                                                                  ;3    
  419.                                                                                                                    
  420. ;B&W
  421. MakeObject2BW:                                                                                                              
  422.        LDA    Store8,X             ;Get Object's B&W Color.                                                   ;4    
  423.        JSR    ChangeColor         ;Change if Necessary.                                                      ;6    
  424.        STA    COLUP1              ;and set color luminance01.                                                ;3    
  425.                                                                                                                    
  426. ;Object2 Size                                                                                                      
  427. ResizeObject2:
  428.        LDA    Store9,X             ;Get Object2's Size                                                        ;4    
  429.        ORA    #$10                ;And set to larger size if necessary.                                      ;2    
  430.        STA    NUSIZ1              ;(Used by bridge and invisible surround)                                   ;3    
  431.        RTS                                                                                                   ;6    
  432.                                                                                                                    
  433. ;Fill cache with two objects in this room.                                                                        
  434. CacheObjects:
  435.        LDY    $9C                 ;Get Last Object                                                           ;3    
  436.        LDA    #$A2                ;Set cache to                                                              ;2    
  437.        STA    $95                 ;      no-ojects.                                                          ;3    
  438.        STA    $96                                                                                            ;3    
  439. MoveNextObject:
  440.        TYA                                                                                                   ;2    
  441.        CLC                        ;Goto the next object to                                                   ;2    
  442.        ADC    #$09                ;check (add nine).                                                         ;2    
  443.        CMP    #$A2                ;Check if over maximum.                                                    ;2    
  444.        BCC    GetObjectsInfo                                                                                          ;2    
  445.        LDA    #$00                ;If so, wrap to zero.                                                      ;2    
  446. GetObjectsInfo:
  447.        TAY                                                                                                   ;2    
  448.        LDA    Store1,Y             ;Get low byte of object info.                                              ;4    
  449.        STA    $93                                                                                            ;3    
  450.        LDA    Store2,Y             ;Get high byte of object info.                                             ;4    
  451.        STA    $94                                                                                            ;3    
  452.        LDX    #$00                                                                                           ;2    
  453.        LDA    ($93,X)             ;Get objects current room.                                                 ;6    
  454.        CMP    $8A                 ;Is it in this room?                                                       ;3    
  455.        BNE    CheckForMoreObjects ;If not lets try next object (branch)                                      ;2    
  456.                                                                                                                    
  457.        LDA    $95                 ;Check first slot.                                                         ;3    
  458.        CMP    #$A2                ;If not default (no-object)                                                ;2    
  459.        BNE    StoreObjectToPrint  ;then branch.                                                              ;2    
  460.                                                                                                                    
  461.        STY    $95                 ;Store this object's number to print                                       ;3    
  462.        JMP    CheckForMoreObjects ;      and try for more.                                                   ;3    
  463.  
  464. StoreObjectToPrint:                                                                                                                  
  465.        STY    $96                 ;Store this object's number to print.                                      ;3    
  466.        JMP    StoreCount          ;      and then give up - no slots free.                                   ;3    
  467.                                                                                                                    
  468. CheckForMoreObjects:
  469.        CPY    $9C                 ;Have we done all the objets?                                              ;3    
  470.        BNE    MoveNextObject      ;If not, continue.                                                         ;2    
  471.  
  472. StoreCount:                                                                                                                  
  473.        STY    $9C                 ;If so, store current count                                                ;3    
  474.        RTS                        ;      for next time.                                                      ;6    
  475.                                                                                                                    
  476. ;Convert room number to address.  
  477. RoomNumToAddress:                                                                                
  478.        STA    $D8                 ;Strore room number wanted.                                                ;3    
  479.        STA    $93                                                                                            ;3    
  480.        LDA    #$00                ;Zero the high byte of the                                                 ;2    
  481.        STA    $94                 ;      offset.                                                             ;3    
  482.        CLC                                                                                                   ;2    
  483.        ROL    $93                                                                                            ;5    
  484.        ROL    $94                 ;Multiply room number by eight.                                            ;5    
  485.        ROL    $93                                                                                            ;5    
  486.        ROL    $94                                                                                            ;5    
  487.        ROL    $93                                                                                            ;5    
  488.        ROL    $94                                                                                            ;5    
  489.                                                                                                                    
  490.        LDA    $D8                 ;Get the original room number.                                             ;3    
  491.        CLC                                                                                                   ;2    
  492.        ADC    $93                                                                                            ;3    
  493.        STA    $93                 ;And add it to the offset.                                                 ;3    
  494.        LDA    #$00                                                                                           ;2    
  495.        ADC    $94                 ;In effect the room number is                                              ;3    
  496.        STA    $94                 ;      multiplied by nine.                                                 ;3    
  497.                                                                                                            
  498.        LDA    #<RoomDataTable                                                                                ;2    
  499.        CLC                                                                                                   ;2    
  500.        ADC    $93                 ;Add the room data base address                                            ;3    
  501.        STA    $93                 ;to the offset therefore getting                                           ;3    
  502.        LDA    #>RoomDataTable     ;      the final room data address.                                        ;2    
  503.        ADC    $94                                                                                            ;3    
  504.        STA    $94                                                                                            ;3    
  505.        RTS                                                                                                   ;6    
  506.                                                                                                                    
  507. ;Get pointer to current state.
  508. GetObjectState:                                                                                    
  509.        LDY    #$00                                                                                           ;2    
  510.        LDA    $DC                 ;Get the current object state.                                             ;3    
  511. GetObjectState_1:
  512.        CMP    ($93),Y             ;Have we found it in the list of states.                                   ;5    
  513.        BCC    GetObjectState_2    ;If nearing it then found it and return                                    ;2    
  514.        BEQ    GetObjectState_2    ;If found it then return.                                                  ;2    
  515.                                                                                                                    
  516.        INY                                                                                                   ;2    
  517.        INY                        ;Goto next state in list of states.                                        ;2    
  518.        INY                                                                                                   ;2    
  519.        JMP    GetObjectState_1                                                                               ;3    
  520. GetObjectState_2:
  521.        RTS                                                                                                   ;6    
  522.                                                                                                                    
  523. ;Check for input.
  524. CheckInput:                                                                                                  
  525.      INC    $E5                 ;Increment low count.                                                      ;5    
  526.        BNE    GetJoystick                                                                                         ;2    
  527.                                                                                                                    
  528.        INC    $E6                 ;Increment hight count if                                                  ;5    
  529.        BNE    GetJoystick         ;      needed.                                                             ;2    
  530.                                                                                                                    
  531.        LDA    #$80                ;Wrap the high count (indicating                                           ;2    
  532.        STA    $E6                 ;      timeout) if needed.                                                 ;3    
  533.  
  534. GetJoystick:                                                                                                                  
  535.      LDA    SWCHA               ;Get joystick values.                                                      ;4    
  536.        CMP    #$FF                ;If any movement then branch.                                              ;2    
  537.        BNE    GetJoystick_2                                                                                          ;2    
  538.                                                                                                                    
  539.        LDA    SWCHB               ;Get the consol switches                                                   ;4    
  540.        AND    #$03                ;Mast for the reset/select switchs.                                        ;2    
  541.        CMP    #$03                ;Have either of them been used?                                            ;2    
  542.        BEQ    GetJoystick_3       ;If not branch.                                                            ;2    
  543.  
  544. GetJoystick_2:                                                                                                                  
  545.      LDA    #$00                ;Zero the high count of the                                                ;2    
  546.        STA    $E6                 ;      switches or joystick have been used.                                ;3    
  547. GetJoystick_3:
  548.      RTS                                                                                                   ;6    
  549.                                                                                                                    
  550. ;Change color if necessary.                                                                                        
  551. ChangeColor:
  552.      LSR                        ;If bit 0 of the color is set                                              ;2    
  553.        BCC    ChangeColor_2       ;      then the room is to flash.                                          ;2    
  554.                                                                                                                    
  555.        TAY                        ;Use color as an index (usually E5- the low counter).                      ;2    
  556.        LDA.wy $0080,Y             ;Get flash color (usually the low counter.)                                ;4    
  557.  
  558. ChangeColor_2:                                                                                                                  
  559.        LDY    $E6                 ;Get the input counter.                                                    ;3    
  560.        BPL    ChangeColor_3       ;If console/joystick moved reciently then branch.                          ;2    
  561.                                                                                                                    
  562.        EOR    $E6                 ;Merge the high counter with the color wanted.                             ;3    
  563.        AND    #$FB                ;Keep this color bug merge down the luminance.                             ;2    
  564.  
  565. ChangeColor_3:                                                                                                                  
  566.        ASL                        ;And restore original color if necessary.                                  ;2    
  567.        RTS                                                                                                   ;6    
  568.                                                                                                                    
  569. ;Get the address of the dynamic information for an object.                                                        
  570. GetObjectAddress:
  571.        LDA    Store1,X                                                                                        ;4    
  572.        STA    $93                 ;Get and store the low address.                                            ;3    
  573.        LDA    Store2,X                                                                                        ;4    
  574.        STA    $94                 ;Get and store the high address.                                           ;3    
  575.        RTS                                                                                                   ;6    
  576.                                                                                                                    
  577. ;Game Start
  578. StartGame:                                                                                                        
  579.      SEI                        ;Set Interupts Off                                                         ;2    
  580.        CLD                                                                                                   ;2    
  581.        LDX    #$28                ;Clear TIA Registers                                                       ;2    
  582.        LDA    #$00                ;&04-&2C i.e. blank                                                        ;2    
  583. ResetAll:
  584.        STA    NUSIZ0,X            ;Everything And Turn.                                                      ;4    
  585.        DEX                        ;Everything Off.                                                           ;2    
  586.        BPL    ResetAll                                                                                          ;2    
  587.        TXS                        ;Reset Stack                                                               ;2    
  588. SetupVars:
  589.        STA    VSYNC,X             ;Clear &80 to &FF User Vars.                                               ;4    
  590.        DEX                                                                                                   ;2    
  591.        BMI    SetupVars                                                                                          ;2    
  592.        JSR    ThinWalls           ;Position the thin walls (missiles)                                        ;6    
  593.        JSR    SetupRoomObjects    ;Setup objects rooms and positions.                                        ;6    
  594. MainGameLoop:
  595.        JSR    CheckGameStart      ;Check for Game Start                                                      ;6    
  596.        JSR    MakeSound           ;Make noise if necessary                                                   ;6    
  597.        JSR    CheckInput          ;Check for input.                                                          ;6    
  598.        LDA    $DE                 ;Is The Game Active?                                                       ;3    
  599.        BNE    NonActiveLoop       ;If Not Branch..                                                           ;2    
  600.        LDA    $B9                 ;Get the room the Chalise is in.                                           ;3    
  601.        CMP    #$12                ;Is it in the yellow castle?                                               ;2    
  602.        BNE    MainGameLoop_2      ;If Not Branch..                                                           ;2    
  603.        LDA    #$FF                                                                                           ;2    
  604.        STA    $DF                 ;Set the note count to maximum.                                            ;3    
  605.        STA    $DE                 ;Set the game to inactive.                                                 ;3    
  606.        LDA    #$00                ;Set the noise type to end-noise.                                          ;2    
  607.        STA    $E0                                                                                            ;3    
  608. MainGameLoop_2:
  609.      LDY    #$00                ;Allow joystick read - all movement.                                       ;2    
  610.        JSR    BallMovement        ;Check ball collisions and move ball.                                      ;6    
  611.        JSR    MoveCarriedObject   ;Move the Carried Object                                                   ;6    
  612.        JSR    DoVSYNC             ;Wait for VSYNC                                                            ;6    
  613.        JSR    SetupRoomPrint      ;Setup the room and objects for display.                                   ;6    
  614.        JSR    PrintDisplay        ;Display the room and objects.                                             ;6    
  615.        JSR    PickupPutdown       ;Deal with object pickup and putdown.                                      ;6    
  616.        LDY    #$01                ;Dissalow joystick read - move vertically only.                            ;2    
  617.        JSR    BallMovement        ;Check ball collisions and move ball.                                      ;6    
  618.        JSR    Surround            ;Deal With Invisible Surround Moving.                                      ;6    
  619.        JSR    DoVSYNC             ;Wait for VSYNC                                                            ;6    
  620.        JSR    MoveBat             ;Move and deal with bat.                                                   ;6    
  621.        JSR    Portals             ;Move and deal with portcullises.                                          ;6    
  622.        JSR    PrintDisplay        ;Display the room and objects.                                             ;6    
  623.        JSR    MoveGreenDragon     ;Move and deal with the green dragon.                                      ;6    
  624.        JSR    MoveYellowDragon    ;Move and deal with the yellow dragon.                                     ;6    
  625.        JSR    DoVSYNC             ;Wait for VSYNC.                                                           ;6    
  626.        LDY    #$02                ;Dissalow joystic read/bridge check - move horrizonally only.              ;2    
  627.        JSR    BallMovement        ;Check ball collisions and move ball.                                      ;6    
  628.        JSR    MoveRedDragon       ;Move and deal with red dragon.                                            ;6    
  629.        JSR    Mag_1               ;Deal with the magnet.                                                     ;6    
  630.        JSR    PrintDisplay        ;Display the room and objects.                                             ;6    
  631.        JMP    MainGameLoop                                                                                 ;3    
  632.                                                                                                                    
  633. ;Non Active Game Loop.                                                                                            
  634. NonActiveLoop:
  635.      JSR    DoVSYNC             ;Wait for VSYNC                                                            ;6    
  636.        JSR    PrintDisplay        ;Display the room and objects.                                             ;6    
  637.        JSR    SetupRoomPrint      ;Set up room and objects for display.                                      ;6    
  638.        JMP    MainGameLoop                                                                                 ;3    
  639.                                                                                                                    
  640. ;Position missiles to "thin wall" areas.
  641. ThinWalls:                                                                          
  642.        LDA    #$0D                ;Position missile 00 to                                                    ;2    
  643.        LDX    #$02                ;(0D,00) - left thin wall.                                                 ;2    
  644.        JSR    PosSpriteX                                                                                     ;6    
  645.        LDA    #$96                ;Position missile 01 to                                                    ;2    
  646.        LDX    #$03                ;(96,00) - right thin wall.                                                ;2    
  647.        JSR    PosSpriteX                                                                                     ;6    
  648.        STA    WSYNC                     ;Wait for horizonal blank.                                           ;3    
  649.        STA    HMOVE                     ;Apply the horizonal move.                                           ;3    
  650.        RTS                                                                                                   ;6    
  651.  
  652. CheckGameStart:                                                                                                                  
  653.        LDA    SWCHB               ;Get the console switches.                                                 ;4    
  654.        EOR    #$FF                ;Flip (as reset active low).                                               ;2    
  655.        AND    $92                       ;Compare with what was before                                        ;3    
  656.        AND    #$01                      ;And check only the reset switch                                     ;2    
  657.        BEQ    CheckReset          ;If no reset then branch.                                                  ;2    
  658.        LDA    $DE                 ;Has the Game Started?                                                     ;3    
  659.        CMP    #$FF                ;If not then branch.                                                       ;2    
  660.        BEQ    SetupRoomObjects                                                                               ;2    
  661.        LDA    #$11                ;Get the yellow castle room.                                               ;2    
  662.        STA    $8A                       ;Make it the current room.                                           ;3    
  663.        STA    $E2                       ;Make it the previous room.                                          ;3    
  664.        LDA    #$50                ;Get the X coordinate.                                                     ;2    
  665.        STA    $8B                       ;Make it the current ball X coordinate.                              ;3    
  666.        STA    $E3                       ;Make it the previous ball X coordinate.                             ;3    
  667.        LDA    #$20                ;Get the Y coordinate.                                                     ;2    
  668.        STA    $8C                       ;Make it the current ball Y coordinate.                              ;3    
  669.        STA    $E4                       ;Make it the previous ball Y coordinate.                             ;3    
  670.        LDA    #$00                                                                                           ;2    
  671.        STA    $A8                 ;Set the red dragon's state to OK.                                         ;3    
  672.        STA    $AD                 ;Set the yellow dragon's state to OK.                                      ;3    
  673.        STA    $B2                 ;Set the green dragon's state to OK.                                       ;3    
  674.        STA    $DF                 ;Set the note count to zero.. (ops!??)                                     ;3    
  675.        LDA    #$A2                                                                                           ;2    
  676.        STA    $9D                 ;Set no object being carried.                                              ;3    
  677. CheckReset:
  678.        LDA    SWCHB               ;Get the console switches.                                                 ;4    
  679.        EOR    #$FF                ;Flip (as select active low)                                               ;2    
  680.        AND    $92                 ;Compare with what was before.                                             ;3    
  681.        AND    #$02                ;And check only the select switch.                                         ;2    
  682.        BEQ    StoreSwitches       ;Branch if select not being used.                                          ;2    
  683.        LDA    $8A                 ;Get the Current Room.                                                     ;3    
  684.        CMP    #$00                ;Is it the "Number" room?                                                  ;2    
  685.        BNE    SetupRoomObjects    ;Branch if not.                                                            ;2    
  686.        LDA    $DD                 ;Increment the level.                                                      ;3    
  687.        CLC                        ;Number (by two).                                                          ;2    
  688.        ADC    #$02                                                                                           ;2    
  689.        CMP    #$06                ;Have we reached the maximum?                                              ;2    
  690.        BCC    ResetSetup                                                                                     ;2    
  691.        LDA    #$00                ;If yep then set back to zero.                                             ;2    
  692. ResetSetup:
  693.        STA    $DD                 ;Store the new level number.                                               ;3    
  694. SetupRoomObjects:
  695.        LDA    #$00                ;Set the current room to the                                               ;2    
  696.        STA    $8A                 ;"Number" room.                                                            ;3    
  697.        STA    $E2                 ;And the previous room.                                                    ;3    
  698.        LDA    #$00                ;Set the ball's Y coordinate to zero.                                      ;2    
  699.        STA    $8C                 ;And the previous Y coordinate.                                            ;3    
  700.        STA    $E4                 ;(So can't be seen.)                                                       ;3    
  701.        LDY    $DD                 ;Get the level number.                                                     ;3    
  702.        LDA    Loc_4,Y              ;Get the low pointer to object locations.                                  ;4    
  703.        STA    $93                                                                                            ;3    
  704.        LDA    Loc_5,Y             ;Get the high pointer to object locations.                                 ;4    
  705.        STA    $94                                                                                            ;3    
  706.        LDY    #$30                ;Copy all the objects dynamic information.                                 ;2    
  707. SetupRoomObjects_2:
  708.        LDA    ($93),Y             ;(the rooms and positions) into                                            ;5    
  709.        STA.wy $00A1,Y             ;the working area.                                                         ;5    
  710.        DEY                                                                                                   ;2    
  711.        BPL    SetupRoomObjects_2                                                                                          ;2    
  712.        LDA    $DD                 ;Get the level number.                                                     ;3    
  713.        CMP    #$04                ;Branch if level one.                                                      ;2    
  714.        BCC    SignalGameStart     ;Or two (Where all objects are in defined areas.)                          ;2    
  715.        JSR    RandomizeLevel3     ;Put some objects in random rooms.                                         ;6    
  716.        JSR    DoVSYNC             ;Wait for VSYNC                                                            ;6    
  717.        JSR    PrintDisplay        ;Display rooms and objects.                                                ;6    
  718. SignalGameStart:
  719.        LDA    #$00                ;Signal that the game has started.                                         ;2    
  720.        STA    $DE                                                                                            ;3    
  721.        LDA    #$A2                ;Set no object being carried.                                              ;2    
  722.        STA    $9D                                                                                            ;3    
  723. StoreSwitches:
  724.        LDA    SWCHB               ;Store the current console switches                                        ;4    
  725.        STA    $92                                                                                            ;3    
  726.        RTS                                                                                                   ;6    
  727.                                                                                                                    
  728. ;Put objects in random rooms for level 3.                                                                          
  729. RandomizeLevel3:
  730.        LDY    #$1E                ;For each of the eleven objects..                                          ;2    
  731. RandomizeLevel3_2:
  732.        LDA    $E5                 ;Get the low input counter as seed.                                        ;3    
  733.        LSR                                                                                                   ;2    
  734.        LSR                                                                                                   ;2    
  735.        LSR                        ;Generate a psudo-random                                                   ;2    
  736.        LSR                        ;room number.                                                              ;2    
  737.        LSR                                                                                                   ;2    
  738.        SEC                                                                                                   ;2    
  739.        ADC    $E5                 ;Store the low input counter.                                              ;3    
  740.        STA    $E5                                                                                            ;3    
  741.        AND    #$1F                ;Trim so represents a room value.                                          ;2    
  742.        CMP    Loc_2,Y             ;If it is less than the                                                    ;4    
  743.        BCC    RandomizeLevel3_2   ;lower bound for object then get another.                                  ;2    
  744.        CMP    Loc_3,Y             ;If it equals or is                                                        ;4    
  745.        BEQ    RandomizeLevel3_3   ;Less than the higher bound for object                                     ;2    
  746.        BCS    RandomizeLevel3_2   ;Then continue (branch if higher)                                          ;2    
  747. RandomizeLevel3_3:
  748.        LDX    Loc_1,Y             ;Get the dynamic data index for this object                                ;4    
  749.        STA    VSYNC,X             ;Store the new room value.                                                 ;4    
  750.        DEY                                                                                                   ;2    
  751.        DEY                        ;Goto the next object.                                                     ;2    
  752.        DEY                                                                                                   ;2    
  753.        BPL    RandomizeLevel3_2   ;Untill all done                                                           ;2    
  754.        RTS                                                                                                   ;6    
  755.                                                                                                                    
  756. ;Room Bounds Data.                                                                                                
  757. ;Ex. the chalise at location &B9 can only exist in rooms 13-1A for                                                
  758. ;     level 3.                                                                                                    
  759. Loc_1:                                                                                                                  
  760.        .byte $B9                    ;                                                                          
  761. Loc_2:
  762.        .byte $13                    ;Chalise                                                                  
  763. Loc_3:
  764.        .byte $1A                    ;                                                                          
  765.        .byte $A4,$01,$1D            ;Red Dragon                                                                    
  766.        .byte $A9,$01,$1D            ;Yellow Dragon                                                                
  767.        .byte $AE,$01,$1D            ;Green Dragon                                                                  
  768.        .byte $B6,$01,$1D            ;Sword                                                                        
  769.        .byte $BC,$01,$1D            ;Bridge                                                                        
  770.        .byte $BF,$01,$1D            ;Yellow Key                                                                    
  771.        .byte $C2,$01,$16            ;White Key                                                                    
  772.        .byte $C5,$01,$12            ;Black Key                                                                    
  773.        .byte $CB,$01,$1D            ;Bat                                                                          
  774.        .byte $B3,$01,$1D            ;Magnet                                                                        
  775.  
  776. Loc_4:                                                                                                                  
  777.        .byte <Game1Objects                    ;Pointer to object locations for game 01.                                  
  778. Loc_5:
  779.        .byte >Game1Objects                    ;      --continued.                                                        
  780.        .byte <Game2Objects,>Game2Objects                ;Pointer to object locations for game 02.                                    
  781.        .byte <Game2Objects,>Game2Objects                ;Pointer to object locations for game 03.                                    
  782.                                                                                                                    
  783. ;Object locations (room and coordinate) for game 01.                                                              
  784. Game1Objects:
  785.        .byte $15,$51,$12            ;Black dot (Room, X, Y)                                                        
  786.        .byte $0E,$50,$20,$00,$00    ;Red Dragon (Room, X, Y, Movement, State)                                    
  787.        .byte $01,$50,$20,$00,$00    ;Yellow Dragon (Room, X, Y, Movement, State)                                
  788.        .byte $1D,$50,$20,$00,$00    ;Green Dragon (Room, X, Y, Movement, State)                                  
  789.        .byte $1B,$80,$20            ;Magnet (Room,X,Y)                                                            
  790.        .byte $12,$20,$20            ;Sword (Room,X,Y)                                                              
  791.        .byte $1C,$30,$20            ;Challise (Room,X,Y)                                                          
  792.        .byte $04,$29,$37            ;Bridge (Room,X,Y)                                                            
  793.        .byte $11,$20,$40            ;Yellow Key (Room,X,Y)                                                        
  794.        .byte $0E,$20,$40            ;White Key (Room,X,Y)                                                          
  795.        .byte $1D,$20,$40            ;Black Key (Room,X,Y)                                                          
  796.        .byte $1C                    ;Portcullis State                                                          
  797.        .byte $1C                    ;Portcullis State                                                          
  798.        .byte $1C                    ;Portcullis State                                                          
  799.        .byte $1A,$20,$20,$00,$00    ;Bat (Room, X, Y, Movement, State)                                          
  800.        .byte $78,$00                ;Bat (Carrying, Fed-Up)                                                      
  801.                                                                                                                    
  802. ;Object locations (room and coordinate) for Games 02 and 03.                                                      
  803. Game2Objects:
  804.        .byte $15,$51,$12            ;Black Dot (Room,X,Y)                                                          
  805.        .byte $14,$50,$20,$A0,$00    ;Red Dragon (Room,X,Y,Movement,State)                                        
  806.        .byte $19,$50,$20,$A0,$00    ;Yellow Dragon (Room,X,Y,Movement,State)                                    
  807.        .byte $04,$50,$20,$A0,$00    ;Green Dragon (Room,X,Y,Movement,State)                                      
  808.        .byte $0E,$80,$20            ;Magnet (Room,X,Y)                                                            
  809.        .byte $11,$20,$20            ;Sword (Room,X,Y)                                                              
  810.        .byte $14,$30,$20            ;Chalise (Room,X,Y)                                                            
  811.        .byte $0B,$40,$40            ;Bridge (Room,X,Y)                                                            
  812.        .byte $09,$20,$40            ;Yellow Key (Room,X,Y)                                                        
  813.        .byte $06,$20,$40            ;White Key (Room,X,Y)                                                          
  814.        .byte $19,$20,$40            ;Black Key (Room,X,Y)                                                          
  815.        .byte $1C                    ;Portcullis State                                                          
  816.        .byte $1C                    ;Portcullis State                                                          
  817.        .byte $1C                    ;Portcullis State                                                          
  818.        .byte $02,$20,$20,$90,$00    ;Bat (Room,X,Y,Movement,State)                                              
  819.        .byte $78,$00                ;Bat (Carrying, Fed-Up)                                                      
  820.                                                                                                                    
  821. ;Check ball collisions and move ball.                                                                              
  822. BallMovement:
  823.        LDA    CXBLPF                                                                                         ;3    
  824.        AND    #$80                ;Get ball-playfield collision                                              ;2    
  825.        BNE    PlayerCollision     ;Branch if collision (Player-Wall)                                         ;2    
  826.                                                                                                                    
  827.        LDA    CXM0FB                                                                                         ;3    
  828.        AND    #$40                ;Get ball-missile00 collision.                                             ;2    
  829.        BNE    PlayerCollision     ;Branch if collision. (Player-Left Thin)                                   ;2    
  830.                                                                                                                    
  831.        LDA    CXM1FB                                                                                         ;3    
  832.        AND    #$40                ;Get ball-missile01 collision.                                             ;2    
  833.        BEQ    BallMovement_2      ;Branch if no collision.                                                   ;2    
  834.                                                                                                                    
  835.        LDA    $96                 ;If object2 (to print) is                                                  ;3    
  836.        CMP    #$87                ;      not the black dot then collide.                                     ;2    
  837.        BNE    PlayerCollision                                                                                ;2    
  838. BallMovement_2:                                                                                                                  
  839.        LDA    CXP0FB                                                                                         ;3    
  840.        AND    #$40                ;Get ball-player00 collision.                                              ;2    
  841.        BEQ    BallMovement_3      ;If no collision then branch.                                              ;2    
  842.                                                                                                                    
  843.        LDA    $95                 ;If object1 (to print) is                                                  ;3    
  844.        CMP    #$00                ;      not the invisible surround then                                     ;2    
  845.        BNE    PlayerCollision     ;      branch (collision)                                                  ;2    
  846.  
  847. BallMovement_3:                                                                                                                  
  848.        LDA    CXP1FB                                                                                         ;3    
  849.        AND    #$40                ;Get ball-player01 collision.                                              ;2    
  850.        BEQ    NoCollision         ;If no collision then branch.                                              ;2    
  851.                                                                                                                    
  852.        LDA    $96                 ;If player01 to print is                                                   ;3    
  853.        CMP    #$00                ;      not the invisible surround then                                     ;2    
  854.        BNE    PlayerCollision     ;      branch (collision)                                                  ;2    
  855.                                                                                                                    
  856.        JMP    NoCollision         ;No collision - branch.                                                    ;3    
  857.                                                                                                                    
  858. ;Player collided (with something)                                                                                  
  859. PlayerCollision:
  860.        CPY    #$02                ;Are we checking for the bridge?                                           ;2    
  861.        BNE    ReadStick           ;If not, branch.                                                           ;2    
  862.                                                                                                                    
  863.        LDA    $9D                 ;Get the object being carried.                                             ;3    
  864.        CMP    #$5A                ;      Branch if it is the bridge.                                         ;2    
  865.        BEQ    ReadStick                                                                                      ;2    
  866.                                                                                                                    
  867.        LDA    $8A                 ;Get the current room.                                                     ;3    
  868.        CMP    $BC                 ;Is the bridge in this room.                                               ;3    
  869.        BNE    ReadStick           ;If not branch.                                                            ;2    
  870.                                                                                                                    
  871. ;Check going through the bridge.                                                                                  
  872.        LDA    $8B                 ;Get the ball's X coordinate.                                              ;3    
  873.        SEC                                                                                                   ;2    
  874.        SBC    $BD                 ;Subtract the bridge's X coordinate.                                       ;3    
  875.        CMP    #$0A                ;If less than &0A then forget it.                                          ;2    
  876.        BCC    ReadStick                                                                                      ;2    
  877.                                                                                                                    
  878.        CMP    #$17                ;If more than &17 then forget it.                                          ;2    
  879.        BCS    ReadStick                                                                                      ;2    
  880.                                                                                                                    
  881.        LDA    $BE                 ;Get the bridge's Y coordinate.                                            ;3    
  882.        SEC                                                                                                   ;2    
  883.        SBC    $8C                 ;Subtrac the ball's Y coordinate.                                          ;3    
  884.        CMP    #$FC                                                                                           ;2    
  885.        BCS    NoCollision         ;If more than &FC then going through bridge.                               ;2    
  886.                                                                                                                    
  887.        CMP    #$19                ;If more than &19 then forget it.                                          ;2    
  888.        BCS    ReadStick                                                                                      ;2    
  889.                                                                                                                    
  890. ;No collision (and going through bridge)                                                                          
  891. NoCollision:
  892.        LDA    #$FF                ;Reset the joystick input.                                                 ;2    
  893.        STA    $99                                                                                            ;3    
  894.        LDA    $8A                 ;Get the current room.                                                     ;3    
  895.        STA    $E2                 ;      and store temporarily.                                              ;3    
  896.        LDA    $8B                 ;Get the ball's X coordinate.                                              ;3    
  897.        STA    $E3                 ;      and store temporarily.                                              ;3    
  898.        LDA    $8C                 ;Get the ball's Y coordinate.                                              ;3    
  899.        STA    $E4                 ;And Store Temporarily.                                                    ;3    
  900.                                                                                                                    
  901. ;Read Sticks                                                                                                            
  902. ReadStick:
  903.        CPY    #$00                ;???Is game in first phase?                                                ;2    
  904.        BNE    ReadStick_2         ;If not, don't bother with joystick read.                                  ;2    
  905.                                                                                                                    
  906.        LDA    SWCHA               ;Read joysticks.                                                           ;4    
  907.        STA    $99                 ;      and store value.                                                    ;3    
  908.  
  909. ReadStick_2:                                                                                                                  
  910.        LDA    $E2                 ;Get Temporary room.                                                       ;3    
  911.        STA    $8A                 ;      and make it the current room.                                       ;3    
  912.        LDA    $E3                 ;Get temporary X coordinate                                                ;3    
  913.        STA    $8B                 ;      and make it the man's X coordinate.                                 ;3    
  914.        LDA    $E4                 ;Get temporary Y coordinate                                                ;3    
  915.        STA    $8C                 ;      and make it the man's Y coordinate.                                 ;3    
  916.                                                                                                                    
  917.        LDA    $99                 ;Get the Joystick position.                                                ;3    
  918.        ORA    ReadStick_3,Y             ;Merge out movement not allowed in this phase.                             ;4    
  919.        STA    $9B                 ;And store cooked movement.                                                ;3    
  920.                                                                                                                    
  921.        LDY    #$03                ;Set the delta for the ball.                                               ;2    
  922.        LDX    #$8A                ;Point to ball's coordiates.                                               ;2    
  923.        JSR    MoveGroundObject     ;Move the ball                                                             ;6    
  924.        RTS                                                                                                   ;6    
  925.                                                                                                                    
  926. ;Joystick Merge Values                                                                                            
  927. ReadStick_3:
  928.        .byte $00,$C0,$30            ;No change, No horizontal, No vertical.                                        
  929.                                                                                                                    
  930. ;Deal with object pickup and putdown.
  931. PickupPutdown:                                                                            
  932.        ROL    INPT4               ;Get joystick trigger.                                                     ;5    
  933.        ROR    $D7                 ;Merget into joystick record.                                              ;5    
  934.        LDA    $D7                 ;Get joystick record.                                                      ;3    
  935.        AND    #$C0                ;Merget out previous presses.                                              ;2    
  936.        CMP    #$40                ;Was it previously pressed?                                                ;2    
  937.        BNE    PickupPutdown_2     ;If not branch.                                                            ;2    
  938.                                                                                                                    
  939.        LDA    #$A2                                                                                           ;2    
  940.        CMP    $9D                 ;If nothing is being carried                                               ;3    
  941.        BEQ    PickupPutdown_2     ;      then branch.                                                        ;2    
  942.                                                                                                                    
  943.        STA    $9D                 ;Drop object.                                                              ;3    
  944.        LDA    #$04                ;Set noise type to four.                                                   ;2    
  945.        STA    $E0                                                                                            ;3    
  946.        LDA    #$04                ;Set noise count to four.                                                  ;2    
  947.        STA    $DF                                                                                            ;3    
  948.  
  949. PickupPutdown_2:                                                                                                                  
  950.        LDA    #$FF                ;????                                                                      ;2    
  951.        STA    $98                                                                                            ;3    
  952.                                                                                                                    
  953. ;Check for collision.                                                                                              
  954.        LDA    CXP0FB                                                                                         ;3    
  955.        AND    #$40                ;Get Ball-Player00 collision.                                              ;2    
  956.        BEQ    PickupPutdown_3     ;If nothing occured then branch.                                           ;2    
  957.                                                                                                                    
  958. ;With Player00                                                                                                    
  959.        LDA    $95                 ;Get type of Player00                                                      ;3    
  960.        STA    $97                 ;And Store.                                                                ;3    
  961.        JMP    CollisionDetected   ;Deal with collision.                                                      ;3    
  962.  
  963. PickupPutdown_3:                                                                                                                  
  964.        LDA    CXP1FB                                                                                         ;3    
  965.        AND    #$40                ;Get Ball-Player01 collision.                                              ;2    
  966.        BEQ    PickupPutdown_4     ;If nothing has happened, branch.                                          ;2    
  967.                                                                                                                    
  968.        LDA    $96                 ;Get type of Player01                                                      ;3    
  969.        STA    $97                 ;      and store.                                                          ;3    
  970.        JMP    CollisionDetected   ;Deal with collision.                                                      ;3    
  971.  
  972. PickupPutdown_4:                                                                                                                  
  973.        JMP    NoObject            ;Deal with no collision (return).                                          ;3    
  974.                                                                                                                    
  975. ;Collision occured.    
  976. CollisionDetected:                                                                                            
  977.        LDX    $97                 ;Get the object collided with.                                             ;3    
  978.        JSR    GetObjectAddress    ;Get it's dynamic information.                                             ;6    
  979.        LDA    $97                 ;Get the object collided with.                                             ;3    
  980.        CMP    #$51                ;Is it carriable?                                                          ;2    
  981.        BCC    NoObject            ;If not, branch.                                                           ;2    
  982.                                                                                                                    
  983.        LDY    #$00                                                                                           ;2    
  984.        LDA    ($93),Y             ;Get the object's room.                                                    ;5    
  985.        CMP    $8A                 ;Is it in the current room?                                                ;3    
  986.        BNE    NoObject            ;If not, branch.                                                           ;2    
  987.                                                                                                                    
  988.        LDA    $97                 ;Get the object collided with.                                             ;3    
  989.        CMP    $9D                 ;Is it the object being carried?                                           ;3    
  990.        BEQ    PickupObject        ;If so, branch (and actually pick it up.)                                  ;2    
  991.                                                                                                                    
  992.        LDA    #$05                ;Set noise type to five.                                                   ;2    
  993.        STA    $E0                                                                                            ;3    
  994.        LDA    #$04                ;Set noise type to four.                                                   ;2    
  995.        STA    $DF                                                                                            ;3    
  996.  
  997. PickupObject:                                                                                                                  
  998.        LDA    $97                 ;Set the object as being                                                   ;3    
  999.        STA    $9D                 ;      carried.                                                            ;3    
  1000.                                                                                                                    
  1001.        LDX    $93                 ;Get the dynamice address low byte.                                        ;3    
  1002.        LDY    #$06                                                                                           ;2    
  1003.        LDA    $99                 ;????                                                                      ;3    
  1004.        JSR    MoveObjectDelta     ;????                                                                      ;6    
  1005.                                                                                                                    
  1006.        LDY    #$01                                                                                           ;2    
  1007.        LDA    ($93),Y             ;Get the object's X coordinate.                                            ;5    
  1008.        SEC                                                                                                   ;2    
  1009.        SBC    $8B                 ;Subtract the ball's X coordinate.                                         ;3    
  1010.        STA    $9E                 ;      and store the difference.                                           ;3    
  1011.        LDY    #$02                                                                                           ;2    
  1012.        LDA    ($93),Y             ;Get the object's Y coordinate.                                            ;5    
  1013.        SEC                                                                                                   ;2    
  1014.        SBC    $8C                 ;Subtract the Ball's Y coordinate.                                         ;3    
  1015.        STA    $9F                 ;      and store the difference.                                           ;3    
  1016.                                                                                                                    
  1017. ;No collision
  1018. NoObject:                                                                                                      
  1019.        RTS                                                                                                   ;6    
  1020.                                                                                                                    
  1021.                                                                                                                    
  1022. ;Move the carried object
  1023. MoveCarriedObject:                                                                                          
  1024.        LDX    $9D                 ;Get the object being carried.                                             ;3    
  1025.        CPX    #$A2                ;If nothing then branch (return)                                           ;2    
  1026.        BEQ    MoveCarriedObject_2                                                                            ;2    
  1027.                                                                                                                    
  1028.        JSR    GetObjectAddress    ;Get it's dynamic information.                                             ;6    
  1029.        LDY    #$00                                                                                           ;2    
  1030.                                                                                                                    
  1031.        LDA    $8A                 ;Get the current room.                                                     ;3    
  1032.        STA    ($93),Y             ;      and stroe the object's current room.                                ;6    
  1033.        LDY    #$01                                                                                           ;2    
  1034.                                                                                                                    
  1035.        LDA    $8B                 ;Get the ball's X coordinate.                                              ;3    
  1036.        CLC                                                                                                   ;2    
  1037.        ADC    $9E                 ;Add the X difference.                                                     ;3    
  1038.        STA    ($93),Y             ;      and store as the object's X coordinate.                             ;6    
  1039.        LDY    #$02                                                                                           ;2    
  1040.        LDA    $8C                 ;Get the ball's Y coordinate.                                              ;3    
  1041.        CLC                                                                                                   ;2    
  1042.        ADC    $9F                 ;Add the Y difference.                                                     ;3    
  1043.        STA    ($93),Y             ;      and store as the object's Y coordinate.                             ;6    
  1044.                                                                                                                    
  1045.        LDY    #$00                ;Set no delta.                                                             ;2    
  1046.        LDA    #$FF                ;Set no movement.                                                          ;2    
  1047.        LDX    $93                 ;Get the object's dynamic address.                                         ;3    
  1048.        JSR    MoveGroundObject     ;Move the object.                                                          ;6    
  1049. MoveCarriedObject_2:
  1050.        RTS                                                                                                   ;6    
  1051.                                                                                                                    
  1052. ;Move the object.
  1053. MoveGroundObject:                                                                        
  1054.        JSR    MoveObjectDelta     ;Move the object by delta.                                                 ;6    
  1055.        LDY    #$02                ;Set to do the three                                                       ;2    
  1056. MoveGroundObject_2:
  1057.        STY    $9A                 ;      portcullises.                                                       ;3    
  1058.        LDA.wy $00C8,Y             ;Get the portal state.                                                     ;4    
  1059.        CMP    #$1C                ;Is it in a closed state?                                                  ;2    
  1060.        BEQ    GetPortal           ;If not, next portal.                                                      ;2    
  1061.                                                                                                                    
  1062. ;Deal with object moving out of a castle.                                                                          
  1063.        LDY    $9A                 ;Get port number.                                                          ;3    
  1064.        LDA    VSYNC,X             ;Get object's room number.                                                 ;4    
  1065.        CMP    EntryRoomOffsets,Y  ;Is it in a castle entry room.                                             ;4    
  1066.        BNE    GetPortal           ;If not, next portal.                                                      ;2    
  1067.                                                                                                                    
  1068.        LDA    WSYNC,X             ;Get the object's Y coordinate.                                            ;4    
  1069.        CMP    #$0D                ;Is it above &OD i.e at the bottom.                                        ;2    
  1070.        BPL    GetPortal           ;If so then branch.                                                        ;2    
  1071.                                                                                                                    
  1072.        LDA    CastleRoomOffsets,Y ;Get the castle room.                                                      ;4    
  1073.        STA    VSYNC,X             ;And put the object in the castle room.                                    ;4    
  1074.        LDA    #$50                                                                                           ;2    
  1075.        STA    VBLANK,X            ;Set the object's new X coordinate.                                        ;4    
  1076.        LDA    #$2C                                                                                           ;2    
  1077.        STA    WSYNC,X             ;Set the new object's Y coordinate.                                        ;4    
  1078.        LDA    #$01                                                                                           ;2    
  1079.        STA.wy $00C8,Y             ;Set the portcullis state to 01.                                           ;5    
  1080.        RTS                                                                                                   ;6    
  1081.  
  1082. GetPortal:                                                                                                                  
  1083.        LDY    $9A                 ;Get the portcullis number.                                                ;3    
  1084.        DEY                        ;      goto next,                                                          ;2    
  1085.        BPL    MoveGroundObject_2   ;      and continue.                                                       ;2    
  1086.                                                                                                                    
  1087. ;Check and Deal with Up.                                                                                          
  1088.        LDA    WSYNC,X             ;Get the object's Y coordinate.                                            ;4    
  1089.        CMP    #$6A                ;Has it reched above the top.                                              ;2    
  1090.        BMI    DealWithLeft        ;If not, branch.                                                           ;2    
  1091.                                                                                                                    
  1092.        LDA    #$0D                ;Set new Y coordinate to bottom.                                           ;2    
  1093.        STA    WSYNC,X                                                                                        ;4    
  1094.        LDY    #$05                ;Get the direction wanted.                                                 ;2    
  1095.        JMP    GetNewRoom          ;Go and get new room.                                                      ;3    
  1096.                                                                                                                    
  1097. ;Check and Deal with Left.
  1098. DealWithLeft:                                                                                        
  1099.        LDA    VBLANK,X            ;Get the object's X coordinate.                                            ;4    
  1100.        CMP    #$03                ;Is it Three or less?                                                      ;2    
  1101.        BCC    DealWithLeft_2      ;IF so, branch.  (off to left)                                             ;2    
  1102.                                                                                                                    
  1103.        CMP    #$F0                ;Is it's &F0 or more.                                                      ;2    
  1104.        BCS    DealWithLeft_2      ;If so, branch.  (off to right)                                            ;2    
  1105.                                                                                                                    
  1106.        JMP    DealWithDown                                                                                          ;3    
  1107.  
  1108. DealWithLeft_2:                                                                                                                  
  1109.        CPX    #$8A                ;Are we dealling with the ball?                                            ;2    
  1110.        BEQ    DealWithLeft_3      ;If so Branch.                                                             ;2    
  1111.                                                                                                                    
  1112.        LDA    #$9A                ;Set new X coordinate for the others.                                      ;2    
  1113.        JMP    DealWithLeft_4                                                                                          ;3    
  1114.  
  1115. DealWithLeft_3:                                                                                                                  
  1116.        LDA    #$9E                ;Set new X coordinate for the ball.                                        ;2    
  1117.  
  1118. DealWithLeft_4:                                                                                                                  
  1119.        STA    VBLANK,X            ;Store the next X coordinate.                                              ;4    
  1120.        LDY    #$08                ;And get the direction wanted.                                             ;2    
  1121.        JMP    GetNewRoom          ;Go and get new room.                                                      ;3    
  1122.                                                                                                                    
  1123. ;Check and Deal with Down.                                                                                        
  1124. DealWithDown:
  1125.        LDA    WSYNC,X             ;Get object's Y coordinate.                                                ;4    
  1126.        CMP    #$0D                ;If it's greater than &0D then                                             ;2    
  1127.        BCS    DealWithRight       ;Branch.                                                                   ;2    
  1128.                                                                                                                    
  1129.        LDA    #$69                ;Set new Y coordinate.                                                     ;2    
  1130.        STA    WSYNC,X                                                                                        ;4    
  1131.        LDY    #$07                ;Get the direction wanted.                                                 ;2    
  1132.        JMP    GetNewRoom          ;Go and get new room.                                                      ;3    
  1133.                                                                                                                    
  1134. ;Check and Deal with Right.  
  1135. DealWithRight:
  1136.        LDA    VBLANK,X            ;Get the object's X coordinate.                                            ;4    
  1137.        CPX    #$8A                ;Are we dealing with the ball.                                             ;2    
  1138.        BNE    DealWithRight_2     ;Branch if not.                                                            ;2    
  1139.                                                                                                                    
  1140.        CMP    #$9F                ;Has the object reached the right?                                         ;2    
  1141.        BCC    MovementReturn      ;Branch if not.                                                            ;2    
  1142.                                                                                                                    
  1143.        LDA    VSYNC,X             ;Get the Ball's Room.                                                      ;4    
  1144.        CMP    #$03                ;Is it room #3 (Right to secret room)                                      ;2    
  1145.        BNE    DealWithRight_3     ;Branch if not.                                                            ;2    
  1146.                                                                                                                    
  1147.        LDA    $A1                 ;Check the room of the black dot.                                          ;3    
  1148.        CMP    #$15                ;Is it in the hidden room area?                                            ;2    
  1149.        BEQ    DealWithRight_3     ;If so, Branch.                                                            ;2    
  1150.                                                                                                                    
  1151. ;Manually change to secret room.                                                                                  
  1152.        LDA    #$1E                ;Set room to secret room.                                                  ;2    
  1153.        STA    VSYNC,X             ;And make it current.                                                      ;4    
  1154.        LDA    #$03                ;Set the X coordinate.                                                     ;2    
  1155.        STA    VBLANK,X                                                                                       ;4    
  1156.        JMP    MovementReturn      ;And Exit.                                                                 ;3    
  1157.  
  1158. DealWithRight_2:                                                                                                                  
  1159.        CMP    #$9B                ;Has the object reached the right of the screen?                           ;2    
  1160.        BCC    MovementReturn      ;Branch if not (no room change)                                            ;2    
  1161.  
  1162. DealWithRight_3:                                                                                                                  
  1163.        LDA    #$03                ;Set the next X coordinate.                                                ;2    
  1164.        STA    VBLANK,X                                                                                       ;4    
  1165.        LDY    #$06                ;And get the direction wanted.                                             ;2    
  1166.        JMP    GetNewRoom          ;Get the new room.                                                         ;3    
  1167.                                                                                                                    
  1168. ;Get new room
  1169. GetNewRoom:                                                                                                    
  1170.        LDA    VSYNC,X             ;Get the object's room.                                                    ;4    
  1171.        JSR    RoomNumToAddress    ;Convert it to an address.                                                 ;6    
  1172.        LDA    ($93),Y             ;Get the adjacent room.                                                    ;5    
  1173.        JSR    AdjustRoomLevel     ;Deal with the level differences.                                          ;6    
  1174.        STA    VSYNC,X             ;      and store as new object's room.                                     ;4    
  1175.  
  1176. MovementReturn:                                                                                                                  
  1177.        RTS                                                                                                   ;6    
  1178.                                                                                                                    
  1179. ;Move the object in direction by delta.                                                                            
  1180. MoveObjectDelta:
  1181.        STA    $9B                 ;Stored direction wanted.                                                  ;3    
  1182. MoveObjectDelta_2:
  1183.        DEY                        ;Count down the delta.                                                     ;2    
  1184.        BMI    MoveObjectDelta_7                                                                              ;2    
  1185.                                                                                                                    
  1186.        LDA    $9B                 ;Get direction wanted.                                                     ;3    
  1187.        AND    #$80                ;Check for right move.                                                     ;2    
  1188.        BNE    MoveObjectDelta_3   ;If no move right then branch.                                             ;2    
  1189.                                                                                                                    
  1190.        INC    VBLANK,X            ;Increment the X coordinate.                                               ;6    
  1191.  
  1192. MoveObjectDelta_3:                                                                                                                  
  1193.        LDA    $9B                 ;Get the direction wanted.                                                 ;3    
  1194.        AND    #$40                ;Check for left move.                                                      ;2    
  1195.        BNE    MoveObjectDelta_4   ;If no move left then branch.                                              ;2    
  1196.                                                                                                                    
  1197.        DEC    VBLANK,X            ;Decrement the X coordinate.                                               ;6    
  1198.  
  1199. MoveObjectDelta_4:                                                                                                                  
  1200.        LDA    $9B                 ;Get the direction wanted.                                                 ;3    
  1201.        AND    #$10                ;Check for move up.                                                        ;2    
  1202.        BNE    MoveObjectDelta_5   ;If no move up then branch.                                                ;2    
  1203.        INC    WSYNC,X                                                                                        ;6    
  1204.  
  1205. MoveObjectDelta_5:                                                                                                                  
  1206.        LDA    $9B                 ;Get direction wanted.                                                     ;3    
  1207.        AND    #$20                ;Check for move down.                                                      ;2    
  1208.        BNE    MoveObjectDelta_6   ;If no move down the branch.                                               ;2    
  1209.                                                                                                                    
  1210.        DEC    WSYNC,X             ;Decrement the Y coordinate.                                               ;6    
  1211.      
  1212. MoveObjectDelta_6:                                                                                                              
  1213.        JMP    MoveObjectDelta_2   ;Keep going until delta finished.                                          ;3    
  1214. MoveObjectDelta_7:
  1215.        RTS                                                                                                   ;6    
  1216.                                                                                                                    
  1217.                                                                                                                    
  1218. ;Adjust room for different levels.                                                                                
  1219. AdjustRoomLevel:
  1220.        CMP    #$80                ;Is the room number                                                        ;2    
  1221.        BCC    AdjustRoomLevel_2   ;      above &80?                                                          ;2    
  1222.                                                                                                                    
  1223.        SEC                                                                                                   ;2    
  1224.        SBC    #$80                ;Remove the &80 flag and                                                   ;2    
  1225.        STA    $D8                 ;      store the room number.                                              ;3    
  1226.        LDA    $DD                 ;Get the level number.                                                     ;3    
  1227.        LSR                        ;Devide it by two.                                                         ;2    
  1228.        CLC                                                                                                   ;2    
  1229.        ADC    $D8                 ;Add to the original room.                                                 ;3    
  1230.        TAY                                                                                                   ;2    
  1231.        LDA    RoomDiffs,Y             ;Use as an offset to get the next room.                                    ;4    
  1232. AdjustRoomLevel_2:                                                                                                                  
  1233.        RTS                                                                                                   ;6    
  1234.                                                                                                                    
  1235.                                                                                                                    
  1236. ;Get player-ball collision.                                                                                        
  1237. PBCollision:
  1238.        CMP    $95                 ;Is it the rist object?                                                    ;3    
  1239.        BEQ    PBCollision_2       ;YES - Then Branch.                                                        ;2    
  1240.                                                                                                                    
  1241.        CMP    $96                 ;Is it the second object?                                                  ;3    
  1242.        BEQ    PBCollision_3       ;YES - Then Branch.                                                        ;2    
  1243.                                                                                                                    
  1244.        LDA    #$00                ;Otherewise nothing.                                                       ;2    
  1245.        RTS                                                                                                   ;6    
  1246.  
  1247. PBCollision_2:                                                                                                                  
  1248.        LDA    CXP0FB              ;Get player00-ball collision.                                              ;3    
  1249.        AND    #$40                                                                                           ;2    
  1250.        RTS                                                                                                   ;6    
  1251. PBCollision_3:                                                                                                                  
  1252.        LDA    CXP1FB              ;Get player01-ball collision.                                              ;3    
  1253.        AND    #$40                                                                                           ;2    
  1254.        RTS                                                                                                   ;6    
  1255.                                                                                                                    
  1256.                                                                                                                    
  1257. ;Find which object has hit object wanted.
  1258. FindObjHit:                                                                        
  1259.        LDA    CXPPMM              ;Get Player00-Player01                                                     ;3    
  1260.        AND    #$80                ;      collision.                                                          ;2    
  1261.        BEQ    FindObjHit_2        ;If nothing, Branch.                                                       ;2    
  1262.                                                                                                                    
  1263.        CPX    $95                 ;Is object 1 the one being hit?                                            ;3    
  1264.        BEQ    FindObjHit_3        ;If so, Branch.                                                            ;2    
  1265.                                                                                                                    
  1266.        CPX    $96                 ;Is object 2 the one being hit?                                            ;3    
  1267.        BEQ    FindObjHit_4        ;If so, Branch.                                                            ;2    
  1268. FindObjHit_2:                                                                                                                  
  1269.        LDA    #$A2                ;Therefore select the other.                                               ;2    
  1270.        RTS                                                                                                   ;6    
  1271. FindObjHit_3:                                                                                                                  
  1272.        LDA    $96                 ;Therefore select the other.                                               ;3    
  1273.        RTS                                                                                                   ;6    
  1274. FindObjHit_4:                                                                                                                  
  1275.        LDA    $95                 ;Therefore select the other.                                               ;3    
  1276.        RTS                                                                                                   ;6    
  1277.                                                                                                                    
  1278.                                                                                                                    
  1279. ;Move object.
  1280. MoveGameObject:                                                                                                      
  1281.        JSR    GetLinkedObject     ;Get liked object and movement.                                            ;6    
  1282.        LDX    $D5                 ;Get dynamic data address.                                                 ;3    
  1283.        LDA    $9B                 ;Get Movement.                                                             ;3    
  1284.        BNE    MoveGameObject_2    ;If movement then branch.                                                  ;2    
  1285.                                                                                                                    
  1286.        LDA    RSYNC,X             ;Use old movement.                                                         ;4    
  1287.  
  1288. MoveGameObject_2:                                                                                                                  
  1289.        STA    RSYNC,X             ;Stoe the new movement.                                                    ;4    
  1290.        LDY    $D4                 ;Get the object's Delta.                                                   ;3    
  1291.        JSR    MoveGroundObject     ;Move the object.                                                          ;6    
  1292.        RTS                                                                                                   ;6    
  1293.                                                                                                                    
  1294.                                                                                                                    
  1295. ;Find liked object and get movement.
  1296. GetLinkedObject:                                                                              
  1297.        LDA    #$00                ;Set index to zero.                                                        ;2    
  1298.        STA    $E1                                                                                            ;3    
  1299. GetLinkedObject_2:                                                                                                                  
  1300.        LDY    $E1                 ;Get index.                                                                ;3    
  1301.        LDA    ($D2),Y             ;Get first object.                                                         ;5    
  1302.        TAX                                                                                                   ;2    
  1303.        INY                                                                                                   ;2    
  1304.        LDA    ($D2),Y             ;Get second object.                                                        ;5    
  1305.        TAY                                                                                                   ;2    
  1306.        LDA    VSYNC,X             ;Get object1;s room.                                                       ;4    
  1307.        CMP.wy $0000,Y             ;Combare with object2's room.                                              ;4    
  1308.        BNE    GetLinkedObject_3   ;If not the same room then branch.                                         ;2    
  1309.                                                                                                                    
  1310.        CPY    $D6                 ;Have we matched the second object                                         ;3    
  1311.        BEQ    GetLinkedObject_3   ;      for difficulty (if so, carry on).                                   ;2    
  1312.                                                                                                                    
  1313.        CPX    $D6                 ;Have we matched the first object                                          ;3    
  1314.        BEQ    GetLinkedObject_3   ;      for difficulty (if so, carry on).                                   ;2    
  1315.                                                                                                                    
  1316.        JSR    GetLinkedObject_4   ;Get object's movement.                                                    ;6    
  1317.        RTS                                                                                                   ;6    
  1318. GetLinkedObject_3:                                                                                                                  
  1319.        INC    $E1                 ;Increment the index.                                                      ;5    
  1320.        INC    $E1                                                                                            ;5    
  1321.        LDY    $E1                 ;Get the index number.                                                     ;3    
  1322.        LDA    ($D2),Y             ;Check for end of sequence.                                                ;5    
  1323.        BNE    GetLinkedObject_2   ;If not branch.                                                            ;2    
  1324.                                                                                                                    
  1325.        LDA    #$00                ;Set no move if no                                                         ;2    
  1326.        STA    $9B                 ;      liked object is found.                                              ;3    
  1327.        RTS                                                                                                   ;6    
  1328.                                                                                                                    
  1329.                                                                                                                    
  1330. ;Work out object's movement.                                                                                      
  1331. GetLinkedObject_4:
  1332.        LDA    #$FF                ;Set object movement to none.                                              ;2    
  1333.        STA    $9B                                                                                            ;3    
  1334.                                                                                                                    
  1335.        LDA.wy $0000,Y             ;Get oject2's room.                                                        ;4    
  1336.        CMP    VSYNC,X             ;Compare it with object's room.                                            ;4    
  1337.        BNE    GetLinkedObject_8   ;If not the same, forget it.                                               ;2    
  1338.                                                                                                                    
  1339.        LDA.wy $0001,Y             ;Get Object2's X coordinate.                                               ;4    
  1340.        CMP    VBLANK,X            ;Get Object1;s X coordinate.                                               ;4    
  1341.        BCC    GetLinkedObject_5   ;If Object2 to left of Object1 then Branch.                                ;2    
  1342.        BEQ    GetLinkedObject_6   ;If Object2 on Object1 then Branch.                                        ;2    
  1343.                                                                                                                    
  1344.        LDA    $9B                 ;Get Object Movement.                                                      ;3    
  1345.        AND    #$7F                ;Signal a move right.                                                      ;2    
  1346.        STA    $9B                                                                                            ;3    
  1347.        JMP    GetLinkedObject_6   ;Now try Vertical.                                                         ;3    
  1348. GetLinkedObject_5:                                                                                                                  
  1349.        LDA    $9B                 ;Get object movent.                                                        ;3    
  1350.        AND    #$BF                ;Signal a move left.                                                       ;2    
  1351.        STA    $9B                                                                                            ;3    
  1352.  
  1353. GetLinkedObject_6:                                                                                                                  
  1354.        LDA.wy $0002,Y             ;Get Object2's Y Coordinate.                                               ;4    
  1355.        CMP    WSYNC,X             ;Get Object1's X Coordinate.                                               ;4    
  1356.        BCC    GetLinkedObject_7   ;If Object2 Below Object1 Then Branch.                                     ;2    
  1357.        BEQ    GetLinkedObject_8   ;If Object2 on Object1 Then Branch.                                        ;2    
  1358.                                                                                                                    
  1359.        LDA    $9B                 ;Get Object Movement.                                                      ;3    
  1360.        AND    #$EF                ;Signal a move up.                                                         ;2    
  1361.        STA    $9B                                                                                            ;3    
  1362.        JMP    GetLinkedObject_8   ;Jump to Finish.                                                           ;3    
  1363.  
  1364. GetLinkedObject_7:                                                                                                                  
  1365.        LDA    $9B                 ;Get Object Movement.                                                      ;3    
  1366.        AND    #$DF                ;Signal a move down.                                                       ;2    
  1367.        STA    $9B                                                                                            ;3    
  1368.  
  1369. GetLinkedObject_8:                                                                                                                  
  1370.        LDA    $9B                 ;Get the Move.                                                             ;3    
  1371.        RTS                                                                                                   ;6    
  1372.                                                                                                                    
  1373.                                                                                                                    
  1374. ;Move the Red Dragon                                                                                              
  1375. MoveRedDragon:
  1376.        LDA    #<RedDragMatrix                                                                                           ;2    
  1377.        STA    $D2                 ;Set the Low address of Object Store.                                      ;3    
  1378.        LDA    #>RedDragMatrix                                                                                           ;2    
  1379.        STA    $D3                 ;Set the High address of Object Store.                                     ;3    
  1380.        LDA    #$03                                                                                           ;2    
  1381.        STA    $D4                 ;Set the Dragon's Delta                                                    ;3    
  1382.        LDX    #$36                ;Select Dragon #1 : Red                                                    ;2    
  1383.        JSR    MoveDragon                                                                                     ;6    
  1384.        RTS                                                                                                   ;6    
  1385.                                                                                                                    
  1386. ;Red Dragon Object Matrix                                                                                          
  1387. RedDragMatrix:
  1388.        .byte $B6,$A4                  ;Sword, Red Dragon                                                          
  1389.        .byte $A4,$8A                  ;Red Dragon, Ball                                                            
  1390.        .byte $A4,$B9                  ;Red Dragon, Chalise                                                        
  1391.        .byte $A4,$C2                  ;Red Dragon, White Key                                                      
  1392.        .byte $00                                                                                                  
  1393.                                                                                                                    
  1394. ;Move the Yellow Dragon.                                                                                          
  1395. MoveYellowDragon:
  1396.        LDA    #<YelDragMatrix                                                                                           ;2    
  1397.        STA    $D2                 ;Set the Low Address of Object Store.                                      ;3    
  1398.        LDA    #>YelDragMatrix                                                                                           ;2    
  1399.        STA    $D3                 ;Set the High Address of Object Store.                                     ;3    
  1400.        LDA    #$02                                                                                           ;2    
  1401.        STA    $D4                 ;Set the Yellow Dragon's Delta.                                            ;3    
  1402.        LDX    #$3F                                                                                           ;2    
  1403.        JSR    MoveDragon          ;Select Dragon #2 : Yellow.                                                ;6    
  1404.        RTS                                                                                                   ;6    
  1405.                                                                                                                    
  1406. ;Yellow Dragon's Object Matrix                                                                                    
  1407. YelDragMatrix:
  1408.      .byte $B6,$A9                  ;Sword, Yellow Dragon                                                        
  1409.        .byte $BF,$A9                  ;Yellow Key, Yellow Dragon                                                  
  1410.        .byte $A9,$8A                  ;Yellow Dragon, Ball                                                        
  1411.        .byte $A9,$B9                  ;Yellow Dragon, Chalise                                                      
  1412.        .byte $00                                                                                                  
  1413.                                                                                                                    
  1414.                                                                                                                    
  1415. ;Move the Green Dragon                                                                                            
  1416. MoveGreenDragon:
  1417.        LDA    #<GreenDragonMatrix                                                                                           ;2    
  1418.        STA    $D2                 ;Set Low Address of Object Store.                                          ;3    
  1419.        LDA    #>GreenDragonMatrix                                                                                           ;2    
  1420.        STA    $D3                 ;Set High Address of Object Store.                                         ;3    
  1421.        LDA    #$02                                                                                           ;2    
  1422.        STA    $D4                 ;Set the Green Dragon's Delta.                                             ;3    
  1423.        LDX    #$48                ;Select Dragon #3 : Green                                                  ;2    
  1424.        JSR    MoveDragon                                                                                     ;6    
  1425.        RTS                                                                                                   ;6    
  1426.                                                                                                                    
  1427. ;Green Dragon's Object Matrix                                                                                      
  1428. GreenDragonMatrix:
  1429.        .byte $B6,$AE                  ;Sword, Green Dragon                                                        
  1430.        .byte $AE,$8A                  ;Green Dragon, Ball                                                          
  1431.        .byte $AE,$B9                  ;Green Dragon Chalise                                                        
  1432.        .byte $AE,$BC                  ;Green Dragon, Bridge                                                        
  1433.        .byte $AE,$B3                  ;Green Dragon, Magnet                                                        
  1434.        .byte $AE,$C5                  ;Green Dragon, Black Key                                                    
  1435.        .byte $00                                                                                                  
  1436.                                                                                                                    
  1437.                                                                                                                    
  1438. ;Move A Dragon
  1439. MoveDragon:                                                                                                      
  1440.        STX    $A0                 ;Save Object were dealing with.                                            ;3    
  1441.        LDA    Store1,X             ;Get the Object's Dynamic Data.                                            ;4    
  1442.        TAX                                                                                                   ;2    
  1443.        LDA    NUSIZ0,X            ;Get the Object's State.                                                   ;4    
  1444.        CMP    #$00                ;Is it in State 00 (Normal #1)                                             ;2    
  1445.        BNE    MoveDragon_6        ;Branch if not.                                                            ;2    
  1446.                                                                                                                    
  1447. ;Dragon Normal (State 1)                                                                                          
  1448.        LDA    SWCHB               ;Read console switches.                                                    ;4    
  1449.        AND    #$80                ;Check for P1 difficulty.                                                  ;2    
  1450.        BEQ    MoveDragon_2        ;If Amateur Branch.                                                        ;2    
  1451.                                                                                                                    
  1452.        LDA    #$00                ;Set Hard - Ignore Nothing                                                 ;2    
  1453.        JMP    MoveDragon_3                                                                                   ;3    
  1454.  
  1455. MoveDragon_2:                                                                                                                  
  1456.        LDA    #$B6                ;Set Easy - Ignore Sword.                                                  ;2    
  1457.  
  1458. MoveDragon_3:                                                                                                                  
  1459.        STA    $D6                 ;Store Difficulty                                                          ;3    
  1460.        STX    $D5                 ;Store Dynamic Data Address.                                               ;3    
  1461.        JSR    MoveGameObject                                                                                 ;6    
  1462.                                                                                                                    
  1463.        LDA    $A0                 ;Get Object                                                                ;3    
  1464.        JSR    PBCollision         ;      And get the Player-Ball collision.                                  ;6    
  1465.        BEQ    MoveDragon_4        ;If None Then Branch.                                                      ;2    
  1466.                                                                                                                    
  1467.        LDA    SWCHB               ;Get Console Switched.                                                     ;4    
  1468.        ROL                        ;Move P0 difficulty to                                                     ;2    
  1469.        ROL                        ;      bit 01 position.                                                    ;2    
  1470.        ROL                                                                                                   ;2    
  1471.        AND    #$01                ;Mask it out.                                                              ;2    
  1472.        ORA    $DD                 ;Merget in the Level Number.                                               ;3    
  1473.        TAY                        ;Create Lookup.                                                            ;2    
  1474.        LDA    DragonDiff,Y             ;Get New State.                                                            ;4    
  1475.        STA    NUSIZ0,X            ;Store as Dragon's State (Open Mouthed).                                   ;4    
  1476.        LDA    $E3                                                                                            ;3    
  1477.        STA    VBLANK,X            ;Get Temp Ball X Coord and Store as Dragon's.                              ;4    
  1478.        LDA    $E4                                                                                            ;3    
  1479.        STA    WSYNC,X             ;Get Temp Ball Y Coord and Store as Dragon's                               ;4    
  1480.        LDA    #$01                                                                                           ;2    
  1481.        STA    $E0                 ;Set Noise Type to 01                                                      ;3    
  1482.        LDA    #$10                                                                                           ;2    
  1483.        STA    $DF                 ;Set Noise Count to 10 i.e. make roar noise.                               ;3    
  1484.  
  1485. MoveDragon_4:                                                                                                                  
  1486.        STX    $9A                 ;Store Object's Dynamic Data Address.                                      ;3    
  1487.        LDX    $A0                 ;Get the Object Number.                                                    ;3    
  1488.        JSR    FindObjHit          ;See if anoher object has hit the dragon.                                  ;6    
  1489.        LDX    $9A                 ;Get the Object Address.                                                   ;3    
  1490.        CMP    #$51                ;Has the Sword hit the Dragon?                                             ;2    
  1491.        BNE    MoveDragon_5        ;If Not, Branch.                                                           ;2    
  1492.                                                                                                                    
  1493.        LDA    #$01                ;Set the State to 01 (Dead)                                                ;2    
  1494.        STA    NUSIZ0,X                                                                                       ;4    
  1495.        LDA    #$03                ;Set Sound Three.                                                          ;2    
  1496.        STA    $E0                                                                                            ;3    
  1497.        LDA    #$10                ;Set a Noise count of &10.                                                 ;2    
  1498.        STA    $DF                                                                                            ;3    
  1499.  
  1500. MoveDragon_5:                                                                                                                  
  1501.        JMP    MoveDragon_9        ;Jump to Finish.                                                           ;3    
  1502.  
  1503. MoveDragon_6:                                                                                                                  
  1504.        CMP    #$01                ;Is it in State 01 (Dead)                                                  ;2    
  1505.        BEQ    MoveDragon_9        ;Branch if So (Return)                                                     ;2    
  1506.                                                                                                                    
  1507.        CMP    #$02                ;Is it int State 02 (Normal #2)                                            ;2    
  1508.        BNE    MoveDragon_7        ;Branch if Not.                                                            ;2    
  1509.                                                                                                                    
  1510. ;Normal Dragon State 2 (Eaten Ball)                                                                                
  1511.        LDA    VSYNC,X             ;Get the Dragon's Current Room.                                            ;4    
  1512.        STA    $8A                 ;Store as the Ball's Current Room                                          ;3    
  1513.        STA    $E2                 ;      and Previous Room.                                                  ;3    
  1514.        LDA    VBLANK,X            ;Get the Dragon's X Coordinate.                                            ;4    
  1515.        CLC                                                                                                   ;2    
  1516.        ADC    #$03                ;Adjust                                                                    ;2    
  1517.        STA    $8B                 ;      and store as the ball's X coordinate.                               ;3    
  1518.        STA    $E3                 ;      and previous X coordinate.                                          ;3    
  1519.        LDA    WSYNC,X             ;Get the Dragon's Y coordinate.                                            ;4    
  1520.        SEC                                                                                                   ;2    
  1521.        SBC    #$0A                ;Adjust                                                                    ;2    
  1522.        STA    $8C                 ;      and store as the ball's Y coordinate.                               ;3    
  1523.        STA    $E4                 ;      and the previous Y coordinate.                                      ;3    
  1524.        JMP    MoveDragon_9                                                                                   ;3    
  1525.                                                                                                                    
  1526.                                                                                                                    
  1527. ;Dragon Roaring.                                                                                                  
  1528. MoveDragon_7:
  1529.        INC    NUSIZ0,X            ;Increment the Dragon's State.                                             ;6    
  1530.        LDA    NUSIZ0,X            ;Get it's State.                                                           ;4    
  1531.        CMP    #$FC                ;Is it near the end?                                                       ;2    
  1532.        BCC    MoveDragon_9        ;If Not, Branch.                                                           ;2    
  1533.                                                                                                                    
  1534.        LDA    $A0                 ;Get the Dragon's Number.                                                  ;3    
  1535.        JSR    PBCollision         ;Check if the Ball is colliding.                                           ;6    
  1536.        BEQ    MoveDragon_9        ;If not, Branch.                                                           ;2    
  1537.                                                                                                                    
  1538.        LDA    #$02                ;Set the State to State 02 : Eaten                                         ;2    
  1539.        STA    NUSIZ0,X                                                                                       ;4    
  1540.        LDA    #$02                ;Set noise two.                                                            ;2    
  1541.        STA    $E0                                                                                            ;3    
  1542.        LDA    #$10                ;Set the Count of Noise to &10.                                            ;2    
  1543.        STA    $DF                                                                                            ;3    
  1544.        LDA    #$9B                ;Get the Maximum X Coordinate.                                             ;2    
  1545.        CMP    VBLANK,X            ;Compare with the Dragon's X Coordinate.                                   ;4    
  1546.        BEQ    MoveDragon_8                                                                                          ;2    
  1547.        BCS    MoveDragon_8                                                                                          ;2    
  1548.                                                                                                                    
  1549.        STA    VBLANK,X            ;If too large then Use It.                                                 ;4    
  1550.  
  1551. MoveDragon_8:                                                                                                                  
  1552.        LDA    #$17                ;Set Minimum Y Coordinate.                                                 ;2    
  1553.        CMP    WSYNC,X             ;Compare with the Dragon's Y Coordinate.                                   ;4    
  1554.        BCC    MoveDragon_9                                                                                   ;2    
  1555.                                                                                                                    
  1556.        STA    WSYNC,X             ;If Too Small, set as Dragon's Y coordinate.                               ;4    
  1557. MoveDragon_9:                                                                                                                  
  1558.        RTS                                                                                                   ;6    
  1559.                                                                                                                    
  1560. ;Dragon Difficulty                                                                                                
  1561. DragonDiff:
  1562.        .byte $D0,$E8                  ;Level 1 : Am, Pro                                                          
  1563.        .byte $F0,$F6                  ;Level 2 : Am, Pro                                                          
  1564.        .byte $F0,$F6                  ;Level 3 : Am, Pro                                                          
  1565.                                                                                                                    
  1566. ;Move Bat                                                                                                          
  1567. MoveBat:
  1568.        INC    $CF                 ;Put Bat in the Next State.                                                ;5    
  1569.        LDA    $CF                 ;Get the Bat State.                                                        ;3    
  1570.        CMP    #$08                ;Has it Reached the Maximum?                                               ;2    
  1571.        BNE    MoveBat_2                                                                                      ;2    
  1572.                                                                                                                    
  1573.        LDA    #$00                ;If So, Reset the Bat State.                                               ;2    
  1574.        STA    $CF                                                                                            ;3    
  1575. MoveBat_2:                                                                                                                  
  1576.        LDA    $D1                 ;Get the Bat Fed-Up Value.                                                 ;3    
  1577.        BEQ    MoveBat_3           ;If Bat Fed-Up then Branch.                                                ;2    
  1578.                                                                                                                    
  1579.        INC    $D1                 ;Increment its value for next time.                                        ;5    
  1580.        LDA    $CE                 ;Get the Bat's Movement.                                                   ;3    
  1581.        LDX    #$CB                ;Position to Bat.                                                          ;2    
  1582.        LDY    #$03                ;Get the Bat's Deltas.                                                     ;2    
  1583.        JSR    MoveGroundObject    ;Move the Bat.                                                             ;6    
  1584.        JMP    MoveBat_4           ;Update the Bat's Object.                                                  ;3    
  1585.                                                                                                                    
  1586. ;Bat Fed-Up
  1587. MoveBat_3:                                                                                                      
  1588.        LDA    #$CB                ;Store the Bat's Dynamic Data Address                                      ;2    
  1589.        STA    $D5                                                                                            ;3    
  1590.        LDA    #$03                ;Set the Bat's Delta.                                                      ;2    
  1591.        STA    $D4                                                                                            ;3    
  1592.        LDA    #<BatMatrix         ;Set the Low Address of Object Store.                                      ;2    
  1593.        STA    $D2                                                                                            ;3    
  1594.        LDA    #>BatMatrix         ;Set the High Address of Object Store.                                     ;2    
  1595.        STA    $D3                                                                                            ;3    
  1596.        LDA    $D0                 ;Get Object being Carried by Bat,                                          ;3    
  1597.        STA    $D6                 ;      And Copy.                                                           ;3    
  1598.        JSR    MoveGameObject      ;Move the Bat.                                                             ;6    
  1599.                                                                                                                    
  1600.        LDY    $E1                 ;Get Object Liked Index.                                                   ;3    
  1601.        LDA    ($D2),Y             ;Look up the Object Found in the Table.                                    ;5    
  1602.        BEQ    MoveBat_4           ;If nothing found then Forget it.                                          ;2    
  1603.                                                                                                                    
  1604.        INY                                                                                                   ;2    
  1605.        LDA    ($D2),Y             ;Get the Object Wanted.                                                    ;5    
  1606.        TAX                                                                                                   ;2    
  1607.        LDA    VSYNC,X             ;Get the Object's Room.                                                    ;4    
  1608.        CMP    $CB                 ;Is it the Same as the Bats?                                               ;3    
  1609.        BNE    MoveBat_4           ;If not Forget it.                                                         ;2    
  1610.                                                                                                                    
  1611. ;See if Bat Can pick up Object.                                                                                    
  1612.        LDA    VBLANK,X            ;Get the Object's X Coordinate.                                            ;4    
  1613.        SEC                                                                                                   ;2    
  1614.        SBC    $CC                 ;Find the differenct with the Bat's                                        ;3    
  1615.        CLC                        ;X coordinate.                                                             ;2    
  1616.        ADC    #$04                ;Adjust so Bat in middle of object.                                        ;2    
  1617.        AND    #$F8                ;Is Bat within Seven Pixels?                                               ;2    
  1618.        BNE    MoveBat_4           ;If not, no pickup possible.                                               ;2    
  1619.                                                                                                                    
  1620.        LDA    WSYNC,X             ;Get the Object's Y Coordinate.                                            ;4    
  1621.        SEC                                                                                                   ;2    
  1622.        SBC    $CD                 ;Find the Difference with the Bat's                                        ;3    
  1623.        CLC                        ;      Y Coordinate.                                                       ;2    
  1624.        ADC    #$04                ;Adjust.                                                                   ;2    
  1625.        AND    #$F8                ;Is the Bat within Seven Pixels?                                           ;2    
  1626.        BNE    MoveBat_4           ;If not, No Pickup Possible.                                               ;2    
  1627.                                                                                                                    
  1628. ;Get Object                                                                                                        
  1629.        STX    $D0                 ;Store Object as Being Carried.                                            ;3    
  1630.        LDA    #$10                ;Reset the Bat Fed Up Time.                                                ;2    
  1631.        STA    $D1                                                                                            ;3    
  1632.                                                                                                                    
  1633. ;Move Object Being Carried by Bat.                                                                                
  1634. MoveBat_4:
  1635.        LDX    $D0                 ;Get Object Being Carried by Bat.                                          ;3    
  1636.        LDA    $CB                 ;Get the Bat's Room.                                                       ;3    
  1637.        STA    VSYNC,X             ;Store this as the Object's Room.                                          ;4    
  1638.        LDA    $CC                 ;Get the Bat's X coordinate.                                               ;3    
  1639.        CLC                                                                                                   ;2    
  1640.        ADC    #$08                ;Adjust to the Right.                                                      ;2    
  1641.        STA    VBLANK,X            ;Make it the Object's X coordinate.                                        ;4    
  1642.        LDA    $CD                 ;Get the Bat's Y Coordinate.                                               ;3    
  1643.        STA    WSYNC,X             ;Store it as the Object's Y Coordinate.                                    ;4    
  1644.        LDA    $D0                 ;Get the Object Being Carried by the Bat.                                  ;3    
  1645.        LDY    $9D                 ;Get the Object Being Carried by the Ball.                                 ;3    
  1646.        CMP    Store1,Y             ;Are the the Same?                                                         ;4    
  1647.        BNE    MoveBat_5           ;If not Branch.                                                            ;2    
  1648.                                                                                                                    
  1649.        LDA    #$A2                ;Set Nothing Being                                                         ;2    
  1650.        STA    $9D                 ;      Carried.                                                            ;3    
  1651. MoveBat_5:                                                                                                                  
  1652.        RTS                                                                                                   ;6    
  1653.                                                                                                                    
  1654.                                                                                                                    
  1655. ;Bat Object Matrix.
  1656. BatMatrix:                                                                                                
  1657.        .byte $CB,$B9                  ;Bat,Chalise                                                                
  1658.        .byte $CB,$B6                  ;Bat,Sword                                                                  
  1659.        .byte $CB,$BC                  ;Bat,Bridge                                                                  
  1660.        .byte $CB,$BF                  ;Bat,Yellow Key                                                              
  1661.        .byte $CB,$C2                  ;Bat,White Key                                                              
  1662.        .byte $CB,$C5                  ;Bat,Black Key                                                              
  1663.        .byte $CB,$A4                  ;Bat,Red Dragon                                                              
  1664.        .byte $CB,$A9                  ;Bat,Yellow Dragon                                                          
  1665.        .byte $CB,$AE                  ;Bat,Green Dragon                                                            
  1666.        .byte $CB,$B3                  ;Bat,Magnet                                                                  
  1667.        .byte $00                                                                                                  
  1668.                                                                                                                    
  1669.                                                                                                                    
  1670. ;Deal with Portcullis and Collisions.    
  1671. Portals:                                                                          
  1672.        LDY    #$02                ;For Each Portcullis.                                                      ;2    
  1673. Portals_2:
  1674.        LDX    PortOffsets,Y             ;Get the Portcullises offset number.                                       ;4    
  1675.        JSR    FindObjHit          ;See if an Object Collided with it.                                        ;6    
  1676.        STA    $97                 ;      Store that Object.                                                  ;3    
  1677.        CMP    KeyOffsets,Y             ;Is it the Associated Key?                                                 ;4    
  1678.        BNE    Portals_3           ;If not then Branch.                                                       ;2    
  1679.                                                                                                                    
  1680.        TYA                        ;Get the Portcullis Number                                                 ;2    
  1681.        TAX                                                                                                   ;2    
  1682.        INC    $C8,X               ;Change it's state to open it.                                             ;6    
  1683. Portals_3:                                                                                                                  
  1684.        TYA                        ;Get the Porcullis number.                                                 ;2    
  1685.        TAX                                                                                                   ;2    
  1686.        LDA    $C8,X               ;Get the State.                                                            ;4    
  1687.        CMP    #$1C                ;Is it Closed?                                                             ;2    
  1688.        BEQ    Portals_7           ;Yes - then Branch.                                                        ;2    
  1689.                                                                                                                    
  1690.        LDA    PortOffsets,Y             ;Get Portcullis number.                                                    ;4    
  1691.        JSR    PBCollision         ;Get the Player-Ball Collision.                                            ;6    
  1692.        BEQ    Portals_4           ;If Not Then Branch.                                                      ;2    
  1693.                                                                                                                    
  1694.        LDA    #$01                ;Set the Portcullis to Closed.                                             ;2    
  1695.        STA    $C8,X                                                                                          ;4    
  1696.        LDX    #$8A                ;Set to the Castle.                                                        ;2    
  1697.        JMP    Portals_6           ;Put the Ball in the Castle.                                               ;3    
  1698.  
  1699. Portals_4:                                                                                                                  
  1700.        LDA    $97                 ;Get the Object that hit the Portcullis.                                   ;3    
  1701.        CMP    #$A2                ;Is it nothing?                                                            ;2    
  1702.        BEQ    Portals_5           ;If so, Branch.                                                            ;2    
  1703.                                                                                                                    
  1704.        LDX    $97                 ;Get Object.                                                               ;3    
  1705.        STY    $9A                 ;Save Y                                                                    ;3    
  1706.        JSR    GetObjectAddress    ;And find it's Dynamic Address.                                            ;6    
  1707.        LDY    $9A                 ;Retrieve Y                                                                ;3    
  1708.        LDX    $93                 ;Get Object's Address.                                                     ;3    
  1709.        JMP    Portals_6           ;Put Object In the Castle.                                                 ;3    
  1710.      
  1711. Portals_5:                                                                                                              
  1712.        JMP    Portals_7                                                                                      ;3    
  1713.  
  1714. Portals_6:                                                                                                                  
  1715.        LDA    EntryRoomOffsets,Y ;Look up Castle endry room for this port.                                        ;4    
  1716.        STA    VSYNC,X       ;Make it the object's Room.                                                      ;4    
  1717.        LDA    #$10          ;Give the Object a new Y coordinate.                                             ;2    
  1718.        STA    WSYNC,X                                                                                        ;4    
  1719. Portals_7:                                                                                                                  
  1720.        TYA                  ;Get the Portcullis number.                                                      ;2    
  1721.        TAX                                                                                                   ;2    
  1722.        LDA    $C8,X         ;Get its State.                                                                  ;4    
  1723.        CMP    #$01          ;Is it Open?                                                                     ;2    
  1724.        BEQ    Portals_8     ;Yes - Then Branch.                                                              ;2    
  1725.                                                                                                                    
  1726.        CMP    #$1C          ;Is it Closed?                                                                   ;2    
  1727.        BEQ    Portals_8     ;Yes - Then Branch.                                                              ;2    
  1728.                                                                                                                    
  1729.        INC    $C8,X         ;Increment it's State.                                                           ;6    
  1730.        LDA    $C8,X         ;Get the State.                                                                  ;4    
  1731.        CMP    #$38          ;Has it reached the maximum state.                                               ;2    
  1732.        BNE    Portals_8     ;If not, Branch.                                                                 ;2    
  1733.                                                                                                                    
  1734.        LDA    #$01          ;Set to Closed                                                                   ;2    
  1735.        STA    $C8,X         ;      State.                                                                    ;4    
  1736.  
  1737. Portals_8:                                                                                                                  
  1738.        DEY                  ;Goto the next portcullis.                                                       ;2    
  1739.        BMI    Portals_9     ;Branch if Finished.                                                             ;2    
  1740.        JMP    Portals_2     ;Do next Protcullis.                                                             ;3    
  1741. Portals_9:
  1742.        RTS                                                                                                   ;6    
  1743.  
  1744.  
  1745.  
  1746.                                                                                                                    
  1747. ;Portcullis #1, #2, #3
  1748. PortOffsets:                                                                                            
  1749.      .byte $09,$12,$1B                                                                                          
  1750.                                                                                                                    
  1751. ;Keys #1, #2, #3  (Yellow, White, Black)                                                                          
  1752. KeyOffsets:
  1753.      .byte $63,$6C,$75                                                                                          
  1754.                                                                                                                    
  1755. ;Castle Entry Rooms (Yellow, White, Black)
  1756. EntryRoomOffsets:                                                                        
  1757.      .byte $12,$1A,$1B                                                                                          
  1758.                                                                                                                    
  1759. ;Castle Rooms (Yellow, White, Black)                                                                              
  1760. CastleRoomOffsets:
  1761.      .byte $11,$0F,$10                                                                                          
  1762.                                                                                                                    
  1763.                                                                                                                    
  1764. ;Deal With Magnet.                                                                                                
  1765. Mag_1:
  1766.      LDA    $B5                 ;Get Magnet's Y Coordinate.                                                ;3    
  1767.        SEC                                                                                                   ;2    
  1768.        SBC    #$08                ;Adjust to it's "Poles".                                                   ;2    
  1769.        STA    $B5                                                                                            ;3    
  1770.        LDA    #$00                ;Con Difficulty!                                                           ;2    
  1771.        STA    $D6                                                                                            ;3    
  1772.        LDA    #<MagnetMatrix                ;Set Low Address of Object Store.                                          ;2    
  1773.        STA    $D2                                                                                            ;3    
  1774.        LDA    #>MagnetMatrix                ;Set High Address of Object Store.                                         ;2    
  1775.        STA    $D3                                                                                            ;3    
  1776.        JSR    GetLinkedObject     ;Get Liked Object and Set Movement.                                        ;6    
  1777.        LDA    $9B                 ;Get Movement.                                                             ;3    
  1778.        BEQ    Mag_2               ;If None, then Forget It.                                                  ;2    
  1779.                                                                                                                    
  1780.        LDY    #$01                ;Set Delta to One.                                                         ;2    
  1781.        JSR    MoveGroundObject     ;Move Object.                                                              ;6    
  1782.                                                                                                                    
  1783. Mag_2:
  1784.      LDA    $B5                 ;Reset the Magnet's                                                        ;3    
  1785.        CLC                        ;      Y Coordinate.                                                       ;2    
  1786.        ADC    #$08                                                                                           ;2    
  1787.        STA    $B5                                                                                            ;3    
  1788.        RTS                                                                                                   ;6    
  1789.                                                                                                                    
  1790. ;Magnet Object Matrix.                                                                                            
  1791. MagnetMatrix:
  1792.        .byte $BF,$B3                  ;Yellow Key, Magnet                                                          
  1793.        .byte $C2,$B3                  ;White Key, Magnet                                                          
  1794.        .byte $C5,$B3                  ;Black Key, Magnet                                                          
  1795.        .byte $B6,$B3                  ;Sword, Magnet                                                              
  1796.        .byte $BC,$B3                  ;Bridge, Magnet                                                              
  1797.        .byte $B9,$B3                  ;Chalise, Magnet                                                            
  1798.        .byte $00                                                                                                  
  1799.                                                                                                                    
  1800.                                                                                                                    
  1801.                                                                                                                    
  1802. ;Deal with Invisible Surround Moving.                                                                              
  1803. Surround:
  1804.      LDA    $8A                 ;Get the Current Room.                                                     ;3    
  1805.        JSR    RoomNumToAddress    ;Convert it to an Address.                                                 ;6    
  1806.        LDY    #$02                                                                                           ;2    
  1807.        LDA    ($93),Y             ;Get the Room's Color.                                                     ;5    
  1808.        CMP    #$08                ;Is it Invisible?                                                          ;2    
  1809.        BEQ    Surround_2          ;If So Branch.                                                             ;2    
  1810.                                                                                                                    
  1811.        LDA    #$00                ;If not, signal the                                                        ;2    
  1812.        STA    $DB                 ;      Invisible surround not                                              ;3    
  1813.        JMP    Surround_4          ;      Wanted.                                                             ;3    
  1814.  
  1815. Surround_2:                                                                                                                  
  1816.        LDA    $8A                 ;Get the Current Room.                                                     ;3    
  1817.        STA    $D9                 ;And store as the Invisible Surrounds.                                     ;3    
  1818.        LDA    $8B                 ;Get the Ball's X Coordinate.                                              ;3    
  1819.        SEC                                                                                                   ;2    
  1820.        SBC    #$0E                ;Adjust for Surround,                                                      ;2    
  1821.        STA    $DA                 ;      and store as surround's X coordinate.                               ;3    
  1822.        LDA    $8C                 ;Get the Ball's Y Coordinate.                                              ;3    
  1823.        CLC                                                                                                   ;2    
  1824.        ADC    #$0E                ;Adjust for Surround.                                                      ;2    
  1825.        STA    $DB                 ;      and store as surround's Y coordinate.                               ;3    
  1826.        LDA    $DA                 ;Get the Surround's X cordinate.                                           ;3    
  1827.        CMP    #$F0                ;Is it close to the right edge?                                            ;2    
  1828.        BCC    Surround_3          ;Branch if not.                                                            ;2    
  1829.                                                                                                                    
  1830.        LDA    #$01                ;Flick surround to the                                                     ;2    
  1831.        STA    $DA                 ;      otherside of the screen.                                            ;3    
  1832.        JMP    Surround_4                                                                                     ;3    
  1833.  
  1834. Surround_3:                                                                                                                  
  1835.        CMP    #$82                ;???                                                                       ;2    
  1836.        BCC    Surround_4          ;???                                                                       ;2    
  1837.                                                                                                                    
  1838.        LDA    #$81                ;???                                                                       ;2    
  1839.        STA    $DA                 ;???                                                                       ;3    
  1840. Surround_4:
  1841.        RTS                                                                                                   ;6    
  1842.                                                                                                                    
  1843.                                                                                                                    
  1844. ;Make A Noise.                                                                                                    
  1845. MakeSound:
  1846.      LDA    $DF                 ;Check Not Count.                                                          ;3    
  1847.        BNE    MakeSound_2         ;Branch if Noise to be made.                                               ;2    
  1848.                                                                                                                    
  1849.        STA    AUDV0               ;Turn off the Volume.                                                      ;3    
  1850.        STA    AUDV1                                                                                          ;3    
  1851.        RTS                                                                                                   ;6    
  1852.  
  1853. MakeSound_2:                                                                                                                  
  1854.        DEC    $DF                 ;Goto the Next Note.                                                       ;5    
  1855.        LDA    $E0                 ;Get the Noise Type.                                                       ;3    
  1856.        BEQ    NoiseGameOver       ;Game Over                                                                 ;2    
  1857.                                                                                                                    
  1858.        CMP    #$01                ;Roar                                                                      ;2    
  1859.        BEQ    NoiseRoar                                                                                      ;2    
  1860.                                                                                                                    
  1861.        CMP    #$02                ;Man Eaten.                                                                ;2    
  1862.        BEQ    EatenNoise                                                                                     ;2    
  1863.                                                                                                                    
  1864.        CMP    #$03                ;Dying Dragon.                                                             ;2    
  1865.        BEQ    DragDieNoise                                                                                   ;2    
  1866.                                                                                                                    
  1867.        CMP    #$04                ;Dropping Object.                                                          ;2    
  1868.        BEQ    NoiseDropObject                                                                                          ;2    
  1869.                                                                                                                    
  1870.        CMP    #$05                ;Picking up Object.                                                        ;2    
  1871.        BEQ    NoiseGetObject                                                                                          ;2    
  1872.                                                                                                                    
  1873.        RTS                                                                                                   ;6    
  1874.                                                                                                                    
  1875.                                                                                                                    
  1876. ;Noise 0 : Game Over                                                                                              
  1877. NoiseGameOver:
  1878.        LDA    $DF                                                                                            ;3    
  1879.        STA    COLUPF              ;Color-Luminance Playfield.                                                ;3    
  1880.        STA    AUDC0               ;Audio-Control 00                                                          ;3    
  1881.        LSR                                                                                                   ;2    
  1882.        STA    AUDV0               ;Audio-Volume 00                                                           ;3    
  1883.        LSR                                                                                                   ;2    
  1884.        LSR                                                                                                   ;2    
  1885.        STA    AUDF0               ;Audio-Frequency 00                                                        ;3    
  1886.        RTS                                                                                                   ;6    
  1887.                                                                                                                    
  1888. ;Noise 1 : Roar                                                                                                    
  1889. NoiseRoar:
  1890.        LDA    $DF                 ;Get noise count.                                                          ;3    
  1891.        LSR                                                                                                   ;2    
  1892.        LDA    #$03                ;If it was even then                                                       ;2    
  1893.        BCS    SetVolume           ;Branch.                                                                   ;2    
  1894.                                                                                                                    
  1895.        LDA    #$08                ;Get a differnt audio control value.                                       ;2    
  1896.  
  1897. SetVolume:                                                                                                                  
  1898.        STA    AUDC0               ;Set Audio Control 00.                                                     ;3    
  1899.        LDA    $DF                 ;Set the Volume to the Noise Count.                                        ;3    
  1900.        STA    AUDV0                                                                                          ;3    
  1901.        LSR                        ;Divide by Four.                                                           ;2    
  1902.        LSR                                                                                                   ;2    
  1903.        CLC                                                                                                   ;2    
  1904.        ADC    #$1C                ;Set the Frequency.                                                        ;2    
  1905.        STA    AUDF0                                                                                          ;3    
  1906.        RTS                                                                                                   ;6    
  1907.                                                                                                                    
  1908.                                                                                                                    
  1909. ;Noise 2 : Man Eaten                                                                                              
  1910. EatenNoise:
  1911.        LDA    #$06                                                                                           ;2    
  1912.        STA    AUDC0               ;Audio-Control 00                                                          ;3    
  1913.        LDA    $DF                                                                                            ;3    
  1914.        EOR    #$0F                                                                                           ;2    
  1915.        STA    AUDF0               ;Audio-Frequency 00                                                        ;3    
  1916.        LDA    $DF                                                                                            ;3    
  1917.        LSR                                                                                                   ;2    
  1918.        CLC                                                                                                   ;2    
  1919.        ADC    #$08                                                                                           ;2    
  1920.        STA    AUDV0               ;Audio-Volume 00                                                           ;3    
  1921.        RTS                                                                                                   ;6    
  1922.                                                                                                                    
  1923.                                                                                                                    
  1924. ;Noise 3 : Dyning Dragon                                                                                          
  1925. DragDieNoise:
  1926.        LDA    #$04                ;Set the Audio Control                                                     ;2    
  1927.        STA    AUDC0                                                                                          ;3    
  1928.        LDA    $DF                 ;Put the Note Count In                                                     ;3    
  1929.        STA    AUDV0               ;      the Volume.                                                         ;3    
  1930.        EOR    #$1F                                                                                           ;2    
  1931.        STA    AUDF0               ;Flip the Count as store                                                   ;3    
  1932.        RTS                        ;      as the frequency.                                                   ;6    
  1933.                                                                                                                    
  1934.                                                                                                                    
  1935. ;Noise 4 : Dropping Object.                                                                                        
  1936. NoiseDropObject:
  1937.        LDA    $DF                 ;Get Not Count                                                             ;3    
  1938.        EOR    #$03                ;Reverse it as noise does up.                                              ;2    
  1939. NoiseDropObject_2:
  1940.        STA    AUDF0               ;Store in Frequency for Channel 00.                                        ;3    
  1941.        LDA    #$05                                                                                           ;2    
  1942.        STA    AUDV0               ;Set Volume on Channel 00.                                                 ;3    
  1943.        LDA    #$06                                                                                           ;2    
  1944.        STA    AUDC0               ;Set a Noise on Channel 00.                                                ;3    
  1945.        RTS                                                                                                   ;6    
  1946.                                                                                                                    
  1947.                                                                                                                    
  1948. ;Noise 5 : Picking up an Object.                                                                                  
  1949. NoiseGetObject:
  1950.        LDA    $DF                 ;Get Not Count.                                                            ;3    
  1951.        JMP    NoiseDropObject_2   ;      and Make Same noise as Drop.                                        ;3    
  1952.                                                                                                                    
  1953.                                                                                                                    
  1954. ;Left of Name Room                                                                                                
  1955. LeftOfName:
  1956.        .byte $F0,$FF,$FF          ;XXXXXXXXXXXXXXXXXXXXRRRRRRRRRRRRRRRRRRRRRRRR                                  
  1957.        .byte $00,$00,$00                                                                                          
  1958.        .byte $00,$00,$00                                                                                          
  1959.        .byte $00,$00,$00                                                                                          
  1960.        .byte $00,$00,$00                                                                                          
  1961.        .byte $00,$00,$00                                                                                          
  1962.  
  1963. ;Below Yellow Castle                                                                                              
  1964. BelowYellowCastle:
  1965.        .byte $F0,$FF,$0F          ;XXXXXXXXXXXXXXXX        RRRRRRRRRRRRRRRRRRRR   **Line Shared With Above Room ----^                              
  1966.        .byte $00,$00,$00                                                                                          
  1967.        .byte $00,$00,$00                                                                                          
  1968.        .byte $00,$00,$00                                                                                          
  1969.        .byte $00,$00,$00                                                                                          
  1970.        .byte $00,$00,$00                                                                                          
  1971.        .byte $F0,$FF,$FF          ;XXXXXXXXXXXXXXXXXXXXRRRRRRRRRRRRRRRRRRRRRRRR                                  
  1972.                                                                                                                    
  1973.                                                                                                                    
  1974. ;Side Corridor                                                                                                    
  1975. SideCorridor:
  1976.        .byte $F0,$FF,$0F          ;XXXXXXXXXXXXXXXX        RRRRRRRRRRRRRRRR                                      
  1977.        .byte $00,$00,$00                                                                                          
  1978.        .byte $00,$00,$00                                                                                          
  1979.        .byte $00,$00,$00                                                                                          
  1980.        .byte $00,$00,$00                                                                                          
  1981.        .byte $00,$00,$00                                                                                          
  1982.        .byte $F0,$FF,$0F          ;XXXXXXXXXXXXXXXX        RRRRRRRRRRRRRRRR                                      
  1983.                                                                                                                    
  1984.                                                                                                                    
  1985. ;Number Room Definition                                                                                            
  1986. NumberRoom:
  1987.        .byte $F0,$FF,$FF          ;XXXXXXXXXXXXXXXXXXXXRRRRRRRRRRRRRRRRRRRR                                      
  1988.        .byte $30,$00,$00          ;XX                                    RR                                      
  1989.        .byte $30,$00,$00          ;XX                                    RR                                      
  1990.        .byte $30,$00,$00          ;XX                                    RR                                      
  1991.        .byte $30,$00,$00          ;XX                                    RR                                      
  1992.        .byte $30,$00,$00          ;XX                                    RR                                      
  1993.        .byte $F0,$FF,$0F          ;XXXXXXXXXXXXXXXXXXXXRRRRRRRRRRRRRRRRRRRR                                      
  1994.                                                                                                                    
  1995.                                                                                                                    
  1996. ;Object #1 States (Portcullis)                                                                                    
  1997. PortStates:
  1998.        .byte $04,<GfxPort07,>GfxPort07          ;State 04 at FB24 -Open                                                        
  1999.        .byte $08,<GfxPort06,>GfxPort06          ;State 08 at FB22                                                              
  2000.        .byte $0C,<GfxPort05,>GfxPort05          ;State 0C at FB20                                                              
  2001.        .byte $10,<GfxPort04,>GfxPort04          ;State 10 at FB1E                                                              
  2002.        .byte $14,<GfxPort03,>GfxPort03          ;State 14 at FB1C                                                            
  2003.        .byte $18,<GfxPort02,>GfxPort02          ;State 18 at FB1A                                                              
  2004. LFB03: .byte $1C,<GfxPort01,>GfxPort01          ;State 1C at FB18 -Closed                                              
  2005.        .byte $20,<GfxPort02,>GfxPort02          ;State 20 at FB1A                                                              
  2006.        .byte $24,<GfxPort03,>GfxPort03          ;State 24 at FB1C                                                              
  2007.        .byte $28,<GfxPort04,>GfxPort04          ;State 28 at FB1E                                                              
  2008.        .byte $2C,<GfxPort05,>GfxPort05          ;State 2C at FB20                                                              
  2009.        .byte $30,<GfxPort06,>GfxPort06          ;State 30 at FB22                                                              
  2010. LFB15: .byte $FF,<GfxPort07,>GfxPort07          ;State FF at FB24 -Open                                                        
  2011.                                                                                                                    
  2012.                                                                                                                    
  2013. ;Object #1 States 940FF (Graphic)                                                                                  
  2014. GfxPort01:
  2015.        .byte $FE                  ;XXXXXXX                                                                  
  2016.        .byte $AA                  ;X X X X                                                                  
  2017. GfxPort02:
  2018.        .byte $FE                  ;XXXXXXX                                                                  
  2019.        .byte $AA                  ;X X X X                                                                  
  2020. GfxPort03:
  2021.        .byte $FE                  ;XXXXXXX                                                                  
  2022.        .byte $AA                  ;X X X X                                                                  
  2023. GfxPort04:
  2024.        .byte $FE                  ;XXXXXXX                                                                  
  2025.        .byte $AA                  ;X X X X                                                                  
  2026. GfxPort05:
  2027.        .byte $FE                  ;XXXXXXX                                                                  
  2028.        .byte $AA                  ;X X X X                                                                  
  2029. GfxPort06:
  2030.        .byte $FE                  ;XXXXXXX                                                                  
  2031.        .byte $AA                  ;X X X X                                                                  
  2032. GfxPort07:
  2033.        .byte $FE                  ;XXXXXXX                                                                  
  2034.        .byte $AA                  ;X X X X                                                                  
  2035. GfxPort08:
  2036.        .byte $FE                  ;XXXXXXX                                                                  
  2037.        .byte $AA                  ;X X X X                                                                  
  2038. GfxPort09:
  2039.        .byte $00                                                                                                  
  2040.                                                                                                                    
  2041. ;Two Exit Room                                                                                                    
  2042. TwoExitRoom:
  2043.        .byte $F0,$FF,$0F          ;XXXXXXXXXXXXXXXX        RRRRRRRRRRRRRRRR                                      
  2044.        .byte $30,$00,$00          ;XX                                    RR                                      
  2045.        .byte $30,$00,$00          ;XX                                    RR                                      
  2046.        .byte $30,$00,$00          ;XX                                    RR                                      
  2047.        .byte $30,$00,$00          ;XX                                    RR                                      
  2048.        .byte $30,$00,$00          ;XX                                    RR                                      
  2049.        .byte $F0,$FF,$0F          ;XXXXXXXXXXXXXXXX        RRRRRRRRRRRRRRRR                                      
  2050.                                                                                                                    
  2051.                                                                                                                    
  2052. ;Top of Blue Maze                                                                                                  
  2053. BlueMazeTop:
  2054.        .byte $F0,$FF,$0F          ;XXXXXXXXXXXXXXXX        RRRRRRRRRRRRRRRR                                      
  2055.        .byte $00,$0C,$0C          ;        XX    XX        RR    RR                                              
  2056.        .byte $F0,$0C,$3C          ;XXXX    XX    XXXX    RRRR    RR    RRRR                                      
  2057.        .byte $F0,$0C,$00          ;XXXX    XX                    RR    RRRR                                      
  2058.        .byte $F0,$FF,$3F          ;XXXXXXXXXXXXXXXXXX    RRRRRRRRRRRRRRRRRR                                      
  2059.        .byte $00,$30,$30          ;      XX        XX    RR        RR                                            
  2060.        .byte $F0,$33,$3F          ;XXXX  XX  XXXXXXXX    RRRRRRRR  RR  RRRR                                      
  2061.                                                                                                                  
  2062. ;Blue Maze #1                                                                                                      
  2063. BlueMaze1:
  2064.        .byte $F0,$FF,$FF          ;XXXXXXXXXXXXXXXXXXXXRRRRRRRRRRRRRRRRRRRR                                      
  2065.        .byte $00,$00,$00          ;                                                                              
  2066.        .byte $F0,$FC,$FF          ;XXXXXXXXXX  XXXXXXXXRRRRRRRR  RRRRRRRRRR                                      
  2067.        .byte $F0,$00,$C0          ;XXXX              XXRR              RRRR                                      
  2068.        .byte $F0,$3F,$CF          ;XXXX  XXXXXXXXXX  XXRR  RRRRRRRRRR  RRRR                                      
  2069.        .byte $00,$30,$CC          ;      XX      XX  XXRR  RR      RR                                            
  2070.        .byte $F0,$F3,$CC          ;XXXXXXXX  XX  XX  XXRR  RR  RR  RRRRRRRR                                      
  2071.                                                                                                                    
  2072. ;Bottom of Blue Maze                                                                                              
  2073. BlueMazeBottom:
  2074.        .byte $F0,$F3,$0C          ;XXXXXXXX  XX  XX        RR  RR  RRRRRRRR                                      
  2075.        .byte $00,$30,$0C          ;      XX      XX        RR      RR                                          
  2076.        .byte $F0,$3F,$0F          ;XXXX  XXXXXXXXXX        RRRRRRRRRR  RRRR                                      
  2077.        .byte $F0,$00,$00          ;XXXX                                RRRR                                      
  2078.        .byte $F0,$F0,$00          ;XXXXXXXX                        RRRRRRRR                                      
  2079.        .byte $00,$30,$00          ;      XX                        RR                                            
  2080.        .byte $F0,$FF,$FF          ;XXXXXXXXXXXXXXXXXXXXRRRRRRRRRRRRRRRRRRRR                                      
  2081.                                                                                                                    
  2082. ;Center of Blue Maze                                                                                              
  2083. BlueMazeCenter:
  2084.        .byte $F0,$33,$3F          ;XXXX  XX  XXXXXXXX    RRRRRRRR  RR  RRRR                                      
  2085.        .byte $00,$30,$3C          ;      XX      XXXX    RRRR      RR                                            
  2086.        .byte $F0,$FF,$3C          ;XXXXXXXXXXXX  XXXX    RRRR  RRRRRRRRRRRR                                      
  2087.        .byte $00,$03,$3C          ;          XX  XXXX    RRRR  RR                                                
  2088.        .byte $F0,$33,$3C          ;XXXX  XX  XX  XXXX    RRRR  RR  RR  RRRR                                      
  2089.        .byte $00,$33,$0C          ;      XX  XX  XX        RR  RR  RR                                            
  2090.        .byte $F0,$F3,$0C          ;XXXXXXXX  XX  XX        RR  RR  RRRRRRRR                                      
  2091.                                                                                                                    
  2092. ;Blue Maze Entry                                                                                                  
  2093. BlueMazeEntry:
  2094.        .byte $F0,$F3,$CC          ;XXXXXXXX  XX  XX  XXRR  RR  RR  RRRRRRRR                                      
  2095.        .byte $00,$33,$0C          ;      XX  XX  XX        RR  RR  RR                                            
  2096.        .byte $F0,$33,$FC          ;XXXX  XX  XX  XXXXXXRRRRRR  RR  RR  RRRR                                      
  2097.        .byte $00,$33,$00          ;      XX  XX                RR  RR                                            
  2098.        .byte $F0,$F3,$FF          ;XXXXXXXX  XXXXXXXXXXRRRRRRRRRR  RRRRRRRR                                      
  2099.        .byte $00,$00,$00          ;                                                                              
  2100.        .byte $F0,$FF,$0F          ;XXXXXXXXXXXXXXXX        RRRRRRRRRRRRRRRR                                      
  2101.                                                                                                                    
  2102. ;Maze Middle                                                                                                      
  2103. MazeMiddle:
  2104.        .byte $F0,$FF,$CC          ;XXXXXXXXXXXX  XX  XXRR  RR  RRRRRRRRRRRR                                      
  2105.        .byte $00,$00,$CC          ;              XX  XXRR  RR                                                    
  2106.        .byte $F0,$03,$CF          ;XXXX      XXXXXX  XXRR  RRRRRR      RRRR                                      
  2107.        .byte $00,$03,$00          ;          XX                RR                                                
  2108.        .byte $F0,$F3,$FC          ;XXXXXXXX  XX  XXXXXXRRRRRR  RR  RRRRRRRR                                    
  2109.        .byte $00,$33,$0C          ;      XX  XX  XX        RR  RR  RR                                            
  2110.  
  2111. ;Maze Side
  2112. MazeSide:                                                                                                        
  2113.        .byte $F0,$33,$CC          ;XXXX  XX  XX  XX  XXRR  RR  RR  RR  RRRR     **Line Shared With Above Room ----^                                        
  2114.        .byte $00,$30,$CC          ;      XX      XX  XXRR  RR      RR                                            
  2115.        .byte $00,$3F,$CF          ;      XXXXXX  XX  XXRR  RR  RRRRRR                                            
  2116.        .byte $00,$00,$C0          ;                  XXRR                                                        
  2117.        .byte $00,$3F,$C3          ;      XXXXXXXX    XXRR    RRRRRRRR                                            
  2118.        .byte $00,$30,$C0          ;      XX          XXRR          RR                                            
  2119.        .byte $F0,$FF,$FF          ;XXXXXXXXXXXXXXXXXXXXRRRRRRRRRRRRRRRRRRRR                                      
  2120.                                                                                                                    
  2121. ;Maze Entry                                                                                                        
  2122. MazeEntry:
  2123.        .byte $F0,$FF,$0F          ;XXXXXXXXXXXXXXXX        RRRRRRRRRRRRRRRR                                      
  2124.        .byte $00,$30,$00          ;      XX                        RR                                            
  2125.        .byte $F0,$30,$FF          ;XXXX  XX    XXXXXXXXRRRRRRRRR   RR  RRRR                                      
  2126.        .byte $00,$30,$C0          ;      XX          XXRR          RR                                            
  2127.        .byte $F0,$F3,$C0          ;XXXXXXXX  XX      XXRR      RR  RRRRRRRR                                      
  2128.        .byte $00,$03,$C0          ;          XX      XXRR      RR                                                
  2129.        .byte $F0,$FF,$CC          ;XXXXXXXXXXXX  XX  XXRR  RR  RRRRRRRRRRRR                                      
  2130.                                                                                                                    
  2131. ;Castle Definition                                                                                                
  2132. CastleDef:
  2133.        .byte $F0,$FE,$15          ;XXXXXXXXXXX X X X      R R R RRRRRRRRRRR                                      
  2134.        .byte $30,$03,$1F          ;XX        XXXXXXX      RRRRRRR        RR                                      
  2135.        .byte $30,$03,$FF          ;XX        XXXXXXXXXXRRRRRRRRRR        RR                                      
  2136.        .byte $30,$00,$FF          ;XX          XXXXXXXXRRRRRRRR          RR                                      
  2137.        .byte $30,$00,$3F          ;XX          XXXXXX    RRRRRR          RR                                      
  2138.        .byte $30,$00,$00          ;XX                                    RR                                      
  2139.        .byte $F0,$FF,$0F          ;XXXXXXXXXXXXXX            RRRRRRRRRRRRRR                                      
  2140.                                                                                                                    
  2141. ;Object Data                                                                                                      
  2142. ;Offset 0 : Room number of object.                                                                                
  2143. ;Offset 1 : X Coordinate of object.                                                                                
  2144. ;Offset 2 : Y Coordinate of object.                                                                                
  2145.                                                                                                                    
  2146. ;Object #1 : Portcullis                                                                                            
  2147. PortInfo1:
  2148.        .byte $11,$4D,$31          ;Room 11, (4D, 31)                                                            
  2149. ;Object #2 : Portcullis                                                                                          
  2150. PortInfo2:
  2151.        .byte $0F,$4D,$31          ;Room 0F, (4D, 31)                                                            
  2152. ;Object #3 : Portcullis                                                                                          
  2153. PortInfo3:
  2154.        .byte $10,$4D,$31          ;Room 10, (4D, 31                                                              
  2155.                                                                                                                    
  2156. ;Object #0 : State                                                                                                
  2157. SurroundCurr:
  2158.        .byte $00                                                                                                  
  2159.                                                                                                                    
  2160. ;Object #1 : State List                                                                                            
  2161. SurroundStates:
  2162.        .byte $FF,<GfxSurround,>GfxSurround          ;State FF as FC05                                                              
  2163.                                                                                                                    
  2164. ;Object #1 : Graphic                                                                                              
  2165. GfxSurround:
  2166.        .byte $FF                  ;XXXXXXXX                                                                  
  2167.        .byte $FF                  ;XXXXXXXX                                                                  
  2168.        .byte $FF                  ;XXXXXXXX                                                                  
  2169.        .byte $FF                  ;XXXXXXXX                                                                  
  2170.        .byte $FF                  ;XXXXXXXX                                                                  
  2171.        .byte $FF                  ;XXXXXXXX                                                                  
  2172.        .byte $FF                  ;XXXXXXXX                                                                  
  2173.        .byte $FF                  ;XXXXXXXX                                                                  
  2174.        .byte $FF                  ;XXXXXXXX                                                                  
  2175.        .byte $FF                  ;XXXXXXXX                                                                  
  2176.        .byte $FF                  ;XXXXXXXX                                                                  
  2177.        .byte $FF                  ;XXXXXXXX                                                                  
  2178.        .byte $FF                  ;XXXXXXXX                                                                  
  2179.        .byte $FF                  ;XXXXXXXX                                                                  
  2180.        .byte $FF                  ;XXXXXXXX                                                                  
  2181.        .byte $FF                  ;XXXXXXXX                                                                  
  2182.        .byte $FF                  ;XXXXXXXX                                                                  
  2183.        .byte $FF                  ;XXXXXXXX                                                                  
  2184.        .byte $FF                  ;XXXXXXXX                                                                  
  2185.        .byte $FF                  ;XXXXXXXX                                                                  
  2186.        .byte $FF                  ;XXXXXXXX                                                                  
  2187.        .byte $FF                  ;XXXXXXXX                                                                  
  2188.        .byte $FF                  ;XXXXXXXX                                                                  
  2189.        .byte $FF                  ;XXXXXXXX                                                                  
  2190.        .byte $FF                  ;XXXXXXXX                                                                  
  2191.        .byte $FF                  ;XXXXXXXX                                                                  
  2192.        .byte $FF                  ;XXXXXXXX                                                                  
  2193.        .byte $FF                  ;XXXXXXXX                                                                  
  2194.        .byte $FF                  ;XXXXXXXX                                                                  
  2195.        .byte $FF                  ;XXXXXXXX                                                                  
  2196.        .byte $FF                  ;XXXXXXXX                                                                  
  2197.        .byte $FF                  ;XXXXXXXX                                                                  
  2198.        .byte $00                                                                                                  
  2199.                                                                                                                    
  2200. ;Red Maze #1                                                                                                      
  2201. RedMaze1:
  2202.        .byte $F0,$FF,$FF          ;XXXXXXXXXXXXXXXXXXXXRRRRRRRRRRRRRRRRRRRR                                      
  2203.        .byte $00,$00,$00          ;                                                                              
  2204.        .byte $F0,$FF,$0F          ;XXXXXXXXXXXXXXXX        RRRRRRRRRRRRRRRR                                      
  2205.        .byte $00,$00,$0C          ;                  XX        RR                                                
  2206.        .byte $F0,$FF,$0C          ;XXXXXXXXXXXX  XX        RR  RRRRRRRRRRRR                                      
  2207.        .byte $F0,$03,$CC          ;XXXX      XX  XX  XXRR  RR  RR      RRRR                                      
  2208.  
  2209. ;Bottom of Red Maze                                                                                                
  2210. RedMazeBottom:
  2211.        .byte $F0,$33,$CF          ;XXXX  XX  XXXXXX  XXRR  RRRRRR  RR  RRRR     **Line Shared With Above Room ----^  
  2212.        .byte $F0,$30,$00          ;XXXX  XX                        RR  RRRR                                      
  2213.        .byte $F0,$33,$FF          ;XXXX  XX  XXXXXXXXXXRRRRRRRRRR  RR  RRRR                                      
  2214.        .byte $00,$33,$00          ;      XX  XX                RR  RR  RRRR                                      
  2215.        .byte $F0,$FF,$00          ;XXXXXXXXXXXX                RRRRRRRRRRRR                                      
  2216.        .byte $00,$00,$00          ;                                                                              
  2217.        .byte $F0,$FF,$0F          ;XXXXXXXXXXXXXXXX        RRRRRRRRRRRRRRRR                                      
  2218.                                                                                                                    
  2219. ;Top of Red Maze                                                                                                  
  2220. RedMazeTop:
  2221.        .byte $F0,$FF,$FF          ;XXXXXXXXXXXXXXXXXXXXRRRRRRRRRRRRRRRRRRRR                                      
  2222.        .byte $00,$00,$C0          ;                  XXRR                                                        
  2223.        .byte $F0,$FF,$CF          ;XXXXXXXXXXXXXXXX  XXRR  RRRRRRRRRRRRRRRR                                      
  2224.        .byte $00,$00,$CC          ;              XX  XXRR  RR                                                    
  2225.        .byte $F0,$33,$FF          ;XXXX  XX  XXXXXXXXXXRRRRRRRRRR  RR  RRRR                                      
  2226.        .byte $F0,$33,$00          ;XXXX  XX  XX                RR  RR  RRRR                                      
  2227.  
  2228. ;White Castle Entry                                                                                                
  2229. WhiteCastleEntry:
  2230.        .byte $F0,$3F,$0C          ;XXXX  XXXXXX  XX        RR  RRRRRR  RRRR     **Line Shared With Above Room ----^  
  2231.        .byte $F0,$00,$0C          ;XXXX          XX        RR          RRRR                                      
  2232.        .byte $F0,$FF,$0F          ;XXXXXXXXXXXXXXXX        RRRRRRRRRRRRRRRR                                      
  2233.        .byte $00,$30,$00          ;      XX                        RR                                            
  2234.        .byte $F0,$30,$00          ;XXXX  XX                        RR  RRRR                                      
  2235.        .byte $00,$30,$00          ;      XX                        RR                                            
  2236.        .byte $F0,$FF,$0F          ;XXXXXXXXXXXXXXXX        RRRRRRRRRRRRRRRR                                      
  2237.                                                                                                                    
  2238. ;Top Entry Room  
  2239. TopEntryRoom:                                                                                                  
  2240.        .byte $F0,$FF,$0F          ;XXXXXXXXXXXXXXXX        RRRRRRRRRRRRRRRR                                      
  2241.        .byte $30,$00,$00          ;XX                                    RR                                      
  2242.        .byte $30,$00,$00          ;XX                                    RR                                      
  2243.        .byte $30,$00,$00          ;XX                                    RR                                      
  2244.        .byte $30,$00,$00          ;XX                                    RR                                      
  2245.        .byte $30,$00,$00          ;XX                                    RR                                      
  2246.        .byte $F0,$FF,$FF          ;XXXXXXXXXXXXXXXXXXXXRRRRRRRRRRRRRRRRRRRR                                      
  2247.                                                                                                                    
  2248. ;Black Maze #1                                                                                                    
  2249. BlackMaze1:
  2250.        .byte $F0,$F0,$FF          ;XXXXXXXX    XXXXXXXXRRRRRRRR    RRRRRRRR                                      
  2251.        .byte $00,$00,$03          ;            XX            RR                                                  
  2252.        .byte $F0,$FF,$03          ;XXXXXXXXXXXXXX            RRRRRRRRRRRRRR                                      
  2253.        .byte $00,$00,$00          ;                                                                              
  2254.        .byte $30,$3F,$FF          ;XX    XXXXXXXXXXXXXXRRRRRRRRRRRRRR    RR                                      
  2255.        .byte $00,$30,$00          ;      XX                        RR                                            
  2256.  
  2257. ;Black Maze #3                                                                                                    
  2258. BlackMaze3:
  2259.        .byte $F0,$F0,$FF          ;XXXXXXXX    XXXXXXXXRRRRRRRR    RRRRRRRR    **Line Shared With Above Room ----^ (Mirrored Not Reversed)  
  2260.        .byte $30,$00,$00          ;XX                  MM                                                        
  2261.        .byte $30,$3F,$FF          ;XX    XXXXXXXXXXXXXXMM    MMMMMMMMMMMMMM                                      
  2262.        .byte $00,$30,$00          ;      XX                  MM                                                  
  2263.        .byte $F0,$F0,$FF          ;XXXXXXXX    XXXXXXXXMMMMMMMM    MMMMMMMM                                      
  2264.        .byte $30,$00,$03          ;XX          XX      MM          MM                                            
  2265.        .byte $F0,$F0,$FF          ;XXXXXXXX    XXXXXXXXMMMMMMMM    MMMMMMMM                                      
  2266.                                                                                                                    
  2267. ;Black Maze #2                                                                                                    
  2268. BlackMaze2:
  2269.        .byte $F0,$FF,$FF          ;XXXXXXXXXXXXXXXXXXXXMMMMMMMMMMMMMMMMMMMM                                      
  2270.        .byte $00,$00,$C0          ;                  XX                  MM                                      
  2271.        .byte $F0,$FF,$CF          ;XXXXXXXXXXXXXXXX  XXMMMMMMMMMMMMMMMM  MM                                      
  2272.        .byte $00,$00,$0C          ;                  XX                  MM                                      
  2273.        .byte $F0,$0F,$FF          ;XXXX    XXXXXXXXXXXXMMMM    MMMMMMMMMMMM                                      
  2274.        .byte $00,$0F,$C0          ;        XXXX      XX        MMMM      MM                                      
  2275.  
  2276. ;Black Maze Entry                                                                                                  
  2277. BlackMazeEntry:
  2278.        .byte $30,$CF,$CC          ;XX  XX  XXXX  XX  XXMM  MM  MMMM  MM  MM  **Line Shared With Above Room ----^ (Reversed Not Mirrored)                                    
  2279.        .byte $00,$C0,$CC          ;        XX        XX  XXRR  RR        RR                                      
  2280.        .byte $F0,$FF,$0F          ;XXXXXXXXXXXXXXXX        RRRRRRRRRRRRRRRR                                      
  2281.        .byte $00,$00,$00          ;                                                                              
  2282.        .byte $F0,$FF,$0F          ;XXXXXXXXXXXXXXXX        RRRRRRRRRRRRRRRR                                      
  2283.        .byte $00,$00,$00          ;                                                                              
  2284.        .byte $F0,$FF,$0F          ;XXXXXXXXXXXXXXXX        RRRRRRRRRRRRRRRR                                      
  2285.                                                                                                                    
  2286. ;Objtect #0A : State  
  2287. BridgeCurr:                                                                                            
  2288.        .byte $00                                                                                                  
  2289.                                                                                                                    
  2290. ;Object #0A : List of States  
  2291. BridgeStates:                                                                                    
  2292.        .byte $FF,<GfxBridge,>GfxBridge          ;State FF at &FCDB                                                            
  2293.                                                                                                                    
  2294. ;Object #0A : State FF : Graphic                                                                                  
  2295. GfxBridge:
  2296.        .byte $C3                  ;XX    XX                                                                  
  2297.        .byte $C3                  ;XX    XX                                                                  
  2298.        .byte $C3                  ;XX    XX                                                                  
  2299.        .byte $C3                  ;XX    XX                                                                  
  2300.        .byte $42                  ; X    X                                                                  
  2301.        .byte $42                  ; X    X                                                                  
  2302.        .byte $42                  ; X    X                                                                  
  2303.        .byte $42                  ; X    X                                                                  
  2304.        .byte $42                  ; X    X                                                                  
  2305.        .byte $42                  ; X    X                                                                  
  2306.        .byte $42                  ; X    X                                                                  
  2307.        .byte $42                  ; X    X                                                                  
  2308.        .byte $42                  ; X    X                                                                  
  2309.        .byte $42                  ; X    X                                                                  
  2310.        .byte $42                  ; X    X                                                                  
  2311.        .byte $42                  ; X    X                                                                  
  2312.        .byte $42                  ; X    X                                                                  
  2313.        .byte $42                  ; X    X                                                                  
  2314.        .byte $42                  ; X    X                                                                  
  2315.        .byte $42                  ; X    X                                                                  
  2316.        .byte $C3                  ;XX    XX                                                                  
  2317.        .byte $C3                  ;XX    XX                                                                  
  2318.        .byte $C3                  ;XX    XX                                                                  
  2319.        .byte $C3                  ;XX    XX                                                                  
  2320.        .byte $00                                                                                                  
  2321.                                                                                                                    
  2322. ;Object #5 State #1 Graphic :'1'                                                                                  
  2323. GfxNum1:
  2324.        .byte $04                  ; X                                                                        
  2325.        .byte $0C                  ;XX                                                                        
  2326.        .byte $04                  ; X                                                                        
  2327.        .byte $04                  ; X                                                                        
  2328.        .byte $04                  ; X                                                                        
  2329.        .byte $04                  ; X                                                                        
  2330.        .byte $0E                  ;XXX                                                                      
  2331.        .byte $00                                                                                                  
  2332.                                                                                                                    
  2333. ;Object #0B : State                                                                                                
  2334. KeyCurr:
  2335.        .byte $00                                                                                                  
  2336.                                                                                                                    
  2337. ;Object #0B : List of States                                                                                      
  2338. KeyStates:
  2339.        .byte $FF,<GfxKey,>GfxKey                                                                                          
  2340.                                                                                                                    
  2341. ;Object #0B : State FF : Graphic                                                                                  
  2342. GfxKey:
  2343.        .byte $07                  ;     XXX                                                                  
  2344.        .byte $FD                  ;XXXXXX X                                                                  
  2345.        .byte $A7                  ;X X  XXX                                                                  
  2346.        .byte $00                                                                                                  
  2347.                                                                                                                    
  2348. ;Object #5 State #2 Grphic : '2'                                                                                  
  2349. GfxNum2:
  2350.        .byte $0E                  ; XXX                                                                      
  2351.        .byte $11                  ;X   X                                                                    
  2352.        .byte $01                  ;    X                                                                    
  2353.        .byte $02                  ;   X                                                                      
  2354.        .byte $04                  ;  X                                                                      
  2355.        .byte $08                  ; X                                                                        
  2356.        .byte $1F                  ;XXXXX                                                                    
  2357.        .byte $00                                                                                                  
  2358.                                                                                                                    
  2359. ;Object #5 State #3 Graphic :'3'                                                                                  
  2360. GfxNum3:
  2361.        .byte $0E                  ; XXX                                                                      
  2362.        .byte $11                  ;X   X                                                                    
  2363.        .byte $01                  ;    X                                                                    
  2364.        .byte $06                  ;  XX                                                                      
  2365.        .byte $01                  ;    X                                                                    
  2366.        .byte $11                  ;X   X                                                                    
  2367.        .byte $0E                  ; XXX                                                                      
  2368.        .byte $00                                                                                                  
  2369.                                                                                                                    
  2370.                                                                                                                    
  2371. ;Object #0E : List of States  
  2372. BatStates:                                                                                    
  2373.        .byte $03,<GfxBat1,>GfxBat1          ;State 03 at &FD1A                                                            
  2374. LFD17: .byte $FF,<GfxBat2,>GfxBat2          ;State FF as &FD22                                                            
  2375.                                                                                                                    
  2376. ;Object #0E : State 03 : Graphic                                                                                  
  2377. GfxBat1:
  2378.        .byte $81                  ;X      X                                                                  
  2379.        .byte $81                  ;X      X                                                                  
  2380.        .byte $C3                  ;XX    XX                                                                  
  2381.        .byte $C3                  ;XX    XX                                                                  
  2382.        .byte $FF                  ;XXXXXXXX                                                                  
  2383.        .byte $5A                  ; X XX X                                                                  
  2384.        .byte $66                  ; XX  XX                                                                  
  2385.        .byte $00                                                                                                  
  2386.                                                                                                                    
  2387. ;Object #0E : State FF : Graphic                                                                                  
  2388. GfxBat2:
  2389.        .byte $01                  ;       X                                                                  
  2390.        .byte $80                  ;X                                                                        
  2391.        .byte $01                  ;       X                                                                  
  2392.        .byte $80                  ;X                                                                        
  2393.        .byte $3C                  ;  XXXX                                                                    
  2394.        .byte $5A                  ; X XX X                                                                  
  2395.        .byte $66                  ; XX  XX                                                                  
  2396.        .byte $C3                  ;XX    XX                                                                  
  2397.        .byte $81                  ;X      X                                                                  
  2398.        .byte $81                  ;X      X                                                                  
  2399.        .byte $81                  ;X      X                                                                  
  2400.        .byte $00                                                                                                  
  2401.                                                                                                                    
  2402. ;Object #6 : States
  2403. DragonStates:                                                                                                
  2404.        .byte $00,<GfxDrag0,>GfxDrag0          ;State 00 at &FD3A                                                            
  2405. LFD31: .byte $01,<GfxDrag2,>GfxDrag2          ;State 01 at &FD66                                                            
  2406. LFD34: .byte $02,<GfxDrag0,>GfxDrag0          ;State 02 at &FD3A                                                            
  2407. LFD37: .byte $FF,<GfxDrag1,>GfxDrag1          ;State FF at &FD4F                                                            
  2408.                                                                                                                    
  2409. ;Object #6 : State #00 : Graphic                                                                                  
  2410. GfxDrag0:
  2411.        .byte $06                  ;     XX                                                                  
  2412.        .byte $0F                  ;    XXXX                                                                  
  2413.        .byte $F3                  ;XXXX  XX                                                                  
  2414.        .byte $FE                  ;XXXXXXX                                                                  
  2415.        .byte $0E                  ;    XXX                                                                  
  2416.        .byte $04                  ;     X                                                                    
  2417.        .byte $04                  ;     X                                                                    
  2418.        .byte $1E                  ;   XXXX                                                                  
  2419.        .byte $3F                  ;  XXXXXX                                                                  
  2420.        .byte $7F                  ; XXXXXXX                                                                  
  2421.        .byte $E3                  ;XXX   XX                                                                  
  2422.        .byte $C3                  ;XX    XX                                                                  
  2423.        .byte $C3                  ;XX    XX                                                                  
  2424.        .byte $C7                  ;XX   XXX                                                                  
  2425.        .byte $FF                  ;XXXXXXXX                                                                  
  2426.        .byte $3C                  ;  XXXX                                                                    
  2427.        .byte $08                  ;    X                                                                    
  2428.        .byte $8F                  ;X   XXXX                                                                  
  2429.        .byte $E1                  ;XXX    X                                                                  
  2430.        .byte $3F                  ;  XXXXXX                                                                  
  2431.        .byte $00                                                                                                  
  2432.                                                                                                                    
  2433. ;Object 6 : State FF : Graphic                                                                                    
  2434. GfxDrag1:
  2435.        .byte $80                  ;X                                                                        
  2436.        .byte $40                  ; X                                                                        
  2437.        .byte $26                  ;  X  XX                                                                  
  2438.        .byte $1F                  ;   XXXXX                                                                  
  2439.        .byte $0B                  ;    X XX                                                                  
  2440.        .byte $0E                  ;    XXX                                                                  
  2441.        .byte $1E                  ;   XXXX                                                                  
  2442.        .byte $24                  ;  X  X                                                                    
  2443.        .byte $44                  ; X   X                                                                    
  2444.        .byte $8E                  ;X   XXX                                                                  
  2445.        .byte $1E                  ;   XXXX                                                                  
  2446.        .byte $3F                  ;  XXXXXX                                                                  
  2447.        .byte $7F                  ; XXXXXXX                                                                  
  2448.        .byte $7F                  ; XXXXXXX                                                                  
  2449.        .byte $7F                  ; XXXXXXX                                                                  
  2450.        .byte $7F                  ; XXXXXXX                                                                  
  2451.        .byte $3E                  ;  XXXXX                                                                  
  2452.        .byte $1C                  ;   XXX                                                                    
  2453.        .byte $08                  ;    X                                                                    
  2454.        .byte $F8                  ;XXXXX                                                                    
  2455.        .byte $80                  ;X                                                                        
  2456.        .byte $E0                  ;XXX                                                                      
  2457.        .byte $00                                                                                                  
  2458.                                                                                                                    
  2459. ;Object 6 : State 02 : Graphic                                                                                    
  2460. GfxDrag2:
  2461.        .byte $0C                  ;    XX                                                                    
  2462.        .byte $0C                  ;    XX                                                                    
  2463.        .byte $0C                  ;    XX                                                                    
  2464.        .byte $0E                  ;    XXX                                                                  
  2465.        .byte $1B                  ;   XX X                                                                  
  2466.        .byte $7F                  ; XXXXXXX                                                                  
  2467.        .byte $CE                  ;XX  XXX                                                                  
  2468.        .byte $80                  ;X                                                                        
  2469.        .byte $FC                  ;XXXXXX                                                                    
  2470.        .byte $FE                  ;XXXXXXX                                                                  
  2471.        .byte $FE                  ;XXXXXXX                                                                  
  2472.        .byte $7E                  ; XXXXXX                                                                  
  2473.        .byte $78                  ; XXXX                                                                    
  2474.        .byte $20                  ;  X                                                                      
  2475.        .byte $6E                  ; XX XXX                                                                  
  2476.        .byte $42                  ; X    X                                                                  
  2477.        .byte $7E                  ; XXXXXX                                                                  
  2478.        .byte $00                                                                                                  
  2479.                                                                                                                    
  2480. ;Object #9 : Current State  
  2481. SwordCurr:                                                                                              
  2482.        .byte $00                                                                                                  
  2483.                                                                                                                    
  2484. ;Object #9 : List of States                                                                                        
  2485. SwordStates:
  2486.        .byte $FF,<GfxSword,>GfxSword          ;State FF at &FD7C                                                            
  2487.                                                                                                                    
  2488. ;Object #9 : State FF : Graphics                                                                                  
  2489. GfxSword:
  2490.        .byte $20                  ;  X                                                                      
  2491.        .byte $40                  ; X                                                                        
  2492.        .byte $FF                  ;XXXXXXXX    
  2493.        .byte $40                  ; X                                                                        
  2494.        .byte $20                  ;  X                                                                      
  2495.        .byte $00                                                                                                  
  2496.                                                                                                                    
  2497. ;Object #0F : State  
  2498. DotCurr:                                                                                              
  2499.        .byte $00                                                                                                  
  2500.                                                                                                                    
  2501. ;Object #0F : List of States                                                                                      
  2502. DotStates:
  2503.        .byte $FF,<GfxDot,>GfxDot          ;State FF at FD86                                                              
  2504.                                                                                                                    
  2505. ;Object #0F : State FF : Graphic                                                                                  
  2506. GfxDot:
  2507.        .byte $80                  ;X                                                                        
  2508.        .byte $00                                                                                                  
  2509.                                                                                                                    
  2510. ;Object #4 : State FF : Graphic                                                                                    
  2511. GfxAuthor:
  2512.        .byte $F0                  ;XXXX                                                                      
  2513.        .byte $80                  ;X                                                                        
  2514.        .byte $80                  ;X                                                                        
  2515.        .byte $80                  ;X                                                                        
  2516.        .byte $F4                  ;XXXX X                                                                    
  2517.        .byte $04                  ;     X                                                                    
  2518.        .byte $87                  ;X    XXX                                                                  
  2519.        .byte $E5                  ;XXX  X X                                                                  
  2520.        .byte $87                  ;X    XXX                                                                  
  2521.        .byte $80                  ;X                                                                        
  2522.        .byte $05                  ;     X X                                                                  
  2523.        .byte $E5                  ;XXX  X X                                                                
  2524.        .byte $A7                  ;X X  XXX                                                                  
  2525.        .byte $E1                  ;XXX    X                                                                  
  2526.        .byte $87                  ;X    XXX                                                                  
  2527.        .byte $E0                  ;XXX                                                                      
  2528.        .byte $01                  ;       X                                                                  
  2529.        .byte $E0                  ;XXX                                                                      
  2530.        .byte $A0                  ;X X                                                                      
  2531.        .byte $F0                  ;XXXX                                                                      
  2532.        .byte $01                  ;       X                                                                  
  2533.        .byte $40                  ; X                                                                        
  2534.        .byte $E0                  ;XXX                                                                      
  2535.        .byte $40                  ; X                                                                      
  2536.        .byte $40                  ; X                                                                        
  2537.        .byte $40                  ; X                                                                        
  2538.        .byte $01                  ;       X                                                                  
  2539.        .byte $E0                  ;XXX                                                                      
  2540.        .byte $A0                  ;X X                                                                      
  2541.        .byte $E0                  ;XXX                                                                      
  2542.        .byte $80                  ;X                                                                        
  2543.        .byte $E0                  ;XXX                                                                      
  2544.        .byte $01                  ;       X                                                                  
  2545.        .byte $20                  ;  X                                                                      
  2546.        .byte $20                  ;  X                                                                      
  2547.        .byte $E0                  ;XXX                                                                      
  2548.        .byte $A0                  ;X X                                                                      
  2549.        .byte $E0                  ;XXX                                                                      
  2550.        .byte $01                  ;       X                                                                  
  2551.        .byte $01                  ;       X                                                                  
  2552.        .byte $01                  ;       X                                                                  
  2553.        .byte $88                  ;   X   X                                                                  
  2554.        .byte $A8                  ;X X X                                                                    
  2555.        .byte $A8                  ;X X X                                                                    
  2556.        .byte $A8                  ;X X X                                                                    
  2557.        .byte $F8                  ;XXXXX                                                                    
  2558.        .byte $01                  ;       X                                                                  
  2559.        .byte $E0                  ;XXX                                                                      
  2560.        .byte $A0                  ;X X                                                                      
  2561.        .byte $F0                  ;XXXX                                                                      
  2562.        .byte $01                  ;       X                                                                  
  2563.        .byte $80                  ;X                                                                        
  2564.        .byte $E0                  ;XXX                                                                      
  2565.        .byte $8F                  ;X   XXXX                                                                
  2566.        .byte $89                  ;X   X  X                                                                  
  2567.        .byte $0F                  ;    XXXX                                                                  
  2568.        .byte $8A                  ;X   X X                                                                  
  2569.        .byte $E9                  ;XXX X  X                                                                  
  2570.        .byte $80                  ;X                                                                        
  2571.        .byte $8E                  ;X   XXX                                                                  
  2572.        .byte $0A                  ;    X X                                                                  
  2573.        .byte $EE                  ;XXX XXX                                                                  
  2574.        .byte $A0                  ;X X                                                                      
  2575.        .byte $E8                  ;XXX X                                                                    
  2576.        .byte $88                  ;X   X                                                                    
  2577.        .byte $EE                  ;XXX XXX                                                                  
  2578.        .byte $0A                  ;    X X                                                                  
  2579.        .byte $8E                  ;X   XXX                                                                  
  2580.        .byte $E0                  ;XXX                                                                      
  2581.        .byte $A4                  ;X X  X                                                                    
  2582.        .byte $A4                  ;X X  X                                                                    
  2583.        .byte $04                  ;     X                                                                    
  2584.        .byte $80                  ;X                                                                        
  2585.        .byte $08                  ;    X                                                                    
  2586.        .byte $0E                  ;    XXX                                                                  
  2587.        .byte $0A                  ;    X X                                                                  
  2588.        .byte $0A                  ;    X X                                                                  
  2589.        .byte $80                  ;X                                                                        
  2590.        .byte $0E                  ;    XXX                                                                  
  2591.        .byte $0A                  ;    X X                                                                  
  2592.        .byte $0E                  ;    XXX                                                                  
  2593.        .byte $08                  ;    X                                                                    
  2594.        .byte $0E                  ;    XXX                                                                  
  2595.        .byte $80                  ;X                                                                        
  2596.        .byte $04                  ;     X                                                                    
  2597.        .byte $0E                  ;    XXX                                                                  
  2598.        .byte $04                  ;     X                                                                    
  2599.        .byte $04                  ;     X                                                                    
  2600.        .byte $04                  ;     X                                                                    
  2601.        .byte $80                  ;X                                                                        
  2602.        .byte $04                  ;     X                                                                    
  2603.        .byte $0E                  ;    XXX                                                                  
  2604.        .byte $04                  ;     X                                                                    
  2605.        .byte $04                  ;     X                                                                    
  2606.        .byte $04                  ;     X                                                                    
  2607.        .byte $00                                                                                                  
  2608.                                                                                                                    
  2609. ;Object $4 : Author's Name  
  2610. AuthorInfo:                                                                                      
  2611.        .byte $1E,$50,$69          ;Room 1E, (50, 69)                                                            
  2612.                                                                                                                    
  2613. ;Object #4 : Current State  
  2614. AuthorCurr:                                                                                      
  2615.        .byte $00                                                                                                  
  2616.                                                                                                                    
  2617. ;Object #4 : States                                                                                                
  2618. AuthorStates:
  2619.        .byte $FF,<GfxAuthor,>GfxAuthor          ;State FF at &FD88                                                            
  2620.                                                                                                                    
  2621. ;Object #10 : State                                                                                                
  2622. ChalliseCurr:
  2623.        .byte $00                                                                                                  
  2624.                                                                                                                    
  2625. ;Object #10 : List of States                                                                                      
  2626. ChalliseStates:
  2627.        .byte $FF,<GfxChallise,>GfxChallise          ;State FF at &FDF3                                                            
  2628.                                                                                                                    
  2629. ;Object #10 : State FF : Graphic                                                                                  
  2630. GfxChallise:
  2631.        .byte $81                  ;X      X                                                                  
  2632.        .byte $81                  ;X      X                                                                  
  2633.        .byte $C3                  ;XX    XX                                                                  
  2634.        .byte $7E                  ; XXXXXX                                                                  
  2635.        .byte $7E                  ; XXXXXX                                                                  
  2636.        .byte $3C                  ;  XXXX                                                                    
  2637.        .byte $18                  ;   XX                                                                    
  2638.        .byte $18                  ;   XX                                                                    
  2639.        .byte $7E                  ; XXXXXX                                                                  
  2640.        .byte $00                                                                                                  
  2641.                                                                                                                    
  2642. ;Object #12 : State                                                                                                
  2643. NullCurr:
  2644.        .byte $00                                                                                                  
  2645.                                                                                                                    
  2646. ;Object #12 : List of States                                                                                      
  2647. NullStates:
  2648.        .byte $FF,<GfxNull,>GfxNull                                                                                          
  2649.                                                                                                                    
  2650. ;Object #12 " State FF : Graphic                                                                                  
  2651. GfxNull:
  2652.        .byte $00                                                                                                  
  2653.                                                                                                                    
  2654. ;Object #5 Number.    
  2655. NumberInfo:                                                                                            
  2656.        .byte $00,$50,$40          ;#5 Number: Room 00, (50,40)                                                  
  2657.                                                                                                                    
  2658. ;Object #5 States.                                                                                                
  2659. NumberStates:
  2660.        .byte $01,<GfxNum1,>GfxNum1          ;State 1 as FCF4                                                              
  2661. LFE08: .byte $03,<GfxNum2,>GfxNum2          ;State 3 as FD04                                                              
  2662. LFE0B: .byte $FF,<GfxNum3,>GfxNum3          ;State FF as FD0C                                                              
  2663.                                                                                                                    
  2664. ;Object #11 : State                                                                                                
  2665. MagnetCurr:
  2666.        .byte $00                                                                                                  
  2667.                                                                                                                    
  2668. ;Object #11 : List of States                                                                                      
  2669. MagnetStates:
  2670.        .byte $FF,<GfxMagnet,>GfxMagnet          ;State FF at FE12                                                              
  2671.                                                                                                                    
  2672. ;Object #11 : State FF : Graphic                                                                                  
  2673. GfxMagnet:
  2674.        .byte $3C                  ;  XXXX                                                                    
  2675.        .byte $7E                  ; XXXXXX                                                                  
  2676.        .byte $E7                  ;XXX  XXX                                                                  
  2677.        .byte $C3                  ;XX    XX                                                                  
  2678.        .byte $C3                  ;XX    XX                                                                  
  2679.        .byte $C3                  ;XX    XX                                                                  
  2680.        .byte $C3                  ;XX    XX                                                                  
  2681.        .byte $C3                  ;XX    XX                                                                  
  2682.        .byte $00                                                                                                  
  2683.                                                                                                                    
  2684.                                                                                                                    
  2685. ;Room Data                                                                                                        
  2686. ;Offset 0 : Low byte foom graphics data.                                                                          
  2687. ;Offset 1 : High byte room graphics data                                                                          
  2688. ;Offset 2 : Color                                                                                                  
  2689. ;Offset 3 : B&W Color                                                                                              
  2690. ;Offset 4 : Bits 5-0 : Playfield Control                                                                          
  2691. ;            Bit 6 : True if right thin wall wanted.                                                              
  2692. ;            Bit 7 : True if left thin wall wanted.                                                                
  2693. ;Offset 5 : Room Above                                                                                            
  2694. ;Offset 6 : Room Left                                                                                              
  2695. ;Offset 7 : Room Down                                                                                              
  2696. ;Offset 8 : Room Right                                                                                            
  2697.  
  2698. RoomDataTable:                                                                                                                  
  2699. LFE1B:  .byte <NumberRoom,>NumberRoom,                $66,$0A,$21,$00,$00,$00,$00      ;00; 'Number Room.                          Purple          
  2700. LFE24:  .byte <BelowYellowCastle,>BelowYellowCastle,  $D8,$0A,$A1,$08,$02,$80,$03      ;01; (Top Acess) Reflected/8 Clock Ball                      
  2701. LFE2D:  .byte <BelowYellowCastle,>BelowYellowCastle,  $C8,$0A,$21,$11,$03,$83,$01      ;02; (Top Access)                         Green              
  2702. LFE36:  .byte <LeftOfName,>LeftOfName,                $E8,$0A,$61,$06,$01,$86,$02      ;03; Left of Name                                            
  2703. LFE3F:  .byte <BlueMazeTop,>BlueMazeTop,              $86,$0A,$21,$10,$05,$07,$06      ;04; Top of Blue Maze                         Blue          
  2704. LFE48:  .byte <BlueMaze1,>BlueMaze1,                  $86,$0A,$21,$1D,$06,$08,$04      ;05; Blue Maze #1                                Blue        
  2705. LFE51:  .byte <BlueMazeBottom,>BlueMazeBottom,        $86,$0A,$21,$07,$04,$03,$05      ;06; Bottom of Blue Maze                  Blue              
  2706. LFE5A:  .byte <BlueMazeCenter,>BlueMazeCenter,        $86,$0A,$21,$04,$08,$06,$08      ;07; Center of Blue Maze                  Blue              
  2707. LFE63:  .byte <BlueMazeEntry,>BlueMazeEntry,          $86,$0A,$21,$05,$07,$01,$07      ;08; Blue Maze Entry                        Blue            
  2708. LFE6C:  .byte <MazeMiddle,>MazeMiddle,                $08,$08,$25,$0A,$0A,$0B,$0A      ;09; Maze Middle                               Invisible    
  2709. LFE75:  .byte <MazeEntry,>MazeEntry,                  $08,$08,$25,$03,$09,$09,$09      ;0A; Maze Entry                              Invisible      
  2710. LFE7E:  .byte <MazeSide,>MazeSide,                    $08,$08,$25,$09,$0C,$1C,$0D      ;0B; Maze Side                              Invisible      Re
  2711. LFE87:  .byte <SideCorridor,>SideCorridor,            $98,$0A,$61,$1C,$0D,$1D,$0B      ;0C; (Side Corridor)                                        
  2712. LFE90:  .byte <SideCorridor,>SideCorridor,            $B8,$0A,$A1,$0F,$0B,$0E,$0C      ;0D; (Side Corridor)                                        
  2713. LFE99:  .byte <TopEntryRoom,>TopEntryRoom,            $A8,$0A,$21,$0D,$10,$0F,$10      ;0E; (Top Entry Room)                                        
  2714. LFEA2:  .byte <CastleDef,>CastleDef,                  $0C,$0C,$21,$0E,$0F,$0D,$0F      ;0F; White Castle                              White        
  2715. LFEAB:  .byte <CastleDef,>CastleDef,                  $00,$02,$21,$01,$1C,$04,$1C      ;10; Black Castle                              Black        
  2716. LFEB4:  .byte <CastleDef,>CastleDef,                  $1A,$0A,$21,$06,$03,$02,$01      ;11; Yellow Castle                        Yellow            
  2717. LFEBD:  .byte <NumberRoom,>NumberRoom,                $1A,$0A,$21,$12,$12,$12,$12      ;12; Yellow Castle Entry                   Yellow            
  2718. LFEC6:  .byte <BlackMaze1,>BlackMaze1,                $08,$08,$25,$15,$14,$15,$16      ;13; Black Maze #1                          Invisible      Re
  2719. LFECF:  .byte <BlackMaze2,>BlackMaze2,                $08,$08,$24,$16,$15,$16,$13      ;14; Black Maze #2                        Invisible      Dupl
  2720. LFED8:  .byte <BlackMaze3,>BlackMaze3,                $08,$08,$24,$13,$16,$13,$14      ;15; Black Maze #3                        Invisible      Dupl
  2721. LFEE1:  .byte <BlackMazeEntry,>BlackMazeEntry,        $08,$08,$25,$14,$13,$1B,$15      ;16; Black Maze Entry                        Invisible      R
  2722. LFEEA:  .byte <RedMaze1,>RedMaze1,                    $36,$0A,$21,$19,$18,$19,$18      ;17; Red Maze #1                              Red            
  2723. LFEF3:  .byte <RedMazeTop,>RedMazeTop,                $36,$0A,$21,$1A,$17,$1A,$17      ;18; Top of Red Maze                        Red              
  2724. LFEFC:  .byte <RedMazeBottom,>RedMazeBottom,          $36,$0A,$21,$17,$1A,$17,$1A      ;19; Bottom of Red Maze                        Red          
  2725. LFF05:  .byte <WhiteCastleEntry,>WhiteCastleEntry,    $36,$0A,$21,$18,$19,$18,$19      ;1A; White Castle Entry                        Red          
  2726. LFF0E:  .byte <TwoExitRoom,>TwoExitRoom,              $36,$0A,$21,$89,$89,$89,$89      ;1B; Black Castle Entry                        Red          
  2727. LFF17:  .byte <NumberRoom,>NumberRoom,                $66,$0A,$21,$1D,$07,$8C,$08      ;1C; Other Purple Room                         Purple        
  2728. LFF20:  .byte <TopEntryRoom,>TopEntryRoom,            $36,$0A,$21,$8F,$01,$10,$03      ;1D; (Top Entry Room)                        Red            
  2729. LFF29:  .byte <BelowYellowCastle,>BelowYellowCastle,  $66,$0A,$21,$06,$01,$06,$03      ;1E; Name Room                              Purple          
  2730.                                                                                                                    
  2731.                                                                                                                    
  2732. ;Room differences for different levels (level 1,2,3)  
  2733. RoomDiffs:                                                            
  2734. LFF32: .byte $10,$0F,$0F            ;Down from Room 01                                                            
  2735. LFF35: .byte $05,$11,$11            ;Down from Room 02                                                            
  2736. LFF38: .byte $1D,$0A,$0A            ;Down from Room 03                                                            
  2737. LFF3B: .byte $1C,$16,$16            ;U/L/R/D from Room 1B (Black Castle Room)                                      
  2738. LFF3E: .byte $1B,$0C,$0C            ;Down from Room 1C                                                            
  2739. LFF41: .byte $03,$0C,$0C            ;Up from Room 1D (Top Entry Room)                                              
  2740.                                                                                                                    
  2741. ;Objects                                                                                                          
  2742. ;Offset 0 : Low byte object information (moveable stuff)                                                          
  2743. ;Offset 1 : High byte object information (moveable stuff)                                                          
  2744. ;Offset 2 : Low byte to object's current state                                                                    
  2745. ;Offset 3 : High byte to object's current state                                                                    
  2746. ;Offset 4 : Low byte list of states                                                                                
  2747. ;Offset 5 : High byte list of states                                                                              
  2748. ;Offset 6 : Colour                                                                                                
  2749. ;Offset 7 : Colour in B&W.                                                                                        
  2750. ;Offset 8 : Size of object                                                                                        
  2751.  
  2752. Store1:                                                                                                                  
  2753.        .byte $D9                        ;0      ;#0 Invisible Surround Offsets..      00                          
  2754. Store2:
  2755.        .byte $00                        ;1                                                                        
  2756. Store3:
  2757.        .byte <SurroundCurr              ;2                                                                        
  2758. Store4:
  2759.        .byte >SurroundCurr              ;3                                                                        
  2760. Store5:
  2761.        .byte <SurroundStates            ;4                                                                        
  2762. Store6:
  2763.        .byte >SurroundStates            ;5                                                                        
  2764. Store7:
  2765.        .byte $28                        ;6                                                                        
  2766. Store8:
  2767.        .byte $0C                        ;7                                                                        
  2768. Store9:
  2769.        .byte $07                        ;8                                                                        
  2770.                                                                                                                    
  2771. LFF4D:       .byte <PortInfo1,>PortInfo1,    $C8,$00,                      <PortStates,>PortStates,          $00,$00,$00      ;#1 Portcullis #1       Black            09                  
  2772. LFF56:       .byte <PortInfo2,>PortInfo2,    $C9,$00,                      <PortStates,>PortStates,          $00,$00,$00      ;#2 Portcullis #2       Black            12            
  2773. LFF5F:       .byte <PortInfo3,>PortInfo3,    $CA,$00,                      <PortStates,>PortStates,          $00,$00,$00      ;#3 Portcullis #3       Black            1B            
  2774. LFF68:       .byte <AuthorInfo,>AuthorInfo,  <AuthorCurr,>AuthorCurr,      <AuthorStates,>AuthorStates,      $CB,$00,$00      ;#4 Name                Flash            24                
  2775. LFF71:       .byte <NumberInfo,>NumberInfo,  $DD,$00,                      <NumberStates,>NumberStates,      $C8,$00,$00      ;#5 Number              Green            2D              
  2776. LFF7A:       .byte $A4,$00,                  $A8,$00,                      <DragonStates,>DragonStates,      $36,$0E,$00      ;#6 Dragon #1           Red              36                  
  2777. LFF83:       .byte $A9,$00,                  $AD,$00,                      <DragonStates,>DragonStates,      $1A,$06,$00      ;#7 Dragon #2           Yellow           3F                      
  2778. LFF8C:       .byte $AE,$00,                  $B2,$00,                      <DragonStates,>DragonStates,      $C8,$00,$00      ;#8 Dragon #3           Green            48                
  2779. LFF95:       .byte $B6,$00,                  <SwordCurr,>SwordCurr,        <SwordStates,>SwordStates,        $1A,$06,$00      ;#9 Sword               Yellow           51                    
  2780. LFF9E:       .byte $BC,$00,                  <BridgeCurr,>BridgeCurr,      <BridgeStates,>BridgeStates,      $66,$02,$07      ;#0A Bridge             Purple           5A                  
  2781. LFFA7:       .byte $BF,$00,                  <KeyCurr,>KeyCurr,            <KeyStates,>KeyStates,            $1A,$06,$00      ;#0B Key #01            Yellow           63                      
  2782. LFFB0:       .byte $C2,$00,                  <KeyCurr,>KeyCurr,            <KeyStates,>KeyStates,            $0E,$0E,$00      ;#0C Key #02            White            6C                  
  2783. LFFB9:       .byte $C5,$00,                  <KeyCurr,>KeyCurr,            <KeyStates,>KeyStates,            $00,$00,$00      ;#0D Key #03            Black            75                  
  2784. LFFC2:       .byte $CB,$00,                  $CF,$00,                      <BatStates,>BatStates,            $00,$00,$00      ;#0E Bat                Black            7E                
  2785. LFFCB:       .byte $A1,$00,                  <DotCurr,>DotCurr,            <DotStates,>DotStates,            $08,$08,$00      ;#0F Black Dot          Light Gray       87                
  2786. LFFD4:       .byte $B9,$00,                  <ChalliseCurr,>ChalliseCurr,  <ChalliseStates,>ChalliseStates,  $CB,$06,$00      ;#10 Challise           Flash            90                
  2787. LFFDD:       .byte $B3,$00,                  <MagnetCurr,>MagnetCurr,      <MagnetStates,>MagnetStates,      $00,$06,$00      ;#11 Magnet             Black            99            
  2788. LFFE6:       .byte $BC,$00,                  <NullCurr,>NullCurr,          <NullStates,>NullStates,          $00,$00,$00      ;#12 Null               Black            A2              
  2789.                                                                                                                    
  2790. ;Not Used                                                                                                          
  2791. LFFEF: .byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00                                                    
  2792.                                                                                                                    
  2793. ;6502 Vectors (Not Used??                                                                                          
  2794. LFFFA:  .byte $00,$F0                                                                                              
  2795. LFFFC:  .byte $00,$F0                                                                                              
  2796. LFFFE:  .byte $00,$F0
Add Comment
Please, Sign In to add comment