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

POPBOOT35.S (2669B)


      1  lst off
      2 
      3  org $2000
      4 
      5 *-------------------------------------------------
      6 *
      7 * 06/28/89 Prince of Persia boot code
      8 * for rw18 3.5" version
      9 *
     10 * Last mod: 09/05/89
     11 *
     12 
     13 rw18 = $D000
     14 
     15 slot = $FD
     16 
     17 *-------------------------------------------------
     18 *
     19 * Tell RW18 which slot to use
     20 *
     21 
     22 start bit RW18temp
     23 
     24  ldx #$FF
     25  txs
     26 
     27  lda $43 ;ProDOS boot drive
     28  sta slot
     29 
     30 * Clear screen, etc...
     31 
     32  jsr init
     33 
     34 * Check system for 128k of RAM
     35 
     36  jsr check128k
     37 
     38 * Determine if we are running on a GS
     39 * and do GS specific stuff also...
     40 
     41  jsr setGSflag
     42 
     43 * Move rw18 to its home
     44 
     45  jsr moverw18
     46 
     47 * Start loading the game
     48 
     49  jsr rw18
     50  db 7,$A9 ;Bbund ID=$A9 for side one
     51 
     52  jsr rw18 ;"seek" track one
     53  db 2,0,1
     54 
     55  jsr rw18 ;read in $EE00-FFFF
     56  hex C3EE
     57 
     58  jmp $EE00
     59 
     60 *-------------------------------------------------
     61 text = $fb2f
     62 home = $fc58
     63 vtab = $FB5B
     64 cout = $FDF0
     65 normal = $fe84
     66 pr0 = $fe93
     67 in0 = $fe89
     68 
     69 init ldx #$ff
     70  stx $4fb
     71  stx $3f3
     72  stx $3f4
     73  stx $c000 ;80store off
     74  stx $c002 ;RAMRD main
     75  stx $c004 ;RAMWRT main
     76  stx $c00c ;80col off
     77  stx $c00e ;Altcharset off
     78  stx $c081 ;write RAM, read ROM (2nd 4k bank)
     79  jsr text
     80  jsr home
     81  jsr normal
     82  jsr pr0
     83  jsr in0
     84 
     85  rts
     86 
     87 *-------------------------------------------------
     88 *
     89 * Check to make sure //c or //e
     90 * with 128k
     91 *
     92 
     93 check128k sta $C081
     94 
     95  lda $FBB3 ;Apple // family ID byte
     96  cmp #6
     97  bne NOT128K ;Must be e/c/GS
     98 
     99  bit $C017
    100  bmi NOT128K
    101 
    102  ldx #CHECKEND
    103 :0 lda CHECKER,X
    104  sta $180,X
    105  dex
    106  bpl :0
    107 
    108  jsr $180
    109  bcs NOT128K
    110 
    111  rts
    112 
    113 NOT128K jsr text
    114  jsr home
    115  lda #8
    116  jsr vtab
    117 
    118  ldy #0
    119 :0 lda MEMTEXT,Y
    120  beq *
    121  jsr cout
    122  cmp #$8D
    123  bne :1
    124  lda #4
    125  sta $24
    126 :1 iny
    127  bne :0
    128 
    129 MEMTEXT hex 8D
    130  asc "REQUIRES A //C OR //E WITH 128K"
    131  hex 00
    132 
    133 *-------------------------------------------------
    134 * Check for AUX memory routine
    135 
    136 CHECKER lda #$EE
    137  sta $C005
    138  sta $C003
    139  sta $0800
    140  lda $0C00
    141  cmp #$EE
    142  bne :0
    143  asl $0C00
    144  lda $0800
    145  cmp $0C00
    146  beq :1
    147 :0 clc
    148 :1 sta $C004
    149  sta $C002
    150  rts
    151 
    152 CHECKEND = *-CHECKER
    153 
    154 *------------------------------------------------- setGSflag
    155 *
    156 * Set the GS? flag in rw18
    157 *
    158 
    159 setGSflag sta $C081
    160  sec
    161  jsr $FE1F
    162  lda #$FF
    163  adc #0
    164  sta GS?
    165  bpl :notGS
    166 
    167 * Set background color to black, text to white
    168 
    169  lda #$F0
    170  sta $C022
    171 
    172 * Set border color to black
    173 
    174  lda $C034
    175  and #$F0
    176  sta $C034
    177 
    178 :notGS rts
    179 
    180 *------------------------------------------------- moverw18
    181 *
    182 * Move RW18 to it's final home in $D000
    183 *
    184 
    185 moverw18 bit $C08B
    186  bit $C08B
    187 
    188  ldy #0
    189 :0 lda RW18temp,y
    190 :1 sta $D000,y
    191  iny
    192  bne :0
    193 
    194  inc :0+2
    195  inc :1+2
    196  bne :0
    197 
    198  rts
    199 
    200 *-------------------------------------------------
    201 
    202  sav popboot35
    203 
    204 *------------------------------------------------- EOF
    205  dum *
    206 RW18temp ds 3
    207 GS? ds 1
    208  dend
    209 *-------------------------------------------------
    210  lst off