Prince-of-Persia-Apple-II

A running-jumping-swordfighting game Jordan Mechner made on the Apple II from 1985-89
Log | Files | Refs | README | LICENSE

TABLES.S (3131B)


      1 * tables
      2 org = $e00
      3  tr on
      4  lst off
      5 *-------------------------------
      6 *
      7 *  PRINCE OF PERSIA
      8 *  Copyright 1989 Jordan Mechner
      9 *
     10 *-------------------------------
     11  dum org
     12 
     13 ByteTable ds $100
     14 OffsetTable ds $100
     15 BlockTable ds $100
     16 PixelTable ds $100
     17 Mult10 ds $10
     18 Mult7 ds $10
     19 Mult30 ds $40
     20 
     21 BlockEdge ds 20
     22 BlockTop ds 5
     23 BlockBot ds 5
     24 FloorY ds 5
     25 BlockAy ds 5
     26 
     27  dend
     28 *-------------------------------
     29  org org
     30 *-------------------------------
     31 ScrnLeft = 58
     32 ScrnTop = 0
     33 ScrnBot = 191
     34 
     35 VertDist = 10 ;from bottom of block to center plane
     36 BlockHeight = 63
     37 DHeight = 3 ;floorpiece thickness
     38 
     39 Blox1 = BlockHeight
     40 Blox2 = 2*BlockHeight
     41 Blox3 = 3*BlockHeight
     42 Blox4 = 4*BlockHeight
     43 
     44 *-------------------------------
     45 * ByteTable
     46 *
     47 * Index:  Real screen X-coord (0-255)
     48 * Yields: Byte # (0-36)
     49 *-------------------------------
     50 
     51  ds ByteTable-*
     52 
     53 ]byte = 0
     54  lup 36
     55  db ]byte,]byte,]byte,]byte,]byte,]byte,]byte
     56 ]byte = ]byte+1
     57  --^
     58  db 36,36,36,36
     59 
     60 *-------------------------------
     61 * OffsetTable
     62 *
     63 * Index:  Same as ByteTable
     64 * Yields: Offset (0-6)
     65 *-------------------------------
     66  ds OffsetTable-*
     67 
     68  lup 36
     69  db 0,1,2,3,4,5,6
     70  --^
     71  db 0,1,2,3
     72 
     73 *-------------------------------
     74 * BlockTable
     75 *
     76 * Index:  Screen X-coord (0 to 255)
     77 * Yields: Block # (-5 to 14)
     78 *-------------------------------
     79  ds BlockTable-*
     80 
     81 ]byte = -5
     82  db ]byte,]byte
     83 
     84  lup 18
     85 ]byte = ]byte+1
     86  db ]byte,]byte,]byte,]byte,]byte,]byte,]byte
     87  db ]byte,]byte,]byte,]byte,]byte,]byte,]byte
     88  --^
     89 
     90 ]byte = ]byte+1
     91  db ]byte,]byte
     92 
     93 *-------------------------------
     94 * PixelTable
     95 *
     96 * Index:  Same as BlockTable
     97 * Yields: Pixel # within block (0 to 13)
     98 *-------------------------------
     99  ds PixelTable-*
    100 
    101  db 12,13
    102 
    103  lup 18
    104  db 0,1,2,3,4,5,6,7,8,9,10,11,12,13
    105  --^
    106 
    107  db 0,1
    108 
    109 *-------------------------------
    110 * Mult10
    111 *-------------------------------
    112  ds Mult10-*
    113 
    114 ]byte = 0
    115  lup 16
    116  db ]byte
    117 ]byte = ]byte+10
    118  --^
    119 
    120 *-------------------------------
    121 * Mult7
    122 *-------------------------------
    123  ds Mult7-*
    124 
    125 ]byte = 0
    126  lup 16
    127  db ]byte
    128 ]byte = ]byte+7
    129  --^
    130 
    131 *-------------------------------
    132 * Mult30
    133 *-------------------------------
    134  ds Mult30-*
    135 
    136 ]word = 0
    137  lup 32
    138  dw ]word
    139 ]word = ]word+30
    140  --^
    141 
    142 *-------------------------------
    143 * BlockEdge
    144 *
    145 * Index:  Block X (-5 to 14) + 5
    146 * Yields: Screen X-coord of left edge of block
    147 *-------------------------------
    148  ds BlockEdge-*
    149 
    150 ]byte = -12
    151  lup 20
    152  db ]byte
    153 ]byte = ]byte+14
    154  --^
    155 
    156 *-------------------------------
    157 * BlockTop, BlockBot, FloorY
    158 *
    159 * Index:  Block Y (-1 to 3) + 1
    160 
    161  ds BlockTop-*
    162 
    163  db ScrnBot+1-Blox4
    164  db ScrnBot+1-Blox3
    165  db ScrnBot+1-Blox2
    166  db ScrnBot+1-Blox1
    167  db ScrnBot+1
    168 
    169 *-------------------------------
    170  ds BlockBot-*
    171 
    172  db ScrnBot-Blox3
    173  db ScrnBot-Blox2
    174  db ScrnBot-Blox1
    175  db ScrnBot
    176  db ScrnBot+Blox1
    177 
    178 *-------------------------------
    179  ds FloorY-*
    180 
    181  db ScrnBot-Blox3-VertDist
    182  db ScrnBot-Blox2-VertDist
    183  db ScrnBot-Blox1-VertDist
    184  db ScrnBot-VertDist
    185  db ScrnBot+Blox1-VertDist
    186 
    187 *-------------------------------
    188  ds BlockAy-*
    189 
    190  db ScrnBot-Blox3-DHeight
    191  db ScrnBot-Blox2-DHeight
    192  db ScrnBot-Blox1-DHeight
    193  db ScrnBot-DHeight
    194  db ScrnBot+Blox1-DHeight
    195 
    196 *-------------------------------
    197  lst
    198 eof ds 1
    199  usr $a9,3,$000,*-org
    200  lst off