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

DEMOBOOT.S (2285B)


      1  lst off
      2 
      3 org = $1000
      4  org org
      5 
      6 *-------------------------------------------------
      7 *
      8 * 08/01/85
      9 * 07/02/87 mod for 3.5
     10 *
     11 * Demo using the 18 sector routines.
     12 *
     13 * Loads in a double hires picture
     14 * from tracks 2,3,4 and 5.
     15 *
     16 *  by Roland Gustafsson
     17 *
     18 
     19 temp0 = $3A
     20 temp1 = $3B
     21 
     22 RW18temp = $2100
     23 RW18 = $D000
     24 
     25 slot = $FD
     26 track = $FE
     27 
     28 *-------------------------------------------------
     29 *
     30 * Move to actual run address
     31 *
     32 
     33 start ldy #0
     34 :0 lda $2000,y
     35  sta org,y
     36  iny
     37  bne :0
     38  jmp :1
     39 
     40 * Tell RW18 which slot to use
     41 
     42 :1 lda $43
     43  sta slot
     44 
     45  jsr check64k
     46 
     47 * Turn on the disk drive (It is
     48 * already on, but this call is
     49 * necessary to initialize the
     50 * RW18 routine)
     51 
     52 LOOP jsr RW18
     53  hex 000100
     54 
     55 * Clear hires page
     56 
     57  jsr hgr
     58 
     59 * Now seek to track two since that
     60 * is where the data starts.
     61 
     62  jsr RW18
     63  hex 020002
     64 
     65 * Display double hires page one
     66 
     67  sta $C050
     68  sta $C052
     69  sta $C054
     70  sta $C057
     71  sta $C00D
     72  sta $C05E
     73  sta $C001
     74 
     75 * Load in the picture
     76 
     77  bit $C055
     78  jsr LOADBANK
     79  bit $C054
     80  jsr LOADBANK
     81  sta $C000
     82 
     83 * Turn off the drive
     84 
     85  jsr RW18
     86  hex 01
     87 
     88 * Wait for keypress
     89 
     90 waitkey lda $C000
     91  bpl waitkey
     92  sta $C010
     93  bmi LOOP
     94 
     95 *-------------------------------------------------
     96 *
     97 * Load in two tracks
     98 *
     99 * The C in C3 and C4 means
    100 * bit7:sound speaker on error
    101 * bit6:auto inc track
    102 *
    103 * Read sequence
    104 *
    105 
    106 LOADBANK jsr RW18
    107  hex C320
    108 
    109 * Read group
    110 
    111  jsr RW18
    112  hex 84
    113  hex 32333435363738393A
    114  hex 3B3C3D3E0000000000
    115 * ^^^^^^^^
    116 * Note that the last five sectors
    117 * are ignored.
    118 *
    119 * Read last page by itself to
    120 * test RW18.35.
    121 
    122  jsr RW18
    123  hex C4
    124  hex 000000000000000000
    125  hex 000000003F00000000
    126 
    127  rts
    128 
    129 *-------------------------------------------------
    130 *
    131 * Clear double hires page
    132 *
    133 
    134 hgr sta $C005
    135  jsr :0
    136  sta $C004
    137 
    138 :0 ldy #0
    139  ldx #$20
    140  sty temp0
    141  stx temp1
    142  tya
    143 :1 sta (temp0),y
    144  iny
    145  bne :1
    146  inc temp1
    147  dex
    148  bne :1
    149  rts
    150 
    151 *-------------------------------------------------
    152 *
    153 * Check for 64k and move RW18 to its home.
    154 *
    155 
    156 check64k bit $C08B
    157  bit $C08B
    158  ldy #0
    159 :0 sty $E000
    160  cpy $E000
    161  bne NOT64K
    162  iny
    163  bne :0
    164 
    165 * Move RW18 to $D000
    166 
    167  ldx #5
    168 :1 lda RW18temp,y
    169 :2 sta RW18,y
    170  iny
    171  bne :1
    172  inc :1+2
    173  inc :2+2
    174  dex
    175  bne :1
    176  rts
    177 
    178 NOT64K sta $C081
    179  ldy #0
    180 :0 lda :errtext,y
    181  beq *
    182  sta $628,y
    183  iny
    184  bne :0
    185 
    186 :errtext ASC "REQUIRES 64K MEMORY",00
    187 
    188 *------------------------------------------------- EOF
    189 
    190  sav demoboot