back to project page

ROCK3_alt Disassembly

                   ********************************************************************************
                   * Stellar 7 for the Apple II, by Damon Slye                                    *
                   * Copyright 1983 Dynamix                                                       *
                   *                                                                              *
                   * Disassembly of the "ROCK3" launcher from a pre-release(?) version.           *
                   ********************************************************************************
                   * Disassembly by Andy McFadden, using 6502bench SourceGen v1.6.                *
                   * Last updated 2020/03/24                                                      *
                   ********************************************************************************
                   load_addr       .eq     $00    {addr/2}
                   filename_ptr    .eq     $02    {addr/2}
                   ptr04           .eq     $04    {addr/2}
                   ptr             .eq     $06    {addr/2}
                   file_length     .eq     $08    {addr/2}
                   ptr1            .eq     $fc    {addr/2}
                   ptr2            .eq     $fe    {addr/2}
                   DOS_RWTS        .eq     $03d9             ;RWTS entry point
                   DOS_LOCRPL      .eq     $03e3             ;loads Y/A with address of RWTS IOB
                   MON_SOFTEVEC    .eq     $03f2  {addr/2}   ;address of RESET handler
                   MON_PWREDUP     .eq     $03f4             ;power-up RESET checksum
                   TEXT_PAGE_2     .eq     $0800  {addr/1024}
                   LEVEL_NUM       .eq     $8584             ;current level number (1-7)
                   GAME_START      .eq     $a440             ;start point after initial load
                   SECTOR_BUF_0    .eq     $b400  {addr/256}
                   SECTOR_BUF_1    .eq     $b500  {addr/256}
                   TXTCLR          .eq     $c050             ;RW display graphics
                   TXTSET          .eq     $c051             ;RW display text
                   MIXCLR          .eq     $c052             ;RW display full screen
                   TXTPAGE2        .eq     $c055             ;RW display page 2 (or read/write aux mem)
                   HIRES           .eq     $c057             ;RW display hi-res graphics

                                   .org    $0e00
0e00: a9 00        ENTRY           lda     #$00              ;copy $e00-12ff -> $ae00-b2ff
0e02: 85 fc                        sta     ptr1              ;(overwrites part of DOS 3.3)
0e04: 85 fe                        sta     ptr2
0e06: a9 0e                        lda     #>ENTRY
0e08: 85 fd                        sta     ptr1+1
0e0a: a9 ae                        lda     #>Start
0e0c: 85 ff                        sta     ptr2+1
0e0e: a0 00                        ldy     #$00
0e10: b1 fc        :Loop           lda     (ptr1),y
0e12: 91 fe                        sta     (ptr2),y
0e14: c8                           iny
0e15: d0 f9                        bne     :Loop
0e17: e6 fd                        inc     ptr1+1
0e19: e6 ff                        inc     ptr2+1
0e1b: a5 fd                        lda     ptr1+1
0e1d: c9 13                        cmp     #$13
0e1f: 90 ef                        bcc     :Loop
0e21: 20 00 b0                     jsr     DiskInit
0e24: 4c 27 ae                     jmp     Start

                                   .org    $ae27
ae27: a9 03        Start           lda     #$03
ae29: a2 e0                        ldx     #$e0              ;reset vector -> $45e0
ae2b: a0 45                        ldy     #$45              ;(hi-res page 2... makes no sense)
ae2d: 8d f4 03                     sta     MON_PWREDUP       ;final version of S7 sets it to $ae27, i.e.
ae30: 8e f2 03                     stx     MON_SOFTEVEC      ; this very routine
ae33: 8c f3 03                     sty     MON_SOFTEVEC+1
                   ; clear text page 2 to spaces
ae36: a9 08                        lda     #>TEXT_PAGE_2
ae38: 85 07                        sta     ptr+1
ae3a: a0 00                        ldy     #<TEXT_PAGE_2
ae3c: 84 06                        sty     ptr
ae3e: a9 a0                        lda     #“ ”
ae40: 91 06        :ClrLoop        sta     (ptr),y
ae42: c8                           iny
ae43: d0 fb                        bne     :ClrLoop
ae45: e6 07                        inc     ptr+1
ae47: a6 07                        ldx     ptr+1
ae49: e0 0c                        cpx     #>TEXT_PAGE_2+$400
ae4b: 90 f3                        bcc     :ClrLoop
                   ; switch to text page 2, load title, switch to hi-res page 1
ae4d: ad 51 c0                     lda     TXTSET
ae50: ad 55 c0                     lda     TXTPAGE2
ae53: a2 02                        ldx     #$02              ;TITLE ($2000-3ff8)
ae55: 20 60 af                     jsr     LoadFile
ae58: ad 52 c0                     lda     MIXCLR
ae5b: ad 57 c0                     lda     HIRES
ae5e: ad 50 c0                     lda     TXTCLR
ae61: a2 00                        ldx     #$00              ;ROCK1 ($800-1fff)
ae63: 20 60 af                     jsr     LoadFile
ae66: a2 01                        ldx     #$01              ;ROCK2 ($6000-acff)
ae68: 20 60 af                     jsr     LoadFile
ae6b: a2 06                        ldx     #$06              ;HIGH ($ad04-ad7f)
ae6d: 20 60 af                     jsr     LoadFile
ae70: 4c 40 a4                     jmp     GAME_START

ae73: 00 60 00 00+ load_addr_mod   .bulk   $00,$60,$00,$00,$00,$00,$00,$00,$00 ;overrides load addr of ROCK2 from $4000 to $6000
ae7c: 8e           file_name_lo    .dd1    <file_name_0
ae7d: 94                           .dd1    <file_name_1
ae7e: 9a                           .dd1    <file_name_2
ae7f: a0                           .dd1    <file_name_3
ae80: a6                           .dd1    <file_name_4
ae81: ac                           .dd1    <file_name_5
ae82: b5                           .dd1    <file_name_6
ae83: ba                           .dd1    <file_name_7
ae84: c3                           .dd1    <file_name_8
ae85: ae           file_name_hi    .dd1    >file_name_0
ae86: ae                           .dd1    >file_name_1
ae87: ae                           .dd1    >file_name_2
ae88: ae                           .dd1    >file_name_3
ae89: ae                           .dd1    >file_name_4
ae8a: ae                           .dd1    >file_name_5
ae8b: ae                           .dd1    >file_name_6
ae8c: ae                           .dd1    >file_name_7
ae8d: ae                           .dd1    >file_name_8
ae8e: d2 cf c3 cb+ file_name_0     .str    “ROCK1”
ae93: 2e                           .dd1    ‘.’
ae94: d2 cf c3 cb+ file_name_1     .str    “ROCK2”
ae99: 2e                           .dd1    ‘.’
ae9a: d4 c9 d4 cc+ file_name_2     .str    “TITLE”
ae9f: 2e                           .dd1    ‘.’
aea0: d0 c1 ce c5+ file_name_3     .str    “PANEL”
aea5: 2e                           .dd1    ‘.’
aea6: c2 d2 c9 c5+ file_name_4     .str    “BRIEF”
aeab: 2e                           .dd1    ‘.’
aeac: c2 d2 c9 c5+ file_name_5     .str    “BRIEF.ST”
aeb4: 2e                           .dd1    ‘.’
aeb5: c8 c9 c7 c8  file_name_6     .str    “HIGH”
aeb9: 2e                           .dd1    ‘.’
aeba: d0 cc c1 d9+ file_name_7     .str    “PLAYGAME”
aec2: 2e                           .dd1    ‘.’
aec3: c2 d2 c9 c5+ file_name_8     .str    “BRIEFING”
aecb: 2e                           .dd1    ‘.’
aecc: 75 75 aa aa+ check_compare?  .bulk   $75,$75,$aa,$aa,$75,$75,$aa,$aa,$55,$75,$aa,$aa,$75,$75,$aa,$aa
                                    +      $75,$75,$aa,$aa,$55,$55,$aa,$aa,$55,$55,$aa,$aa,$55,$55,$aa,$aa
                                    +      $55,$55,$aa,$aa,$55,$55,$aa,$aa,$55,$55,$aa,$aa,$55,$55,$aa,$aa
                                    +      $55,$55,$aa,$aa,$7d,$7d,$aa,$aa,$55,$55,$aa,$aa,$7d,$7d,$aa,$aa
                                    +      $7d,$7d,$aa,$aa,$5d,$5d,$aa,$aa,$55,$55,$aa,$aa,$5d,$5d,$aa,$aa
                                    +      $5d,$5d,$aa,$aa,$7d,$7d,$aa,$aa,$55,$55,$aa,$a8,$7d,$5d,$aa,$aa
                                    +      $5d,$5d,$aa,$aa,$dd,$dd,$8a,$8a,$5d,$5d,$8a,$8a,$dd,$dd,$8a,$8a
                                    +      $dd,$dd,$8a,$8a,$7d,$7d,$aa,$aa,$75,$75,$aa,$aa,$7d,$75,$aa,$aa
                                    +      $75,$75,$aa,$aa,$7d,$75,$aa,$aa,$75,$75,$aa,$a0,$7d,$75,$aa,$aa
                                    +      $75,$75,$aa,$aa

                   ********************************************************************************
                   * Loads the specified file.                                                    *
                   *                                                                              *
                   * Called from ROCK2.                                                           *
                   *                                                                              *
                   * On entry:                                                                    *
                   *   X-reg: file name index                                                     *
                   ********************************************************************************
af60: a9 00        LoadFile        lda     #$00
af62: 85 00                        sta     load_addr
af64: bd 73 ae                     lda     load_addr_mod,x
af67: 85 01                        sta     load_addr+1
af69: bd 7c ae                     lda     file_name_lo,x
af6c: 85 02                        sta     filename_ptr
af6e: bd 85 ae                     lda     file_name_hi,x
af71: 85 03                        sta     filename_ptr+1
af73: 4c 03 b0                     jmp     DiskReadFile

af76: a2 a2 55 55+                 .junk   18

                   ********************************************************************************
                   * Loads the three level files for the level number stored in $8584.            *
                   *                                                                              *
                   * Called from ROCK2.                                                           *
                   ********************************************************************************
af88: a9 00        LoadLevelFiles  lda     #$00              ;use default load addresses
af8a: 85 00                        sta     load_addr
af8c: 85 01                        sta     load_addr+1
af8e: a2 02                        ldx     #$02
af90: bd e6 af     LAF90           lda     lev_name_lo,x
af93: 85 02                        sta     filename_ptr
af95: bd e9 af                     lda     lev_name_hi,x
af98: 85 03                        sta     filename_ptr+1
af9a: a0 03                        ldy     #$03              ;append the level number
af9c: ad 84 85                     lda     LEVEL_NUM
af9f: 09 b0                        ora     #“0”
afa1: 91 02                        sta     (filename_ptr),y
afa3: 8a                           txa
afa4: 48                           pha
afa5: 20 03 b0                     jsr     DiskReadFile      ;load the file
afa8: 68                           pla
afa9: aa                           tax
afaa: ca                           dex
afab: 10 e3                        bpl     LAF90
                   ; Some sort of integrity check on the data file?
afad: a9 6a                        lda     #$6a
afaf: 85 ff                        sta     ptr2+1
afb1: a2 e0                        ldx     #$e0
afb3: bd d0 65     :Loop           lda     $65d0,x           ;rolling XOR of $66b0-66cf (OBJ# file)
afb6: 45 ff                        eor     ptr2+1            ; (seems to be the same in all of them)
afb8: 85 ff                        sta     ptr2+1            ;area holds object Y coordinates, which are
afba: dd e6 ae                     cmp     check_compare?+26,x ; overwritten based on move class during level init
afbd: d0 04                        bne     :Fail
afbf: e8                           inx
afc0: d0 f1                        bne     :Loop
afc2: 60                           rts

afc3: 4c 27 ae     :Fail           jmp     Start             ;start over

afc6: 2d 2a 20 43+                 .str    ‘-* COPYRIGHT 1983  DAMON SLYE *-’
                   ; 
                   ; Base names for the three sets of per-level files.
afe6: ec           lev_name_lo     .dd1    <TAFEC
afe7: f1                           .dd1    <TAFF1
afe8: f6                           .dd1    <TAFF6
afe9: af           lev_name_hi     .dd1    >TAFEC
afea: af                           .dd1    >TAFF1
afeb: af                           .dd1    >TAFF6
afec: cc c5 d6 b1  TAFEC           .str    “LEV1”
aff0: 2e                           .dd1    ‘.’
aff1: cf c2 ca b1  TAFF1           .str    “OBJ1”
aff5: 2e                           .dd1    ‘.’
aff6: c4 d9 ce b1  TAFF6           .str    “DYN1”
affa: 2e                           .dd1    ‘.’
affb: 8d ce c1 cd+                 .str    $8d,“NAME”

                   ; 
                   ; External entry points.
                   ; 
b000: 4c 3e b0     DiskInit        jmp     InitRwts

b003: 4c 86 b0     DiskReadFile    jmp     ReadFile

b006: 4c 04 b1     DiskWriteFile   jmp     WriteFile

                   ; 
                   ; RWTS parameter block.
                   ; 
b009: 01           rwts_param      .dd1    $01
b00a: 60           rwts_slot       .dd1    $60
b00b: 01           rwts_drive      .dd1    $01
b00c: 00                           .dd1    $00
b00d: 00           rwts_track      .dd1    $00
b00e: 01           rwts_sect       .dd1    $01
b00f: 1a b0                        .dd2    rwts_dct
b011: 00 b4        rwts_buf_ptr    .dd2    SECTOR_BUF_0
b013: 00                           .dd1    $00
b014: 00                           .dd1    $00
b015: 00           rwts_cmd        .dd1    $00
b016: 00           rwts_err        .dd1    $00
b017: 00                           .dd1    $00
b018: 60           rwts_slot_found .dd1    $60
b019: 01                           .dd1    $01
b01a: 00           rwts_dct        .dd1    $00
b01b: 01                           .dd1    $01
b01c: ef                           .dd1    $ef
b01d: d8                           .dd1    $d8
b01e: aa aa 55 55+ filename        .junk   30
b03c: 5d           cat_track       .dd1    $5d               ;track of first catalog sector (from VTOC)
b03d: 5d           cat_sector      .dd1    $5d               ;sector of first catalog sector (From VTOC)

                   ********************************************************************************
                   * Initializes the RWTS parameter block.                                        *
                   ********************************************************************************
b03e: 20 13 b2     InitRwts        jsr     SaveZeroPage
b041: 20 e3 03                     jsr     DOS_LOCRPL        ;loads Y/A with address of DOS IOB
b044: 84 04                        sty     ptr04
b046: 85 05                        sta     ptr04+1
b048: a0 0f                        ldy     #$0f              ;init RWTS params from copy in DOS
b04a: b1 04                        lda     (ptr04),y         ;get slot number found
b04c: 8d 0a b0                     sta     rwts_slot
b04f: 8d 18 b0                     sta     rwts_slot_found
b052: c8                           iny
b053: b1 04                        lda     (ptr04),y         ;get drive number found
b055: 8d 0b b0                     sta     rwts_drive
b058: 8d 19 b0                     sta     rwts_slot_found+1
b05b: a9 11                        lda     #17               ;catalog track
b05d: 8d 0d b0                     sta     rwts_track
b060: a9 00                        lda     #$00              ;VTOC sector
b062: 8d 0e b0                     sta     rwts_sect
b065: a9 00                        lda     #<SECTOR_BUF_1
b067: 8d 11 b0                     sta     rwts_buf_ptr
b06a: a9 b5                        lda     #>SECTOR_BUF_1
b06c: 8d 12 b0                     sta     rwts_buf_ptr+1
b06f: a9 01                        lda     #$01
b071: 8d 15 b0                     sta     rwts_cmd
b074: 20 25 b1                     jsr     CallRWTS          ;read VTOC
b077: ad 01 b5                     lda     SECTOR_BUF_1+1
b07a: 8d 3c b0                     sta     cat_track
b07d: ad 02 b5                     lda     SECTOR_BUF_1+2
b080: 8d 3d b0                     sta     cat_sector
b083: 4c 1e b2                     jmp     RestoreZeroPage

                   ********************************************************************************
                   * Reads a file from disk.                                                      *
                   *                                                                              *
                   * On entry:                                                                    *
                   *   $00/01: load address, or $0000 to use BIN addr                             *
                   *   $02/03: pointer to filename                                                *
                   ********************************************************************************
b086: 20 13 b2     ReadFile        jsr     SaveZeroPage
b089: 20 36 b1                     jsr     GetFileName
b08c: 20 4f b1                     jsr     FindFileInCatalog
b08f: 20 a2 b1                     jsr     ReadFirstSector   ;load first sector of file into $b400
b092: a5 00                        lda     load_addr         ;was a load address specified?
b094: 05 01                        ora     load_addr+1
b096: d0 0a                        bne     LB0A2             ;yes, use it
b098: ad 01 b4                     lda     SECTOR_BUF_0+1    ;no, use address embedded in BIN file
b09b: 85 01                        sta     load_addr+1
b09d: ad 00 b4                     lda     SECTOR_BUF_0
b0a0: 85 00                        sta     load_addr
b0a2: ad 03 b4     LB0A2           lda     SECTOR_BUF_0+3    ;get length from BIN file
b0a5: 85 09                        sta     file_length+1
b0a7: ad 02 b4                     lda     SECTOR_BUF_0+2
b0aa: 85 08                        sta     file_length
                   ; Shift the T/S buffer back 4 bytes.
b0ac: a0 04                        ldy     #$04
b0ae: b9 00 b4     :Loop           lda     SECTOR_BUF_0,y
b0b1: 99 fc b3                     sta     SECTOR_BUF_0-4,y
b0b4: c8                           iny
b0b5: d0 f7                        bne     :Loop
                   ; Copy what we've read to where it belongs.
b0b7: a0 fc                        ldy     #$fc
b0b9: a5 09                        lda     file_length+1
b0bb: d0 06                        bne     LB0C3
b0bd: c4 08                        cpy     file_length
b0bf: 90 02                        bcc     LB0C3
b0c1: a4 08                        ldy     file_length
b0c3: 84 0a        LB0C3           sty     $0a
b0c5: 20 e2 b1                     jsr     CopyPartialSect   ;copy what we read from $b404 to target addr
                   ; Update load address and file length.
b0c8: 18                           clc
b0c9: a5 00                        lda     load_addr
b0cb: 65 0a                        adc     $0a
b0cd: 85 00                        sta     load_addr
b0cf: a5 01                        lda     load_addr+1
b0d1: 69 00                        adc     #$00
b0d3: 85 01                        sta     load_addr+1
b0d5: 38                           sec
b0d6: a5 08                        lda     file_length
b0d8: e5 0a                        sbc     $0a
b0da: 85 08                        sta     file_length
b0dc: a5 09                        lda     file_length+1
b0de: e9 00                        sbc     #$00
b0e0: 85 09                        sta     file_length+1
                   ; Read file.
b0e2: a5 09        :ReadSectors    lda     file_length+1
b0e4: f0 0f                        beq     :HiDone
b0e6: 20 b0 b1                     jsr     ReadNextSector
b0e9: a0 00                        ldy     #$00
b0eb: 20 e2 b1                     jsr     CopyPartialSect
b0ee: e6 01                        inc     load_addr+1
b0f0: c6 09                        dec     file_length+1
b0f2: 4c e2 b0                     jmp     :ReadSectors

b0f5: a5 08        :HiDone         lda     file_length       ;partial sector remaining?
b0f7: f0 08                        beq     :Done             ;nope
b0f9: 20 b0 b1                     jsr     ReadNextSector    ;yup, read it
b0fc: a4 08                        ldy     file_length
b0fe: 20 e2 b1                     jsr     CopyPartialSect
b101: 4c 1e b2     :Done           jmp     RestoreZeroPage

                   ********************************************************************************
                   * Writes data to a file on disk.  Always writes 252 bytes.                     *
                   *                                                                              *
                   * On entry:                                                                    *
                   *   $00/01: data address                                                       *
                   *   $02/03: pointer to filename                                                *
                   ********************************************************************************
b104: 20 13 b2     WriteFile       jsr     SaveZeroPage
b107: 20 36 b1                     jsr     GetFileName
b10a: 20 4f b1                     jsr     FindFileInCatalog
b10d: 20 a2 b1                     jsr     ReadFirstSector
b110: a0 04                        ldy     #$04
b112: b1 00        :CopyLoop       lda     (load_addr),y
b114: 99 00 b4                     sta     SECTOR_BUF_0,y
b117: c8                           iny
b118: d0 f8                        bne     :CopyLoop
b11a: a9 02                        lda     #$02              ;write
b11c: 8d 15 b0                     sta     rwts_cmd
b11f: 20 25 b1                     jsr     CallRWTS
b122: 4c 1e b2                     jmp     RestoreZeroPage

b125: a0 09        CallRWTS        ldy     #<rwts_param
b127: a9 b0                        lda     #>rwts_param
b129: 20 d9 03                     jsr     DOS_RWTS
b12c: 90 07                        bcc     :Success
b12e: ad 15 b0                     lda     rwts_cmd
b131: c9 01                        cmp     #$01              ;was it a read?
b133: f0 f0                        beq     CallRWTS          ;retry forever
b135: 60           :Success        rts

b136: a9 a0        GetFileName     lda     #“ ”              ;pad with spaces
b138: a0 1d                        ldy     #29
b13a: 99 1e b0     :ClearLoop      sta     filename,y
b13d: 88                           dey
b13e: 10 fa                        bpl     :ClearLoop
b140: a0 00                        ldy     #$00              ;copy filename in
b142: b1 02        :CopyLoop       lda     (filename_ptr),y
b144: 10 08                        bpl     :Done             ;found non-high-ASCII char, bail
b146: 99 1e b0                     sta     filename,y
b149: c8                           iny
b14a: c0 1e                        cpy     #30
b14c: 90 f4                        bcc     :CopyLoop
b14e: 60           :Done           rts

                   ; 
                   ; Searches the catalog track for a matching entry.  If found, the T/S list will
                   ; be loaded.  If not found, this will spin forever.
                   ; 
                   ; On entry:
                   ;   filename in filename buffer
                   ; 
                   ; On exit:
                   ;   $b500-b5ff: T/S list
                   ; 
                   FindFileInCatalog
b14f: a9 01                        lda     #$01              ;read
b151: 8d 15 b0                     sta     rwts_cmd
b154: a9 b5                        lda     #>SECTOR_BUF_1    ;into buf at $b500
b156: 8d 12 b0                     sta     rwts_buf_ptr+1
b159: ad 3d b0                     lda     cat_sector        ;first T/S of catalog
b15c: 8d 0e b0                     sta     rwts_sect
b15f: ad 3c b0                     lda     cat_track
b162: 8d 0d b0                     sta     rwts_track
b165: 20 25 b1                     jsr     CallRWTS          ;read
b168: a9 0b        :FindFile       lda     #<SECTOR_BUF_1+11 ;first entry is at +11 bytes
b16a: 85 04                        sta     ptr04
b16c: a9 b5                        lda     #>SECTOR_BUF_1
b16e: 85 05                        sta     ptr04+1
b170: 20 ed b1     :CmpLoop        jsr     CheckForMatch
b173: b0 1d                        bcs     :Found
b175: 18                           clc
b176: a5 04                        lda     ptr04
b178: 69 23                        adc     #35               ;each entry is 35 bytes
b17a: 85 04                        sta     ptr04
b17c: 90 f2                        bcc     :CmpLoop
b17e: ad 01 b5                     lda     SECTOR_BUF_1+1    ;get track of next catalog sector
b181: f0 cc                        beq     FindFileInCatalog ;reached end; spin
b183: 8d 0d b0                     sta     rwts_track
b186: ad 02 b5                     lda     SECTOR_BUF_1+2    ;next catalog sector number
b189: 8d 0e b0                     sta     rwts_sect
b18c: 20 25 b1                     jsr     CallRWTS          ;read
b18f: 4c 68 b1                     jmp     :FindFile

b192: a0 00        :Found          ldy     #$00
b194: b1 04                        lda     (ptr04),y         ;T/S list track number
b196: 8d 0d b0                     sta     rwts_track
b199: c8                           iny
b19a: b1 04                        lda     (ptr04),y         ;T/S list sector number
b19c: 8d 0e b0                     sta     rwts_sect
b19f: 4c 25 b1                     jmp     CallRWTS          ;read T/S into $b500 and return

                   ; Sets up the pointer into the T/S list and falls into the read routine.
b1a2: a9 01        ReadFirstSector lda     #$01              ;read
b1a4: 8d 15 b0                     sta     rwts_cmd
b1a7: a9 b4                        lda     #>SECTOR_BUF_0
b1a9: 8d 12 b0                     sta     rwts_buf_ptr+1
b1ac: a9 0b                        lda     #$0b
b1ae: 85 06                        sta     ptr
                   ; Reads the next sector in the "open" file into $b400.
b1b0: a4 06        ReadNextSector  ldy     ptr
b1b2: c8                           iny
b1b3: d0 1b                        bne     LB1D0
b1b5: a9 b5                        lda     #$b5
b1b7: 8d 12 b0                     sta     rwts_buf_ptr+1
b1ba: ad 02 b5                     lda     SECTOR_BUF_1+2
b1bd: 8d 0e b0                     sta     rwts_sect
b1c0: ad 01 b5                     lda     SECTOR_BUF_1+1
b1c3: 8d 0d b0                     sta     rwts_track
b1c6: 20 25 b1                     jsr     CallRWTS
b1c9: a9 b4                        lda     #$b4
b1cb: 8d 12 b0                     sta     rwts_buf_ptr+1
b1ce: a0 0c                        ldy     #$0c
b1d0: b9 00 b5     LB1D0           lda     SECTOR_BUF_1,y    ;get track/sector from list
b1d3: 8d 0d b0                     sta     rwts_track
b1d6: c8                           iny
b1d7: b9 00 b5                     lda     SECTOR_BUF_1,y
b1da: 8d 0e b0                     sta     rwts_sect
b1dd: 84 06                        sty     ptr               ;save Y-reg
b1df: 4c 25 b1                     jmp     CallRWTS

b1e2: 88           CopyPartialSect dey
b1e3: b9 00 b4                     lda     SECTOR_BUF_0,y
b1e6: 91 00                        sta     (load_addr),y
b1e8: c0 00                        cpy     #$00
b1ea: d0 f6                        bne     CopyPartialSect
b1ec: 60                           rts

                   ; Returns with carry set on match.
b1ed: a0 00        CheckForMatch   ldy     #$00
b1ef: b1 04                        lda     (ptr04),y
b1f1: f0 1e                        beq     :Fail
b1f3: c9 ff                        cmp     #$ff
b1f5: f0 1a                        beq     :Fail
b1f7: a0 02                        ldy     #$02
b1f9: b1 04                        lda     (ptr04),y         ;check file type
b1fb: 29 7f                        and     #$7f
b1fd: c9 04                        cmp     #$04              ;BIN?
b1ff: d0 10                        bne     :Fail             ;nope
b201: a0 03                        ldy     #$03              ;check filename
b203: b1 04        :Loop           lda     (ptr04),y
b205: d9 1b b0                     cmp     filename-3,y
b208: d0 07                        bne     :Fail
b20a: c8                           iny
b20b: c0 21                        cpy     #33               ;reached end?
b20d: 90 f4                        bcc     :Loop
b20f: 38                           sec
b210: 60                           rts

b211: 18           :Fail           clc
b212: 60                           rts

b213: a2 00        SaveZeroPage    ldx     #$00
b215: b5 00        LB215           lda     load_addr,x
b217: 9d 29 b2                     sta     saved_dp,x
b21a: e8                           inx
b21b: d0 f8                        bne     LB215
b21d: 60                           rts

b21e: a2 00        RestoreZeroPage ldx     #$00
b220: bd 29 b2     LB220           lda     saved_dp,x
b223: 95 00                        sta     load_addr,x
b225: e8                           inx
b226: d0 f8                        bne     LB220
b228: 60                           rts

                   ; All 256 bytes of zero page are saved to $b229-b328.  (Not all of it is covered
                   ; by this file.)
b229: 55 aa aa 55+ saved_dp        .junk   215

Symbol Table

DiskInit$b000
DiskReadFile$b003
DiskWriteFile$b006
LoadFile$af60
LoadLevelFiles$af88