8

a CHIP-8 emulator
Log | Files | Refs | README

BLINKY.SRC (60550B)


      1 ;  (S)Chip-48 Blinky V2.00 by Christian Egeberg 7/11-'90 .. 18/8-'91
      2 ;  EMail at egeberg@solan.unit.no
      3 ;
      4 ;  Register usage:
      5 ;  V0:  Temporary data, may change during any call
      6 ;  V1:  Temporary data, may change during any call
      7 ;  V2:  Temporary data, may change during most calls
      8 ;  V3:  Temporary data, may change during most calls
      9 ;  V4:  Temporary data, may change during some calls
     10 ;  V5:  Temporary data, may change during some calls
     11 ;  V6:  Pill and score counter
     12 ;  V7:  Life and sprite direction register
     13 ;  V8:  Blinky X screen coordinate
     14 ;  V9:  Blinky Y screen coordinate
     15 ;  VA:  Packlett X screen coordinate
     16 ;  VB:  Packlett Y screen coordinate
     17 ;  VC:  Heward X screen coordinate
     18 ;  VD:  Heward Y screen coordinate
     19 ;  VE:  Temporary constant and flag storage
     20 ;  VF:  Flag register
     21 
     22 ;  DEFINE/UNDEF SUPER in line below to toggle between versions
     23 
     24                  OPTION BINARY ; Let's compile this for non-HP computers...
     25 ;                OPTION HPASC
     26 
     27                 IFDEF   SUPER
     28                   OPTION  SCHIP10
     29                 ELSE
     30                   OPTION  CHIP48
     31                 ENDIF
     32 
     33 MASKNIBB        =       $1111
     34 MASKBYTE        =       $11111111
     35 
     36 DOWNKEY         =       #6
     37 RIGHTKEY        =       #8
     38 LEFTKEY         =       #7
     39 UPKEY           =       #3
     40 PRESSKEY        =       #F
     41 LEVELKEY        =       #1
     42 
     43 PILLNUM         =       231
     44 SUPERNUM        =       4
     45 
     46 PILLTIME        =       5
     47 SUPERTIME       =       255
     48 CLSWAIT         =       63
     49 EYEWAIT         =       3
     50 
     51 PILLADD         =       1
     52 SUPERADD        =       4
     53 HEWARDADD       =       25
     54 PACKLETTADD     =       50
     55 SCREENADD       =       100
     56 
     57 MASKLIFE        =       $01000000
     58 MASKHUNT        =       $10000000
     59 MASKCODE        =       $11
     60 DOWNCODE        =       $11
     61 RIGHTCODE       =       $10
     62 LEFTCODE        =       $01
     63 UPCODE          =       $00
     64                          
     65 BLINKYCODE      =       DOWNCODE
     66 PACKLETTCODE    =       LEFTCODE
     67 HEWARDCODE      =       RIGHTCODE
     68 STARTCODE       =       HEWARDCODE < 4 | PACKLETTCODE < 2 | BLINKYCODE
     69 
     70 STARTLEVEL      =       $101
     71 
     72                 IFDEF     SUPER
     73 
     74   SCREENHIGH      =       64
     75   SCREENWIDE      =       128
     76   SPRITEHIGH      =       8
     77   SPRITEWIDE      =       16
     78   SPRITEJUMP      =       4
     79 
     80   BLINKYX         =       52
     81   BLINKYY         =       24
     82   PACKLETTX       =       112
     83   PACKLETTY       =       0
     84   HEWARDX         =       4
     85   HEWARDY         =       52
     86 
     87   GATELEFT        =       0
     88   GATERIGHT       =       116
     89                          
     90   SCXPOS          =       36
     91   SCYPOS          =       32
     92   HIXPOS          =       36
     93   HIYPOS          =       20
     94   EYEX1           =       0
     95   EYEX2           =       96
     96   EYEY1           =       1
     97   EYEY2           =       45
     98 
     99                 ELSE
    100 
    101   SCREENHIGH      =       32
    102   SCREENWIDE      =       64
    103   SPRITEHIGH      =       4
    104   SPRITEWIDE      =       8
    105   SPRITEJUMP      =       2
    106 
    107   BLINKYX         =       26
    108   BLINKYY         =       12
    109   PACKLETTX       =       56
    110   PACKLETTY       =       0
    111   HEWARDX         =       2
    112   HEWARDY         =       26
    113 
    114   GATELEFT        =       0
    115   GATERIGHT       =       58
    116                          
    117   SCXPOS          =       17
    118   SCYPOS          =       16
    119   HIXPOS          =       17
    120   HIYPOS          =       10
    121   EYEX1           =       0
    122   EYEX2           =       48
    123   EYEY1           =       0
    124   EYEY2           =       22
    125 
    126                 ENDIF         
    127 
    128                 JP      START
    129 
    130 COPYRIGHT:      DA      '2.00 C. Egeberg 18/8-''91'
    131                 USED    COPYRIGHT
    132 
    133 START:          IFDEF   SUPER
    134                   HIGH
    135                 ENDIF
    136                 XOR     V0, V0
    137                 XOR     V1, V1
    138                 LD      I, SCORE
    139                 LD      [I], V1
    140                 LD      V0, STARTLEVEL
    141                 LD      I, LEVEL
    142                 LD      [I], V0
    143                 XOR     V7, V7
    144 REINIT:         XOR     V6, V6
    145                 CALL    COPYMAZE
    146                 CLS      
    147                 CALL    DRAWMAZE
    148 RESTART:        LD      VE, MASKLIFE
    149                 AND     V7, VE
    150                 LD      VE, STARTCODE
    151                 OR      V7, VE
    152                 LD      V8, BLINKYX
    153                 LD      V9, BLINKYY
    154                 LD      VA, PACKLETTX
    155                 LD      VB, PACKLETTY
    156                 LD      VC, HEWARDX
    157                 LD      VD, HEWARDY
    158                 CALL    DRAWBLINKY
    159                 LD      I, GHOST
    160                 DRW     VA, VB, SPRITEHIGH
    161                 DRW     VC, VD, SPRITEHIGH
    162 GAMELOOP:       CALL    MOVEBLINKY
    163                 SE      VE, 0
    164                 JP      ENCOUNTER
    165 SPLITUP:        LD      I, LEVEL
    166                 LD      V0, [I]
    167                 LD      V5, V0
    168                 RND     V4, MASKBYTE
    169                 AND     V4, V5
    170                 CALL    MOVEPACKLETT
    171                 RND     V4, MASKBYTE
    172                 AND     V4, V5
    173                 CALL    MOVEHEWARD
    174                 LD      V0, LEVELKEY
    175                 SKNP    V0
    176                 CALL    NEXTLEVEL
    177                 SE      V6, PILLADD * PILLNUM + SUPERADD * SUPERNUM
    178                 JP      GAMELOOP
    179                 LD      VE, V6
    180                 CALL    ADDSCORE
    181                 LD      VE, SCREENADD
    182                 CALL    ADDSCORE
    183                 CALL    NEXTLEVEL
    184                 JP      REINIT
    185 ENCOUNTER:      LD      V0, DT
    186                 SNE     V0, 0
    187                 JP      GOTCHA
    188                 LD      V0, V8
    189                 SHR     V0
    190                 IFDEF   SUPER
    191                   SHR     V0
    192                 ENDIF
    193                 LD      V1, VA
    194                 SHR     V1
    195                 IFDEF   SUPER
    196                   SHR     V1
    197                 ENDIF
    198                 SUB     V0, V1
    199                 SNE     V0, 0
    200                 JP      HITPACKLETT1
    201                 SNE     V0, 1
    202                 JP      HITPACKLETT1
    203                 SNE     V0, -1 & MASKBYTE
    204                 JP      HITPACKLETT1
    205                 JP      OOPSHEWARD
    206 HITPACKLETT1:   LD      V0, V9
    207                 SHR     V0
    208                 IFDEF   SUPER
    209                   SHR     V0
    210                 ENDIF
    211                 LD      V1, VB
    212                 SHR     V1
    213                 IFDEF   SUPER
    214                   SHR     V1
    215                 ENDIF
    216                 SUB     V0, V1
    217                 SNE     V0, 0
    218                 JP      HITPACKLETT2
    219                 SNE     V0, 1
    220                 JP      HITPACKLETT2
    221                 SNE     V0, -1 & MASKBYTE
    222                 JP      HITPACKLETT2
    223                 JP      OOPSHEWARD
    224 HITPACKLETT2:   LD      I, GHOST
    225                 DRW     VA, VB, SPRITEHIGH
    226                 LD      VA, PACKLETTX
    227                 LD      VB, PACKLETTY
    228                 DRW     VA, VB, SPRITEHIGH
    229                 LD      VE, ~( MASKCODE < 2 ) & MASKBYTE
    230                 AND     V7, VE
    231                 LD      VE, PACKLETTCODE < 2
    232                 OR      V7, VE
    233                 LD      VE, PACKLETTADD
    234                 CALL    ADDSCORE
    235 OOPSHEWARD:     LD      V0, V8
    236                 SHR     V0
    237                 IFDEF   SUPER
    238                   SHR     V0
    239                 ENDIF
    240                 LD      V1, VC
    241                 SHR     V1
    242                 IFDEF   SUPER
    243                   SHR     V1
    244                 ENDIF
    245                 SUB     V0, V1
    246                 SNE     V0, 0
    247                 JP      HITHEWARD1
    248                 SNE     V0, 1
    249                 JP      HITHEWARD1
    250                 SNE     V0, -1 & MASKBYTE
    251                 JP      HITHEWARD1
    252                 JP      SPLITUP
    253 HITHEWARD1:     LD      V0, V9
    254                 SHR     V0
    255                 IFDEF   SUPER
    256                   SHR     V0
    257                 ENDIF
    258                 LD      V1, VD
    259                 SHR     V1
    260                 IFDEF   SUPER
    261                   SHR     V1
    262                 ENDIF
    263                 SUB     V0, V1
    264                 SNE     V0, 0
    265                 JP      HITHEWARD2
    266                 SNE     V0, 1
    267                 JP      HITHEWARD2
    268                 SNE     V0, -1 & MASKBYTE
    269                 JP      HITHEWARD2
    270                 JP      SPLITUP
    271 HITHEWARD2:     LD      I, GHOST
    272                 DRW     VC, VD, SPRITEHIGH
    273                 LD      VC, HEWARDX
    274                 LD      VD, HEWARDY
    275                 DRW     VC, VD, SPRITEHIGH
    276                 LD      VE, ~( MASKCODE < 4 ) & MASKBYTE
    277                 AND     V7, VE
    278                 LD      VE, HEWARDCODE < 4
    279                 OR      V7, VE
    280                 LD      VE, HEWARDADD
    281                 CALL    ADDSCORE
    282                 JP      SPLITUP
    283 GOTCHA:         LD      V0, CLSWAIT
    284                 CALL    WAITKEY
    285                 CALL    DRAWBLINKY
    286                 LD      I, GHOST
    287                 DRW     VA, VB, SPRITEHIGH
    288                 DRW     VC, VD, SPRITEHIGH
    289                 LD      VE, MASKLIFE
    290                 XOR     V7, VE
    291                 LD      V0, V7
    292                 AND     V0, VE
    293                 SE      V0, 0
    294                 JP      RESTART
    295                 LD      VE, V6
    296                 CALL    ADDSCORE
    297                 CALL    NEWHIGH
    298                 CLS      
    299                 LD      V6, HIXPOS
    300                 LD      V7, HIYPOS
    301                 LD      I, HIGHSCORE
    302                 CALL    PRINTDEC
    303                 LD      V6, SCXPOS
    304                 LD      V7, SCYPOS
    305                 LD      I, SCORE
    306                 CALL    PRINTDEC
    307                 LD      V4, EYEX1
    308                 LD      V5, EYEX1 + SPRITEWIDE
    309                 LD      V6, EYEY1
    310                 LD      V7, PRESSKEY
    311 EYEX1LOOP:      LD      I, EYELEFT
    312                 IFDEF   SUPER
    313                   DRW     V4, V6, 0
    314                 ELSE
    315                   DRW     V4, V6, 9
    316                 ENDIF
    317                 LD      I, EYERIGHT
    318                 IFDEF   SUPER
    319                   DRW     V5, V6, 0
    320                 ELSE
    321                   DRW     V5, V6, 9
    322                 ENDIF
    323                 LD      V0, EYEWAIT
    324                 CALL    WAITKEY
    325                 SE      VE, 0
    326                 JP      EYEPRESS
    327                 LD      I, EYELEFT
    328                 IFDEF   SUPER
    329                   DRW     V4, V6, 0
    330                 ELSE
    331                   DRW     V4, V6, 9
    332                 ENDIF
    333                 LD      I, EYERIGHT
    334                 IFDEF   SUPER
    335                   DRW     V5, V6, 0
    336                 ELSE
    337                   DRW     V5, V6, 9
    338                 ENDIF
    339                 ADD     V4, SPRITEJUMP
    340                 ADD     V5, SPRITEJUMP
    341                 SE      V4, EYEX2
    342                 JP      EYEX1LOOP
    343 EYEY1LOOP:      LD      I, EYELEFT
    344                 IFDEF   SUPER
    345                   DRW     V4, V6, 0
    346                 ELSE
    347                   DRW     V4, V6, 9
    348                 ENDIF
    349                 LD      I, EYERIGHT
    350                 IFDEF   SUPER
    351                   DRW     V5, V6, 0
    352                 ELSE
    353                   DRW     V5, V6, 9
    354                 ENDIF
    355                 LD      V0, EYEWAIT
    356                 CALL    WAITKEY
    357                 SE      VE, 0
    358                 JP      EYEPRESS
    359                 LD      I, EYELEFT
    360                 IFDEF   SUPER
    361                   DRW     V4, V6, 0
    362                 ELSE
    363                   DRW     V4, V6, 9
    364                 ENDIF
    365                 LD      I, EYERIGHT
    366                 IFDEF   SUPER
    367                   DRW     V5, V6, 0
    368                 ELSE
    369                   DRW     V5, V6, 9
    370                 ENDIF
    371                 ADD     V6, SPRITEJUMP
    372                 SE      V6, EYEY2
    373                 JP      EYEY1LOOP
    374 EYEX2LOOP:      LD      I, EYELEFT
    375                 IFDEF   SUPER
    376                   DRW     V4, V6, 0
    377                 ELSE
    378                   DRW     V4, V6, 9
    379                 ENDIF
    380                 LD      I, EYERIGHT
    381                 IFDEF   SUPER
    382                   DRW     V5, V6, 0
    383                 ELSE
    384                   DRW     V5, V6, 9
    385                 ENDIF
    386                 LD      V0, EYEWAIT
    387                 CALL    WAITKEY
    388                 SE      VE, 0
    389                 JP      EYEPRESS
    390                 LD      I, EYELEFT
    391                 IFDEF   SUPER
    392                   DRW     V4, V6, 0
    393                 ELSE
    394                   DRW     V4, V6, 9
    395                 ENDIF
    396                 LD      I, EYERIGHT
    397                 IFDEF   SUPER
    398                   DRW     V5, V6, 0
    399                 ELSE
    400                   DRW     V5, V6, 9
    401                 ENDIF
    402                 ADD     V4, -SPRITEJUMP & MASKBYTE
    403                 ADD     V5, -SPRITEJUMP & MASKBYTE
    404                 SE      V4, EYEX1
    405                 JP      EYEX2LOOP
    406 EYEY2LOOP:      LD      I, EYELEFT
    407                 IFDEF   SUPER
    408                   DRW     V4, V6, 0
    409                 ELSE
    410                   DRW     V4, V6, 9
    411                 ENDIF
    412                 LD      I, EYERIGHT
    413                 IFDEF   SUPER
    414                   DRW     V5, V6, 0
    415                 ELSE
    416                   DRW     V5, V6, 9
    417                 ENDIF
    418                 LD      V0, EYEWAIT
    419                 CALL    WAITKEY
    420                 SE      VE, 0
    421                 JP      EYEPRESS
    422                 LD      I, EYELEFT
    423                 IFDEF   SUPER
    424                   DRW     V4, V6, 0
    425                 ELSE
    426                   DRW     V4, V6, 9
    427                 ENDIF
    428                 LD      I, EYERIGHT
    429                 IFDEF   SUPER
    430                   DRW     V5, V6, 0
    431                 ELSE
    432                   DRW     V5, V6, 9
    433                 ENDIF
    434                 ADD     V6, -SPRITEJUMP & MASKBYTE
    435                 SE      V6, EYEY1
    436                 JP      EYEY2LOOP
    437                 JP      EYEX1LOOP
    438 EYEPRESS:       LD      I, EYERIGHT
    439                 IFDEF   SUPER
    440                   DRW     V5, V6, 0
    441                 ELSE
    442                   DRW     V5, V6, 9
    443                 ENDIF
    444                 LD      I, EYEBLINK
    445                 IFDEF   SUPER
    446                   DRW     V5, V6, 0
    447                 ELSE
    448                   DRW     V5, V6, 9
    449                 ENDIF
    450                 JP      START
    451                         
    452 ;  MOVEBLINKY
    453 ;  ->:  Nothing
    454 ;  <-:  VE:  Collision flag
    455 ;  <>:  V0, V1, V2, V3, V4, V5, V6, V7, V8, V9, VE, VF, I
    456 
    457 MOVEBLINKY:     LD      V3, V7
    458                 LD      VE, MASKCODE
    459                 AND     V3, VE
    460                 LD      V4, V8
    461                 LD      V5, V9
    462                 LD      VE, DOWNKEY
    463                 SKNP    VE
    464                 JP      BLINKYDOWN
    465                 LD      VE, UPKEY
    466                 SKNP    VE
    467                 JP      BLINKYUP
    468                 LD      VE, RIGHTKEY
    469                 SKNP    VE
    470                 JP      BLINKYRIGHT
    471                 LD      VE, LEFTKEY
    472                 SKNP    VE
    473                 JP      BLINKYLEFT
    474 NOKEY:          SNE     V3, DOWNCODE
    475                 ADD     V5, SPRITEJUMP
    476                 SNE     V3, UPCODE
    477                 ADD     V5, -SPRITEJUMP & MASKBYTE
    478                 SNE     V3, RIGHTCODE
    479                 ADD     V4, SPRITEJUMP
    480                 SNE     V3, LEFTCODE
    481                 ADD     V4, -SPRITEJUMP & MASKBYTE
    482                 LD      V0, V4
    483                 LD      V1, V5
    484                 CALL    SPRITMAZE
    485                 LD      V2, V0
    486                 LD      VE, GRAPHEDGE
    487                 AND     V0, VE
    488 DONEKEY:        SE      V0, 0
    489                 JP      STOPBLINKY
    490                 LD      VE, GRAPHSPEC
    491                 LD      V0, V2
    492                 AND     V2, VE
    493                 SNE     V2, PL
    494                 JP      EATPILL
    495                 SNE     V2, SP
    496                 JP      EATSUPER
    497                 SNE     V2, GW
    498                 JP      GATEWAY
    499 DONEEAT:        CALL    DRAWBLINKY
    500                 LD      VE, ~MASKCODE & MASKBYTE
    501                 AND     V7, VE
    502                 OR      V7, V3
    503                 LD      V8, V4
    504                 LD      V9, V5
    505                 JP      DRAWBLINKY
    506 BLINKYDOWN:     LD      V0, V4
    507                 LD      V1, V5
    508                 ADD     V1, SPRITEJUMP
    509                 CALL    SPRITMAZE
    510                 LD      V2, V0
    511                 LD      VE, GRAPHEDGE
    512                 AND     V0, VE
    513                 SE      V0, 0
    514                 JP      NOKEY
    515                 LD      V3, DOWNCODE
    516                 ADD     V5, SPRITEJUMP
    517                 JP      DONEKEY
    518 BLINKYUP:       LD      V0, V4
    519                 LD      V1, V5
    520                 ADD     V1, -SPRITEJUMP & MASKBYTE
    521                 CALL    SPRITMAZE
    522                 LD      V2, V0
    523                 LD      VE, GRAPHEDGE
    524                 AND     V0, VE
    525                 SE      V0, 0
    526                 JP      NOKEY
    527                 LD      V3, UPCODE
    528                 ADD     V5, -SPRITEJUMP & MASKBYTE
    529                 JP      DONEKEY
    530 BLINKYRIGHT:    LD      V0, V4
    531                 LD      V1, V5
    532                 ADD     V0, SPRITEJUMP
    533                 CALL    SPRITMAZE
    534                 LD      V2, V0
    535                 LD      VE, GRAPHEDGE
    536                 AND     V0, VE
    537                 SE      V0, 0
    538                 JP      NOKEY
    539                 LD      V3, RIGHTCODE
    540                 ADD     V4, SPRITEJUMP
    541                 JP      DONEKEY
    542 BLINKYLEFT:     LD      V0, V4
    543                 LD      V1, V5
    544                 ADD     V0, -SPRITEJUMP & MASKBYTE
    545                 CALL    SPRITMAZE
    546                 LD      V2, V0
    547                 LD      VE, GRAPHEDGE
    548                 AND     V0, VE
    549                 SE      V0, 0
    550                 JP      NOKEY
    551                 LD      V3, LEFTCODE
    552                 ADD     V4, -SPRITEJUMP & MASKBYTE
    553                 JP      DONEKEY
    554 STOPBLINKY:     CALL    DRAWBLINKY
    555                 DRW     V8, V9, SPRITEHIGH
    556                 LD      VE, VF
    557                 RET
    558 EATPILL:        LD      VE, ~MASKNIBB & MASKBYTE
    559                 AND     V0, VE
    560                 OR      V0, V3
    561                 LD      [I], V0
    562                 LD      I, PILL
    563                 DRW     V4, V5, SPRITEHIGH
    564                 ADD     V6, PILLADD
    565                 LD      V1, PILLTIME
    566                 LD      V0, DT
    567                 SNE     V0, 0
    568                 LD      ST, V1
    569                 JP      DONEEAT
    570 EATSUPER:       LD      VE, ~MASKNIBB & MASKBYTE
    571                 AND     V0, VE
    572                 OR      V0, V3
    573                 LD      [I], V0
    574                 LD      I, SUPER
    575                 DRW     V4, V5, SPRITEHIGH
    576                 ADD     V6, SUPERADD
    577                 LD      V0, VA
    578                 LD      V1, VB
    579                 CALL    SPRITMAZE
    580                 LD      VE, ~MASKNIBB & MASKBYTE
    581                 AND     V0, VE
    582                 SE      V0, 0
    583                 JP      SKIPPACKLETT
    584                 LD      VE, MASKCODE < 2
    585                 XOR     V7, VE
    586 SKIPPACKLETT:   LD      V0, VC
    587                 LD      V1, VD
    588                 CALL    SPRITMAZE
    589                 LD      VE, ~MASKNIBB & MASKBYTE
    590                 AND     V0, VE
    591                 SE      V0, 0
    592                 JP      SKIPHEWARD
    593                 LD      VE, MASKCODE < 4
    594                 XOR     V7, VE
    595 SKIPHEWARD:     LD      V0, SUPERTIME
    596                 LD      ST, V0
    597                 LD      DT, V0
    598                 JP      DONEEAT
    599 GATEWAY:        SNE     V3, LEFTCODE
    600                 LD      V4, GATERIGHT
    601                 SNE     V3, RIGHTCODE
    602                 LD      V4, GATELEFT
    603                 JP      DONEEAT
    604 
    605 ;  MOVEPACKLETT
    606 ;  ->:  V4:  Force random move if nonzero value
    607 ;  <-:  Nothing
    608 ;  <>:  V0, V1, V2, V3, V7, VA, VB, VE, VF, I
    609 
    610 MOVEPACKLETT:   LD      V2, V7
    611                 LD      V3, V7
    612                 LD      VE, MASKCODE < 2
    613                 AND     V2, VE
    614                 LD      V0, VA
    615                 LD      V1, VB
    616                 CALL    SPRITMAZE
    617                 LD      I, GHOST
    618                 LD      VE, ~MASKNIBB & MASKBYTE
    619                 AND     V0, VE
    620                 SE      V0, 0
    621                 JP      LOOKPACKLETT
    622 TURNPACKLETT:   DRW     VA, VB, SPRITEHIGH
    623                 SNE     V2, DOWNCODE < 2
    624                 ADD     VB, SPRITEJUMP
    625                 SNE     V2, UPCODE < 2
    626                 ADD     VB, -SPRITEJUMP & MASKBYTE
    627                 SNE     V2, RIGHTCODE < 2
    628                 ADD     VA, SPRITEJUMP
    629                 SNE     V2, LEFTCODE < 2
    630                 ADD     VA, -SPRITEJUMP & MASKBYTE
    631                 DRW     VA, VB, SPRITEHIGH
    632                 RET     
    633 LOOKPACKLETT:   LD      VE, MASKHUNT
    634                 LD      V1, DT
    635                 SE      V1, 0
    636                 JP      RANDPACKLETT
    637                 SE      V4, 0
    638                 JP      RANDPACKLETT
    639                 LD      V1, V0
    640                 SHL     V3
    641                 SE      VF, 0
    642                 JP      HORISPACKLETT
    643                 LD      V3, V9
    644                 SUB     V3, VB
    645                 SNE     VF, 0
    646                 JP      PACKLETTLU
    647                 SE      V3, 0
    648                 JP      PACKLETTLD
    649                 XOR     V7, VE
    650                 LD      V3, V8
    651                 SUB     V3, VA
    652                 SNE     VF, 0
    653                 JP      PACKLETTLL
    654                 SE      V3, 0
    655                 JP      PACKLETTLR
    656                 XOR     V7, VE
    657                 JP      RANDPACKLETT
    658 HORISPACKLETT:  LD      V3, V8
    659                 SUB     V3, VA
    660                 SNE     VF, 0
    661                 JP      PACKLETTLL
    662                 SE      V3, 0
    663                 JP      PACKLETTLR
    664                 XOR     V7, VE
    665                 LD      V3, V9
    666                 SUB     V3, VB
    667                 SNE     VF, 0
    668                 JP      PACKLETTLU
    669                 SE      V3, 0
    670                 JP      PACKLETTLD
    671                 XOR     V7, VE
    672                 JP      RANDPACKLETT
    673 PACKLETTLD:     LD      V3, MD
    674                 AND     V1, V3
    675                 SNE     V1, 0
    676                 JP      RANDPACKLETT
    677                 DRW     VA, VB, SPRITEHIGH
    678                 ADD     VB, SPRITEJUMP
    679                 DRW     VA, VB, SPRITEHIGH
    680                 LD      VE, ~( MASKCODE < 2 ) & MASKBYTE
    681                 AND     V7, VE
    682                 LD      V2, DOWNCODE < 2
    683                 OR      V7, V2
    684                 RET     
    685 PACKLETTLU:     LD      V3, MU
    686                 AND     V1, V3
    687                 SNE     V1, 0
    688                 JP      RANDPACKLETT
    689                 DRW     VA, VB, SPRITEHIGH
    690                 ADD     VB, -SPRITEJUMP & MASKBYTE
    691                 DRW     VA, VB, SPRITEHIGH
    692                 LD      VE, ~( MASKCODE < 2 ) & MASKBYTE
    693                 AND     V7, VE
    694                 LD      V2, UPCODE < 2
    695                 OR      V7, V2
    696                 RET     
    697 PACKLETTLR:     LD      V3, MR
    698                 AND     V1, V3
    699                 SNE     V1, 0
    700                 JP      RANDPACKLETT
    701                 DRW     VA, VB, SPRITEHIGH
    702                 ADD     VA, SPRITEJUMP
    703                 DRW     VA, VB, SPRITEHIGH
    704                 LD      VE, ~( MASKCODE < 2 ) & MASKBYTE
    705                 AND     V7, VE
    706                 LD      V2, RIGHTCODE < 2
    707                 OR      V7, V2
    708                 RET     
    709 PACKLETTLL:     LD      V3, ML
    710                 AND     V1, V3
    711                 SNE     V1, 0
    712                 JP      RANDPACKLETT
    713                 DRW     VA, VB, SPRITEHIGH
    714                 ADD     VA, -SPRITEJUMP & MASKBYTE
    715                 DRW     VA, VB, SPRITEHIGH
    716                 LD      VE, ~( MASKCODE < 2 ) & MASKBYTE
    717                 AND     V7, VE
    718                 LD      V2, LEFTCODE < 2
    719                 OR      V7, V2
    720                 RET     
    721 RANDPACKLETT:   RND     V1, ~MASKNIBB & MASKBYTE
    722                 AND     V0, V1
    723                 SE      V0, 0
    724                 JP      SETPACKLETT
    725 PACKLETTERR:    LD      VE, MASKCODE < 2
    726                 XOR     V7, VE
    727                 XOR     V2, VE
    728                 JP      TURNPACKLETT
    729 SETPACKLETT:    DRW     VA, VB, SPRITEHIGH
    730                 SHL     V0
    731                 SNE     VF, 0
    732                 JP      PACKLETTRD
    733                 LD      V2, LEFTCODE < 2 
    734                 ADD     VA, -SPRITEJUMP & MASKBYTE
    735                 JP      PACKLETTSET
    736 PACKLETTRD:     SHL     V0
    737                 SNE     VF, 0
    738                 JP      PACKLETTRR
    739                 LD      V2, DOWNCODE < 2
    740                 ADD     VB, SPRITEJUMP
    741                 JP      PACKLETTSET
    742 PACKLETTRR:     SHL     V0
    743                 SNE     VF, 0
    744                 JP      PACKLETTRU
    745                 LD      V2, RIGHTCODE < 2 
    746                 ADD     VA, SPRITEJUMP
    747                 JP      PACKLETTSET
    748 PACKLETTRU:     SHL     V0
    749                 SNE     VF, 0
    750                 JP      PACKLETTERR
    751                 LD      V2, UPCODE < 2
    752                 ADD     VB, -SPRITEJUMP & MASKBYTE
    753 PACKLETTSET:    DRW     VA, VB, SPRITEHIGH
    754                 LD      VE, ~( MASKCODE < 2 ) & MASKBYTE
    755                 AND     V7, VE
    756                 OR      V7, V2
    757                 RET
    758 
    759 ;  MOVEHEWARD
    760 ;  ->:  V4:  Force random move if nonzero value
    761 ;  <-:  Nothing
    762 ;  <>:  V0, V1, V2, V3, V7, VC, VD, VE, VF, I
    763 
    764 MOVEHEWARD:     LD      V2, V7
    765                 LD      V3, V7
    766                 LD      VE, MASKCODE < 4
    767                 AND     V2, VE
    768                 LD      V0, VC
    769                 LD      V1, VD
    770                 CALL    SPRITMAZE
    771                 LD      I, GHOST
    772                 LD      VE, ~MASKNIBB & MASKBYTE
    773                 AND     V0, VE
    774                 SE      V0, 0
    775                 JP      LOOKHEWARD
    776 TURNHEWARD:     DRW     VC, VD, SPRITEHIGH
    777                 SNE     V2, DOWNCODE < 4
    778                 ADD     VD, SPRITEJUMP
    779                 SNE     V2, UPCODE < 4
    780                 ADD     VD, -SPRITEJUMP & MASKBYTE
    781                 SNE     V2, RIGHTCODE < 4
    782                 ADD     VC, SPRITEJUMP
    783                 SNE     V2, LEFTCODE < 4
    784                 ADD     VC, -SPRITEJUMP & MASKBYTE
    785                 DRW     VC, VD, SPRITEHIGH
    786                 RET     
    787 LOOKHEWARD:     LD      VE, MASKHUNT
    788                 LD      V1, DT
    789                 SE      V1, 0
    790                 JP      RANDHEWARD
    791                 SE      V4, 0
    792                 JP      RANDHEWARD
    793                 LD      V1, V0
    794                 SHL     V3
    795                 SNE     VF, 0
    796                 JP      HORISHEWARD
    797                 LD      V3, V9
    798                 SUB     V3, VD
    799                 SNE     VF, 0
    800                 JP      HEWARDLU
    801                 SE      V3, 0
    802                 JP      HEWARDLD
    803                 XOR     V7, VE
    804                 LD      V3, V8
    805                 SUB     V3, VC
    806                 SNE     VF, 0
    807                 JP      HEWARDLL
    808                 SE      V3, 0
    809                 JP      HEWARDLR
    810                 XOR     V7, VE
    811                 JP      RANDHEWARD
    812 HORISHEWARD:    LD      V3, V8
    813                 SUB     V3, VC
    814                 SNE     VF, 0
    815                 JP      HEWARDLL
    816                 SE      V3, 0
    817                 JP      HEWARDLR
    818                 XOR     V7, VE
    819                 LD      V3, V9
    820                 SUB     V3, VD
    821                 SNE     VF, 0
    822                 JP      HEWARDLU
    823                 SE      V3, 0
    824                 JP      HEWARDLD
    825                 XOR     V7, VE
    826                 JP      RANDHEWARD
    827 HEWARDLD:       LD      V3, MD
    828                 AND     V1, V3
    829                 SNE     V1, 0
    830                 JP      RANDHEWARD
    831                 DRW     VC, VD, SPRITEHIGH
    832                 ADD     VD, SPRITEJUMP
    833                 DRW     VC, VD, SPRITEHIGH
    834                 XOR     V7, VE
    835                 LD      VE, ~( MASKCODE < 4 ) & MASKBYTE
    836                 AND     V7, VE
    837                 LD      V2, DOWNCODE < 4
    838                 OR      V7, V2
    839                 RET     
    840 HEWARDLU:       LD      V3, MU
    841                 AND     V1, V3
    842                 SNE     V1, 0
    843                 JP      RANDHEWARD
    844                 DRW     VC, VD, SPRITEHIGH
    845                 ADD     VD, -SPRITEJUMP & MASKBYTE
    846                 DRW     VC, VD, SPRITEHIGH
    847                 XOR     V7, VE
    848                 LD      VE, ~( MASKCODE < 4 ) & MASKBYTE
    849                 AND     V7, VE
    850                 LD      V2, UPCODE < 4
    851                 OR      V7, V2
    852                 RET     
    853 HEWARDLR:       LD      V3, MR
    854                 AND     V1, V3
    855                 SNE     V1, 0
    856                 JP      RANDHEWARD
    857                 DRW     VC, VD, SPRITEHIGH
    858                 ADD     VC, SPRITEJUMP
    859                 DRW     VC, VD, SPRITEHIGH
    860                 XOR     V7, VE
    861                 LD      VE, ~( MASKCODE < 4 ) & MASKBYTE
    862                 AND     V7, VE
    863                 LD      V2, RIGHTCODE < 4
    864                 OR      V7, V2
    865                 RET     
    866 HEWARDLL:       LD      V3, ML
    867                 AND     V1, V3
    868                 SNE     V1, 0
    869                 JP      RANDHEWARD
    870                 DRW     VC, VD, SPRITEHIGH
    871                 ADD     VC, -SPRITEJUMP & MASKBYTE
    872                 DRW     VC, VD, SPRITEHIGH
    873                 XOR     V7, VE
    874                 LD      VE, ~( MASKCODE < 4 ) & MASKBYTE
    875                 AND     V7, VE
    876                 LD      V2, LEFTCODE < 4
    877                 OR      V7, V2
    878                 RET     
    879 RANDHEWARD:     RND     V1, ~MASKNIBB & MASKBYTE
    880                 AND     V0, V1
    881                 SE      V0, 0
    882                 JP      SETHEWARD
    883 HEWARDERR:      XOR     V7, VE
    884                 LD      VE, MASKCODE < 4
    885                 XOR     V7, VE
    886                 XOR     V2, VE
    887                 JP      TURNHEWARD
    888 SETHEWARD:      DRW     VC, VD, SPRITEHIGH
    889                 SHL     V0
    890                 SNE     VF, 0
    891                 JP      HEWARDRD
    892                 LD      V2, LEFTCODE < 4 | MASKHUNT
    893                 ADD     VC, -SPRITEJUMP & MASKBYTE
    894                 JP      HEWARDSET
    895 HEWARDRD:       SHL     V0
    896                 SNE     VF, 0
    897                 JP      HEWARDRR
    898                 LD      V2, DOWNCODE < 4
    899                 ADD     VD, SPRITEJUMP
    900                 JP      HEWARDSET
    901 HEWARDRR:       SHL     V0
    902                 SNE     VF, 0
    903                 JP      HEWARDRU
    904                 LD      V2, RIGHTCODE < 4 | MASKHUNT
    905                 ADD     VC, SPRITEJUMP
    906                 JP      HEWARDSET
    907 HEWARDRU:       SHL     V0
    908                 SNE     VF, 0
    909                 JP      HEWARDERR
    910                 LD      V2, UPCODE < 4
    911                 ADD     VD, -SPRITEJUMP & MASKBYTE
    912 HEWARDSET:      DRW     VC, VD, SPRITEHIGH
    913                 LD      VE, ~( MASKCODE < 4 | MASKHUNT ) & MASKBYTE
    914                 AND     V7, VE
    915                 OR      V7, V2
    916                 RET
    917 
    918 ;  DRAWBLINKY
    919 ;  ->  V7:  Sprite direction register
    920 ;  ->  V8:  Blinky X screen coordinate
    921 ;  ->  V9:  Blinky Y screen coordinate
    922 ;  <-  VE:  Collision flag
    923 ;  <-  I:  Blinky sprite pointer
    924 ;  <>  V0, V1, VE, VF, I
    925 
    926 DRAWBLINKY:     LD      V0, V7
    927                 LD      VE, MASKCODE
    928                 AND     V0, VE
    929                 SHL     V0
    930                 LD      V1, V8
    931                 ADD     V1, V9
    932                 LD      VE, SPRITEJUMP
    933                 AND     V1, VE
    934                 SNE     V1, 0
    935                 ADD     V0, 1
    936                 SHL     V0
    937                 SHL     V0
    938                 IFDEF   SUPER
    939                   SHL     V0
    940                 ENDIF
    941                 LD      I, SPRITES
    942                 ADD     I, V0
    943                 DRW     V8, V9, SPRITEHIGH
    944                 LD      VE, VF
    945                 RET
    946 
    947 ;  COPYMAZE
    948 ;  ->  Nothing
    949 ;  <-  Nothing
    950 ;  <>  V0, V1, V2, V3, VE, VF, I
    951 
    952 COPYMAZE:       LD      VE, 0
    953 COPYLOOP:       LD      I, MAZE
    954                 ADD     I, VE
    955                 ADD     I, VE
    956                 ADD     I, VE
    957                 ADD     I, VE
    958                 LD      V3, [I]
    959                 LD      I, BUFFER
    960                 ADD     I, VE
    961                 ADD     I, VE
    962                 ADD     I, VE
    963                 ADD     I, VE
    964                 LD      [I], V3
    965                 ADD     VE, 1
    966                 SE      VE, MAZEEND - MAZE \ 4
    967                 JP      COPYLOOP
    968                 RET
    969 
    970 ;  DRAWMAZE
    971 ;  ->  Nothing
    972 ;  <-  Nothing
    973 ;  <>  V0, V1, V2, V3, VE, VF, I
    974 
    975 DRAWMAZE:       XOR     V2, V2
    976                 XOR     V3, V3
    977                 LD      VE, 15
    978 DRAWLOOP:       LD      V0, V2
    979                 LD      V1, V3
    980                 CALL    GRAPHMAZE
    981                 AND     V0, VE
    982                 SHL     V0
    983                 IFDEF   SUPER
    984                   SHL     V0
    985                 ENDIF
    986                 LD      I, GRAPHS
    987                 ADD     I, V0
    988                 DRW     V2, V3, SPRITEJUMP
    989                 ADD     V2, SPRITEJUMP
    990                 SE      V2, SCREENWIDE
    991                 JP      DRAWLOOP
    992                 XOR     V2, V2
    993                 ADD     V3, SPRITEJUMP
    994                 SNE     V3, SCREENHIGH
    995                 RET     
    996                 JP      DRAWLOOP
    997                         
    998 ;  SPRITMAZE,  GRAPHMAZE
    999 ;  ->  V0:  X coordinate
   1000 ;  ->  V1:  Y coordinate
   1001 ;  <-  V0:  Maze data byte
   1002 ;  <-  I:  Maze data pointer
   1003 ;  <>  V0, V1, VF, I
   1004 
   1005 SPRITMAZE:      ADD     V0, SPRITEJUMP
   1006                 ADD     V1, SPRITEJUMP
   1007 GRAPHMAZE:      SHR     V0
   1008                 IFDEF   SUPER
   1009                   SHR     V0
   1010                 ENDIF
   1011                 SHR     V1
   1012                 IFDEF   SUPER
   1013                   SHR     V1
   1014                 ENDIF
   1015                 SHL     V1
   1016                 SHL     V1
   1017                 SHL     V1
   1018                 SHL     V1
   1019                 LD      I, BUFFER
   1020                 ADD     I, V1
   1021                 ADD     I, V1
   1022                 ADD     I, V0
   1023                 LD      V0, [I]
   1024                 RET
   1025 
   1026 ;  NEXTLEVEL
   1027 ;  ->  Nothing
   1028 ;  <-  Nothing
   1029 ;  <>  V0, VF, I
   1030 
   1031 NEXTLEVEL:      LD      I, LEVEL
   1032                 LD      V0, [I]
   1033                 SHR     V0
   1034                 LD      [I], V0
   1035                 LD      V0, LEVELKEY
   1036 LOOPLEVEL:      SKNP    V0
   1037                 JP      LOOPLEVEL
   1038                 RET
   1039 
   1040 ;  PRINTDEC
   1041 ;  ->  V6:  Print X coordinate
   1042 ;  ->  V7:  Print Y coordinate
   1043 ;  ->  I:  16 bit value pointer
   1044 ;  <-  Nothing
   1045 ;  <>  V0, V1, V2, V3, V4, V5, V6, V7, VE, VF, I
   1046 
   1047 PRINTDEC:       LD      V1, [I]
   1048                 LD      VE, 1
   1049                 XOR     V4, V4
   1050                 LD      V2, V0
   1051                 LD      V3, V1
   1052 LOOPTENG:       LD      V5, 10000 % 256
   1053                 SUB     V3, V5
   1054                 SNE     VF, 0
   1055                 SUB     V2, VE
   1056                 SNE     VF, 0
   1057                 JP      SKIPTENG
   1058                 LD      V5, 10000 \ 256
   1059                 SUB     V2, V5
   1060                 SNE     VF, 0
   1061                 JP      SKIPTENG
   1062                 LD      V0, V2
   1063                 LD      V1, V3
   1064                 ADD     V4, VE
   1065                 JP      LOOPTENG
   1066 SKIPTENG:       IFDEF   SUPER
   1067                   LD      HF, V4
   1068                   DRW     V6, V7, 10
   1069                 ELSE
   1070                   LD      F, V4
   1071                   DRW     V6, V7, 5
   1072                 ENDIF
   1073                 ADD     V6, SPRITEWIDE - SPRITEJUMP
   1074                 XOR     V4, V4
   1075                 LD      V2, V0
   1076                 LD      V3, V1
   1077 LOOPTHOUS:      LD      V5, 1000 % 256
   1078                 SUB     V3, V5
   1079                 SNE     VF, 0
   1080                 SUB     V2, VE
   1081                 SNE     VF, 0
   1082                 JP      SKIPTHOUS
   1083                 LD      V5, 1000 \ 256
   1084                 SUB     V2, V5
   1085                 SNE     VF, 0
   1086                 JP      SKIPTHOUS
   1087                 LD      V0, V2
   1088                 LD      V1, V3
   1089                 ADD     V4, VE
   1090                 JP      LOOPTHOUS
   1091 SKIPTHOUS:      IFDEF   SUPER
   1092                   LD      HF, V4
   1093                   DRW     V6, V7, 10
   1094                 ELSE
   1095                   LD      F, V4
   1096                   DRW     V6, V7, 5
   1097                 ENDIF
   1098                 ADD     V6, SPRITEWIDE - SPRITEJUMP
   1099                 XOR     V4, V4
   1100                 LD      V2, V0
   1101                 LD      V3, V1
   1102 LOOPHUNDR:      LD      V5, 100
   1103                 SUB     V3, V5
   1104                 SNE     VF, 0
   1105                 SUB     V2, VE
   1106                 SNE     VF, 0
   1107                 JP      SKIPHUNDR
   1108                 LD      V0, V2
   1109                 LD      V1, V3
   1110                 ADD     V4, VE
   1111                 JP      LOOPHUNDR
   1112 SKIPHUNDR:      IFDEF   SUPER
   1113                   LD      HF, V4
   1114                   DRW     V6, V7, 10
   1115                 ELSE
   1116                   LD      F, V4
   1117                   DRW     V6, V7, 5
   1118                 ENDIF
   1119                 ADD     V6, SPRITEWIDE - SPRITEJUMP
   1120                 XOR     V4, V4
   1121                 LD      V2, V0
   1122                 LD      V3, V1
   1123 LOOPTEN:        LD      V5, 10
   1124                 SUB     V3, V5
   1125                 SNE     VF, 0
   1126                 JP      SKIPTEN
   1127                 LD      V1, V3
   1128                 ADD     V4, VE
   1129                 JP      LOOPTEN
   1130 SKIPTEN:        IFDEF   SUPER
   1131                   LD      HF, V4
   1132                   DRW     V6, V7, 10
   1133                 ELSE
   1134                   LD      F, V4
   1135                   DRW     V6, V7, 5
   1136                 ENDIF
   1137                 ADD     V6, SPRITEWIDE - SPRITEJUMP
   1138                 IFDEF   SUPER
   1139                   LD      HF, V1
   1140                   DRW     V6, V7, 10
   1141                 ELSE
   1142                   LD      F, V1
   1143                   DRW     V6, V7, 5
   1144                 ENDIF
   1145                 RET
   1146 
   1147 ;  ADDSCORE
   1148 ;  ->  VE:  Score count to add
   1149 ;  <-  Nothing
   1150 ;  <>  V0, V1, VE, VF, I
   1151 
   1152 ADDSCORE:       LD      I, SCORE
   1153                 LD      V1, [I]
   1154                 ADD     V1, VE
   1155                 SE      VF, 0
   1156                 ADD     V0, 1
   1157                 LD      I, SCORE
   1158                 LD      [I], V1
   1159                 RET
   1160 
   1161 ;  NEWHIGH
   1162 ;  ->  Nothing
   1163 ;  <-  Nothing
   1164 ;  <>  V0, V1, V2, V3, VE, VF, I
   1165 
   1166 NEWHIGH:        LD      I, SCORE
   1167                 LD      V3, [I]
   1168                 LD      VE, V0
   1169                 SUB     VE, V2
   1170                 SNE     VF, 0
   1171                 RET     
   1172                 SE      VE, 0
   1173                 JP      STOREHIGH
   1174                 LD      VE, V1
   1175                 SUB     VE, V3
   1176                 SNE     VF, 0
   1177                 RET     
   1178 STOREHIGH:      LD      I, HIGHSCORE
   1179                 LD      [I], V1
   1180                 RET
   1181 
   1182 ;  WAITKEY
   1183 ;  ->  V0:  Waitcount
   1184 ;  <-  VE:  Keypressed
   1185 ;  <>  V0, V1, V2, V3, VE, VF
   1186 
   1187 WAITKEY:        XOR     VE, VE
   1188                 LD      V2, PRESSKEY
   1189                 LD      V3, -1 & MASKBYTE
   1190                 LD      V1, 16
   1191 LOOPKEY:        SKNP    V2
   1192                 JP      HITKEY
   1193                 ADD     V1, V3
   1194                 SE      V1, 0
   1195                 JP      LOOPKEY
   1196                 LD      V1, 16
   1197                 ADD     V0, V3
   1198                 SE      V0, 0
   1199                 JP      LOOPKEY
   1200                 RET     
   1201 HITKEY:         LD      VE, 1
   1202                 RET
   1203 
   1204 SCORE           DW      0
   1205 HIGHSCORE:      DW      0
   1206 
   1207 LEVEL:          DB      STARTLEVEL
   1208 
   1209                 ALIGN   OFF
   1210                 USED    ON
   1211 
   1212 SPRITES         =       ?
   1213 
   1214                 IFDEF   SUPER
   1215 
   1216   UP:             DB      $........
   1217                   DB      $..1...1.
   1218                   DB      $.11...11
   1219                   DB      $.11...11
   1220                   DB      $.111.111
   1221                   DB      $.1111111
   1222                   DB      $..11111.
   1223                   DB      $...111..
   1224 
   1225                   DB      $........
   1226                   DB      $...111..
   1227                   DB      $...1111.
   1228                   DB      $.1.111.1
   1229                   DB      $.1.111.1
   1230                   DB      $.11.1111
   1231                   DB      $..11111.
   1232                   DB      $...111..
   1233 
   1234   LEFT:           DB      $........
   1235                   DB      $..1111..
   1236                   DB      $.111111.
   1237                   DB      $....1111
   1238                   DB      $.....111
   1239                   DB      $....1111
   1240                   DB      $.111111.
   1241                   DB      $..1111..
   1242 
   1243                   DB      $........
   1244                   DB      $...111..
   1245                   DB      $..1..11.
   1246                   DB      $.1111111
   1247                   DB      $.1111111
   1248                   DB      $.1111.11
   1249                   DB      $.....11.
   1250                   DB      $...111..
   1251 
   1252   RIGHT:          DB      $........
   1253                   DB      $...1111.
   1254                   DB      $..111111
   1255                   DB      $.1111...
   1256                   DB      $.111....
   1257                   DB      $.1111...
   1258                   DB      $..111111
   1259                   DB      $...1111.
   1260 
   1261                   DB      $........
   1262                   DB      $...111..
   1263                   DB      $..11..1.
   1264                   DB      $.1111111
   1265                   DB      $.1111111
   1266                   DB      $.11.1111
   1267                   DB      $..11....
   1268                   DB      $...111..
   1269 
   1270   DOWN:           DB      $........
   1271                   DB      $...111..
   1272                   DB      $..11111.
   1273                   DB      $.1111111
   1274                   DB      $.111.111
   1275                   DB      $.11...11
   1276                   DB      $.11...11
   1277                   DB      $..1...1.
   1278 
   1279                   DB      $........
   1280                   DB      $...111..
   1281                   DB      $..11111.
   1282                   DB      $.11.1111
   1283                   DB      $.1.111.1
   1284                   DB      $.1.111.1
   1285                   DB      $...1111.
   1286                   DB      $...111..
   1287 
   1288   GHOST:          DB      $........
   1289                   DB      $...111..
   1290                   DB      $..11111.
   1291                   DB      $.1..1..1
   1292                   DB      $.111.111
   1293                   DB      $.1111111
   1294                   DB      $.11...11
   1295                   DB      $.1111111
   1296 
   1297   PILL:           DB      $........
   1298                   DB      $........
   1299                   DB      $........
   1300                   DB      $........
   1301                   DB      $....1...
   1302                   DB      $........
   1303                   DB      $........
   1304                   DB      $........
   1305 
   1306   SUPER:          DB      $........
   1307                   DB      $........
   1308                   DB      $........
   1309                   DB      $........
   1310                   DB      $....1...
   1311                   DB      $....1...
   1312                   DB      $........
   1313                   DB      $........
   1314 
   1315                 ELSE
   1316 
   1317   UP:             DB      $........
   1318                   DB      $.1.1....
   1319                   DB      $.111....
   1320                   DB      $..1.....
   1321 
   1322                   DB      $........
   1323                   DB      $.1.1....
   1324                   DB      $.111....
   1325                   DB      $..1.....
   1326 
   1327   LEFT:           DB      $........
   1328                   DB      $.11.....
   1329                   DB      $..11....
   1330                   DB      $.11.....
   1331 
   1332                   DB      $........
   1333                   DB      $.11.....
   1334                   DB      $..11....
   1335                   DB      $.11.....
   1336 
   1337   RIGHT:          DB      $........
   1338                   DB      $..11....
   1339                   DB      $.11.....
   1340                   DB      $..11....
   1341 
   1342                   DB      $........
   1343                   DB      $..11....
   1344                   DB      $.11.....
   1345                   DB      $..11....
   1346 
   1347   DOWN:           DB      $........
   1348                   DB      $..1.....
   1349                   DB      $.111....
   1350                   DB      $.1.1....
   1351 
   1352                   DB      $........
   1353                   DB      $..1.....
   1354                   DB      $.111....
   1355                   DB      $.1.1....
   1356 
   1357   GHOST:          DB      $........
   1358                   DB      $..1.....
   1359                   DB      $.111....
   1360                   DB      $.111....
   1361 
   1362   PILL:           DB      $........
   1363                   DB      $........
   1364                   DB      $..1.....
   1365                   DB      $........
   1366 
   1367   SUPER:          DB      $........
   1368                   DB      $........
   1369                   DB      $........
   1370                   DB      $........
   1371 
   1372                 ENDIF
   1373 
   1374 GRAPHS          =       ?
   1375 
   1376 ;  $0000  Trail up
   1377 ;  $0001  Trail left
   1378 ;  $0010  Trail right
   1379 ;  $0011  Trail down
   1380 ;  $0100  Empty space
   1381 ;  $0101  Ordinary pill
   1382 ;  $0110  Super pill
   1383 ;  $0111  Gateway
   1384 ;  $1000  Horisontal egde
   1385 ;  $1001  Invisible horisontal edge
   1386 ;  $1010  Vertical edge
   1387 ;  $1011  Invisible vertical edge
   1388 ;  $1100  Upper left corner
   1389 ;  $1101  Upper right corner
   1390 ;  $1110  Lower left corner
   1391 ;  $1111  Lower right corner
   1392 
   1393 GRAPHEDGE       =       $1000
   1394 GRAPHSPEC       =       $0111
   1395 ES              =       $0100
   1396 PL              =       $0101
   1397 SP              =       $0110
   1398 GW              =       $0111
   1399 LR              =       $1000
   1400 ILR             =       $1001
   1401 UD              =       $1010
   1402 IUD             =       $1011
   1403 UL              =       $1100
   1404 UR              =       $1101
   1405 DL              =       $1110
   1406 DR              =       $1111
   1407 MU              =       $00010000
   1408 MR              =       $00100000
   1409 MUR             =       $00110000
   1410 MD              =       $01000000
   1411 MDU             =       $01010000
   1412 MDR             =       $01100000
   1413 MDUR            =       $01110000
   1414 ML              =       $10000000
   1415 MUL             =       $10010000
   1416 MRL             =       $10100000
   1417 MURL            =       $10110000
   1418 MDL             =       $11000000
   1419 MDUL            =       $11010000
   1420 MDRL            =       $11100000
   1421 MDURL           =       $11110000
   1422 
   1423                 IFDEF   SUPER
   1424 
   1425                   DB      $........
   1426                   DB      $........
   1427                   DB      $........
   1428                   DB      $........
   1429                           
   1430                   DB      $........
   1431                   DB      $........
   1432                   DB      $........
   1433                   DB      $........
   1434                         
   1435                   DB      $........
   1436                   DB      $........
   1437                   DB      $........
   1438                   DB      $........
   1439                         
   1440                   DB      $........
   1441                   DB      $........
   1442                   DB      $........
   1443                   DB      $........
   1444                         
   1445   EMPTY:          DB      $........
   1446                   DB      $........
   1447                   DB      $........
   1448                   DB      $........
   1449                         
   1450   PILLGR:         DB      $1.......
   1451                   DB      $........
   1452                   DB      $........
   1453                   DB      $........
   1454                         
   1455   SUPERGR:        DB      $1.......
   1456                   DB      $1.......
   1457                   DB      $........
   1458                   DB      $........
   1459                         
   1460   GATEGR:         DB      $........
   1461                   DB      $........
   1462                   DB      $........
   1463                   DB      $........
   1464                         
   1465   HORIS:          DB      $1111....
   1466                   DB      $........
   1467                   DB      $........
   1468                   DB      $........
   1469                         
   1470   INVHORIS:       DB      $........
   1471                   DB      $........
   1472                   DB      $........
   1473                   DB      $........
   1474                         
   1475   VERT:           DB      $1.......
   1476                   DB      $1.......
   1477                   DB      $1.......
   1478                   DB      $1.......
   1479 
   1480   INVVERT:        DB      $........
   1481                   DB      $........
   1482                   DB      $........
   1483                   DB      $........
   1484                         
   1485   UPLEFT:         DB      $1111....
   1486                   DB      $1.......
   1487                   DB      $1.......
   1488                   DB      $1.......
   1489                         
   1490   UPRIGHT:        DB      $1.......
   1491                   DB      $1.......
   1492                   DB      $1.......
   1493                   DB      $1.......
   1494                         
   1495   DOWNLEFT:       DB      $1111....
   1496                   DB      $........
   1497                   DB      $........
   1498                   DB      $........
   1499                         
   1500   DOWNRIGHT:      DB      $1.......
   1501                   DB      $........
   1502                   DB      $........
   1503                   DB      $........
   1504                         
   1505                 ELSE
   1506                   
   1507                   DB      $........
   1508                   DB      $........
   1509                           
   1510                   DB      $........
   1511                   DB      $........
   1512                         
   1513                   DB      $........
   1514                   DB      $........
   1515                         
   1516                   DB      $........
   1517                   DB      $........
   1518                         
   1519   EMPTY:          DB      $........
   1520                   DB      $........
   1521                         
   1522   PILLGR:         DB      $1.......
   1523                   DB      $........
   1524                         
   1525   SUPERGR:        DB      $........
   1526                   DB      $........
   1527                         
   1528   GATEGR:         DB      $........
   1529                   DB      $........
   1530                         
   1531   HORIS:          DB      $11......
   1532                   DB      $........
   1533                         
   1534   INVHORIS:       DB      $........
   1535                   DB      $........
   1536                         
   1537   VERT:           DB      $1.......
   1538                   DB      $1.......
   1539 
   1540   INVVERT:        DB      $........
   1541                   DB      $........
   1542                         
   1543   UPLEFT:         DB      $11......
   1544                   DB      $1.......
   1545                         
   1546   UPRIGHT:        DB      $1.......
   1547                   DB      $1.......
   1548                         
   1549   DOWNLEFT:       DB      $11......
   1550                   DB      $........
   1551                         
   1552   DOWNRIGHT:      DB      $1.......
   1553                   DB      $........
   1554                         
   1555                 ENDIF
   1556 
   1557 MAZE            =       ?
   1558                         
   1559                 XREF    OFF
   1560 
   1561 ;  ##################################################################
   1562 ;  #------------------------------- ------------------------------- #
   1563 ;  #|                             | |                         O   | #
   1564 ;  #| ? . . . . ? . . ? . . . . ? | | ? . . . . ? . . ? . . .OOO? | #
   1565 ;  #|                             | |                        OOO  | #
   1566 ;  #| . ------- . --- . ------- . --- . ------- . --- . ------- . | #
   1567 ;  #|   |         | |         |         |         | |         |   | #
   1568 ;  #| . | ? x . ? | | ? . . ? | ? . . ? | ? . . ? | | ? . x ? | . | #
   1569 ;  #|   |         | |         |         |         | |         |   | #
   1570 ;  #| . | . --------------- . ----------- . --------------- . | . | #
   1571 ;  #|                 |                         |                 | #
   1572 ;  #| ? . ? . . . . ? | ? . ? . ? . . ? . ? . ? | ? . . . . ? . ? | #
   1573 ;  #|                 |                         |                 | #
   1574 ;  #| . ----------- . | . ----- . --- . ----- . | . ----------- . | #
   1575 ;  #|   |         |       |     O           |       |         |   | #
   1576 ;  #| . | ? . . ? | ? ? ? | ? .O?O. . ? . ? | ? ? ? | ? . . ? | . | #
   1577 ;  #              |       |    O O          |       |               #
   1578 ;  #+ ? . ? --- . --- . --- . ----------- . --- . --- . --- ? . ? + #
   1579 ;  #                          |         |                           #
   1580 ;  #| . | ? . . ? . . ? . . ? ----- ----- ? . . ? . . ? . . ? | . | #
   1581 ;  #|   |                         | |                         |   | #
   1582 ;  #| . ------- . --------- ? . ? | | ? . ? --------- . ------- . | #
   1583 ;  #|         |   |       |       | |       |       |   |         | #
   1584 ;  #| ? . x ? | . ------------- . --- . ------------- . | ? x . ? | #
   1585 ;  #|         |                                         |         | #
   1586 ;  #| . --- . | ? . . . . ? . . ? . . ? . . ? . . . . ? | . --- . | #
   1587 ;  #|   | |   |                                         |   | |   | #
   1588 ;  #| . --- . ----------- . --- . --- . --- . ----------- . --- . | #
   1589 ;  #|   O                   | |         | |                       | #
   1590 ;  #| ?OOO. ? . . . . . . ? | | ? . . ? | | ? . . . . . . ? . . ? | #
   1591 ;  #|  OOO                  | |         | |                       | #
   1592 ;  #------------------------- ----------- ------------------------- #
   1593 ;  #                                                                #
   1594 ;  ##################################################################
   1595 
   1596                 DB      UL, LR, LR, LR, LR, LR, LR, LR
   1597                 DB      LR, LR, LR, LR, LR, LR, LR, UR
   1598                 DB      UL, LR, LR, LR, LR, LR, LR, LR
   1599                 DB      LR, LR, LR, LR, LR, LR, LR, UR
   1600 
   1601                 DB      UD, MDR | PL, PL, PL, PL, PL, MDRL | PL, PL
   1602                 DB      PL, MDRL | PL, PL, PL, PL, PL, MDL | PL, UD
   1603                 DB      UD, MDR | PL, PL, PL, PL, PL, MDRL | PL, PL
   1604                 DB      PL, MDRL | PL, PL, PL, PL, PL, MDL | PL, UD
   1605 
   1606                 DB      UD, PL, UL, LR, LR, DR, PL, UL
   1607                 DB      UR, PL, LR, LR, LR, UR, PL, DL
   1608                 DB      DR, PL, UL, LR, LR, DR, PL, UL
   1609                 DB      UR, PL, LR, LR, LR, UR, PL, UD
   1610 
   1611                 DB      UD, PL, UD, MDR | PL, SP, PL, MUL | PL, UD
   1612                 DB      UD, MUR | PL, PL, PL, MDL | PL, UD
   1613                 DB      MUR | PL, PL, PL, MUL | PL
   1614                 DB      UD, MDR | PL, PL, PL, MUL | PL, UD
   1615                 DB      UD, MUR | PL, PL, SP, MDL | PL, UD, PL, UD
   1616 
   1617                 DB      UD, PL, DR, PL, LR, LR, LR, LR
   1618                 DB      LR, UL, LR, DR, PL, LR, LR, LR
   1619                 DB      LR, LR, DR, PL, LR, LR, UL, LR
   1620                 DB      LR, LR, LR, DR, PL, DR, PL, UD
   1621 
   1622                 DB      UD, MDUR | PL, PL, MURL | PL, PL, PL, PL, PL
   1623                 DB      MDL | PL, UD, MDR | PL, PL, MURL | PL, PL,
   1624                 DB      MDRL | PL, PL, PL, MDRL | PL
   1625                 DB      PL, MURL | PL, PL, MDL | PL, UD, MDR | PL
   1626                 DB      PL, PL, PL, PL, MURL | PL, PL, MDUL | PL, UD
   1627 
   1628                 DB      UD, PL, UL, LR, LR, LR, LR, UR
   1629                 DB      PL, DR, PL, UL, LR, DR, PL, LR
   1630                 DB      DR, PL, LR, LR, UR, PL, DR, PL
   1631                 DB      UL, LR, LR, LR, LR, UR, PL, UD
   1632                         
   1633                 DB      DR, PL, DR, MDR | PL, PL, PL, MDL | PL, UD
   1634                 DB      MUR | PL, MDRL | PL, MUL | PL, UD, MDR | PL
   1635                 DB      PL, MURL, PL, PL, MURL | PL, PL
   1636                 DB      MDL | PL, UD, MUR | PL, MDRL | PL, MUL | PL
   1637                 DB      UD, MDR | PL, PL, PL, MDL | PL, DR, PL, DR
   1638 
   1639                 DB      GW, MDUR | ES, PL, MDUL | PL, LR, DR, PL, DL
   1640                 DB      DR, PL, LR, DR, PL, UL, LR, LR
   1641                 DB      LR, LR, UR, PL, LR, DR, PL, LR
   1642                 DB      DR, PL, LR, DR, MDUR | PL, PL, MDUL | ES, GW
   1643 
   1644                 DB      UD, PL, UD, MUR | PL, PL, PL, MDURL | PL, PL
   1645                 DB      PL, MURL | PL, PL, PL, MDUL | PL, LR, LR, UR
   1646                 DB      UL, LR, DR, MDUR | PL, PL, PL, MURL | PL, PL
   1647                 DB      PL, MDURL | PL, PL, PL, MUL | PL, UD, PL, UD
   1648 
   1649                 DB      UD, PL, LR, LR, LR, UR, PL, UL
   1650                 DB      LR, LR, LR, UR, MUR | PL, PL, MDL | PL, UD
   1651                 DB      UD, MDR | PL, PL, MUL | PL, UL, LR, LR, LR
   1652                 DB      UR, PL, UL, LR, LR, DR, PL, UD
   1653 
   1654                 DB      UD, MDUR | PL, PL, SP, MDL | PL, UD, PL, LR
   1655                 DB      LR, LR, LR, LR, LR, DR, PL, LR
   1656                 DB      DR, PL, LR, LR, LR, LR, LR, LR
   1657                 DB      DR, PL, UD, MDR | PL, SP, PL, MDUL | PL, UD
   1658 
   1659                 DB      UD, PL, UL, UR, PL, UD, MUR | PL, PL
   1660                 DB      PL, PL, PL, MDRL | PL, PL, PL, MDURL | PL, PL
   1661                 DB      PL, MDURL | PL, PL, PL, MDRL | PL, PL, PL, PL
   1662                 DB      PL, MUL | PL, UD, PL, UL, UR, PL, UD
   1663 
   1664                 DB      UD, PL, LR, DR, PL, LR, LR, LR
   1665                 DB      LR, LR, DR, PL, UL, UR, PL, LR
   1666                 DB      DR, PL, UL, UR, PL, LR, LR, LR
   1667                 DB      LR, LR, DR, PL, LR, DR, PL, UD
   1668 
   1669                 DB      UD, MUR | PL, PL, PL, MURL | PL, PL, PL, PL
   1670                 DB      PL, PL, PL, MUL | PL, UD, UD, MUR | PL, PL
   1671                 DB      PL, MUL | PL, UD, UD, MUR | PL, PL, PL, PL
   1672                 DB      PL, PL, PL, MURL | PL, PL, PL, MUL | PL, UD
   1673 
   1674                 DB      LR, LR, LR, LR, LR, LR, LR, LR
   1675                 DB      LR, LR, LR, LR, DR, LR, LR, LR
   1676                 DB      LR, LR, DR, LR, LR, LR, LR, LR
   1677                 DB      LR, LR, LR, LR, LR, LR, LR, DR
   1678 
   1679                 XREF    ON
   1680 
   1681 MAZEEND         =       ?
   1682 
   1683 EYES            =       ?
   1684                         
   1685                 IFDEF   SUPER
   1686 
   1687   EYELEFT:        DW      $.......1111.....  
   1688                   DW      $......1....1....
   1689                   DW      $.....1..11..1...
   1690                   DW      $....1..1111..1..
   1691                   DW      $....1.111111.1..
   1692                   DW      $....1.111.11.1..
   1693                   DW      $....1..1111..1.1
   1694                   DW      $.....1..11..1..1
   1695                   DW      $......1....1..11
   1696                   DW      $.......1111..111
   1697                   DW      $.............111
   1698                   DW      $.......11.....11
   1699                   DW      $......111111....
   1700                   DW      $.......111111111
   1701                   DW      $........11111111
   1702                   DW      $..........111111
   1703 
   1704   EYERIGHT:       DW      $....1111........  
   1705                   DW      $...1....1.......
   1706                   DW      $..1..11..1......
   1707                   DW      $.1..1111..1.....
   1708                   DW      $.1.111111.1.....
   1709                   DW      $.1.111.11.1.....
   1710                   DW      $.1..1111..1.....
   1711                   DW      $..1..11..1......
   1712                   DW      $1..1....1.......
   1713                   DW      $11..1111........
   1714                   DW      $11..............
   1715                   DW      $1.....11........
   1716                   DW      $...111111.......
   1717                   DW      $11111111........
   1718                   DW      $1111111.........
   1719                   DW      $11111...........
   1720 
   1721   EYEBLINK:       DW      $....1111........  
   1722                   DW      $...111111.......
   1723                   DW      $..11111111......
   1724                   DW      $.1111111111.....
   1725                   DW      $.1111111111.....
   1726                   DW      $.1.11111111.....
   1727                   DW      $.1...111111.....
   1728                   DW      $..1.....11......
   1729                   DW      $1..1....1.......
   1730                   DW      $11..1111........
   1731                   DW      $11......1.......
   1732                   DW      $1.....1111......
   1733                   DW      $...111111.......
   1734                   DW      $11111111........
   1735                   DW      $1111111.........
   1736                   DW      $11111...........
   1737 
   1738                 ELSE
   1739 
   1740   EYELEFT:        DB      $..1111..
   1741                   DB      $.1....1.
   1742                   DB      $1..11..1
   1743                   DB      $1..11..1
   1744                   DB      $.1....1.
   1745                   DB      $..1111..
   1746                   DB      $.......1
   1747                   DB      $...1....
   1748                   DB      $....1111
   1749                         
   1750   EYERIGHT:       DB      $.1111...
   1751                   DB      $1....1..
   1752                   DB      $..11..1.
   1753                   DB      $..11..1.
   1754                   DB      $1....1..
   1755                   DB      $.1111...
   1756                   DB      $........
   1757                   DB      $...1....
   1758                   DB      $111.....
   1759                         
   1760   EYEBLINK:       DB      $.1111...
   1761                   DB      $111111..
   1762                   DB      $1111111.
   1763                   DB      $1111111.
   1764                   DB      $1....1..
   1765                   DB      $.1111...
   1766                   DB      $........
   1767                   DB      $...1....
   1768                   DB      $111.....
   1769                         
   1770                 ENDIF
   1771  
   1772                 USED    OFF
   1773                 ALIGN   ON
   1774                         
   1775 BUFFER          =       ?