Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; ===========================================================================
- ; ---------------------------------------------------------------------------
- ; Boot Code (European Version)
- ; ---------------------------------------------------------------------------
- ; This boot code is required for Sonic CD to run on the Mega CD, altering it
- ; in any way will result in an unbootable Sonic CD ISO.
- ; This code is disassembled for research purposes only.
- ; This code gets transfered to FF0000 of the Mega Drive's RAM.
- ; The European BIOS is checked byte for byte from address $200 to $76D for
- ; any changes in the code, so anything after $76E will run fine.
- ; ---------------------------------------------------------------------------
- lea Boot_Data(pc),a1 ; load boot data address
- jsr ($0364).w ; run routine to display and perform the data at a1
- bra.w loc_76E ; continue to first address possible after security check.
- ; ===========================================================================
- ; ---------------------------------------------------------------------------
- ; Offset FF020C Boot Data (Palette, Art, Mappings, Music, etc)
- ; ---------------------------------------------------------------------------
- Boot_Data:
- dc.b $60 ; Palette buffer address to dump the palette to (+60 4th line)
- dc.b $0F ; Number of colours to dump (10 minus 1 for dbf)
- incbin "BootData/PalLogo.bin" ; Palette colour data
- even
- incbin "BootData/ArtLogo.nem" ; SEGA logo art
- even
- incbin "BootData/ArtSonic.nem" ; Sonic Art
- even
- dc.b $00,$00,$06,$03,$00,$00,$00,$01,$05,$10,$12,$C2,$04,$88,$50,$11 ; Enigma compressed plane mappings TODO.
- dc.b $04,$80,$14,$05,$10,$9A,$21,$54,$42,$60,$05,$05,$01,$34,$38,$11
- dc.b $40,$51,$11,$81,$14,$04,$01,$10,$20,$C5,$05,$01,$5C,$58,$02,$20
- dc.b $40,$1F,$02,$00,$88,$10,$07,$C3,$80,$C8,$04,$01,$A1,$38,$B4,$94
- dc.b $01,$00,$AC,$58,$0E,$20,$40,$1A,$13,$93,$B1,$A9,$A8,$1C,$5D,$8D
- dc.b $42,$E2,$68,$6C,$0F,$F0,$05,$00,$00,$00,$00,$00,$39,$0A,$41,$06
- dc.b $01,$81,$80,$90,$29,$AF,$F8
- dc.b 'PRODUCED BY OR UNDER LICENSE',$00 ; Raw mappings, byte each gets turned into word (00 = new line, FF = terminate)
- dc.b $00
- dc.b ' FROM SEGA ENTERPRISES, LTD.'
- dc.b $FF
- dc.b $14,$11,$08,$0D,$17,$11,$00,$0D,$14,$11,$14,$11,$90,$00,$00 ; Z80 sound driver general pointers (little-endian word).
- dc.b $00,$00,$1C,$14,$11,$80,$80,$80,$1D,$11,$00,$00,$00,$00
- include "BootData/MusicLogo.asm" ; SMPS music
- even
- ; ===========================================================================
- ; ---------------------------------------------------------------------------
- ; Offset FF076E - Start of Initial Program (IP) Code
- ; ---------------------------------------------------------------------------
- loc_76E:
- move.l #loc_82C+$FEFE00,($FFFFFD08).w ; Set the VBlank address.
- move.w #$FD0C,($A12006).l ; Set the HBlank address.
- move.l #loc_834+$FEFE00,($FFFFFD0E).w ; Set the HBlank address pointer ($FD0C-D contains the machine code for a long jump).
- loc_786:
- bset #$01,($A12003).l ; Give WRAM to the sub CPU.
- beq.s loc_786 ; Wait until it has been transferred properly.
- lea ($A12010).l,a0 ; Load the communications port into a0.
- moveq #$00,d0 ; clear d0
- move.b d0,-$02(a0) ; Clear communications ports.
- move.l d0,(a0)+ ; ''
- move.l d0,(a0)+ ; ''
- move.l d0,(a0)+ ; ''
- move.l d0,(a0)+ ; ''
- lea loc_7BE(pc),a0 ; load routine to be executed
- lea ($00FF1000).l,a1 ; load memory space where it is to be executed
- move.w #(loc_7BE_End-loc_7BE)-$01,d7 ; set repeat times
- loc_7B2:
- move.b (a0)+,(a1)+ ; dump instructions over to the memory
- dbf d7,loc_7B2 ; repeat til done
- jmp ($00FF1000).l ; execute instructions (loc_7BE).
- ; ===========================================================================
- ; ---------------------------------------------------------------------------
- ; Offset 7BE - (Gets loaded to 00FF1000 and is executed there)
- ; ---------------------------------------------------------------------------
- loc_7BE:
- moveq #$23,d0 ; Set the file in SPX___.BIN to load.
- jsr (loc_80C+$FEFE00).l ; Wait for the SCPU.
- movea.l ($200008).l,a0 ; Load the MMD entry point.
- move.l ($200002).l,d0 ; Load the RAM address value to copy WRAM values to. If there isn't one...
- beq.s loc_7E8 ; ...Skip the dumping.
- movea.l d0,a2 ; Set as an address.
- lea ($200100).l,a1 ; Load the source address to dump.
- move.w ($200006).l,d7 ; Get the size of the data block, divided by 4, minus 1.
- loc_7E2:
- move.l (a1)+,(a2)+ ; Dump 4 bytes into RAM.
- dbf d7,loc_7E2 ; Repeat until it is fully dumped.
- loc_7E8:
- move.l ($20000C).l,d0 ; Load the HBlank address area of the MMD.
- beq.s loc_7F4 ; If it is empty, branch.
- move.l d0,($FFFFFD0E).w ; Update HBlank address with the one in word RAM, from the MMD.
- loc_7F4:
- move.l ($200010).l,d0 ; Load the VBlank address area of the MMD.
- beq.s loc_800 ; If it is empty, branch.
- move.l d0,($FFFFFD08).w ; Update VBlank address with the one in word RAM, from the MMD.
- loc_800:
- bset #$01,($A12003).l ; Return WRAM to the sub CPU.
- beq.s loc_800 ; Loop until the bit has been set.
- jmp (a0) ; Jump to the MMD entry point address in word RAM.
- loc_7BE_End:
- ; ===========================================================================
- ; ---------------------------------------------------------------------------
- ; Offset FF080C Unknown Routine
- ; ---------------------------------------------------------------------------
- loc_80C:
- move.w d0,($A12010).l ; Set file to load.
- loc_812:
- tst.w ($A12020).l ; Has the Sub CPU been ran (has the file been loaded in SPX___.asm)?
- beq.s loc_812 ; If it hasn't, loop until it has.
- move.w #$0000,($A12010).l ; Clear the register.
- loc_822:
- tst.w ($A12020).l ; Has the Sub CPU been ran?
- bne.s loc_822 ; If it hasn't, loop until it has.
- rts ; Return.
- ; ===========================================================================
- ; ---------------------------------------------------------------------------
- ; Offset FF082C - Initial Program Exception Handlers
- ; ---------------------------------------------------------------------------
- loc_82C:
- bset #$00,($A12000).l ; Run the sub CPU.
- loc_834:
- rte ; return
- ; ===========================================================================
- ; ---------------------------------------------------------------------------
- ; Offset FF0FFE - Unknown Data
- ; ---------------------------------------------------------------------------
- align $0FFE
- dc.w $0109
- align $1000
- ; ===========================================================================
- ; ===========================================================================
- ; ---------------------------------------------------------------------------
- ; Main (Offset 1000)
- ; ---------------------------------------------------------------------------
- ; Start of SP init code:-
- Main: dc.b 'MAIN '
- dc.b $00 ; Zero-terminated.
- dc.l $00000000
- dc.l $00000000
- dc.l SP_End-Main ; Set size of SP code block.
- dc.l SPTable-Main ; Set distance to SP table.
- dc.l $00000000
- SPTable:
- dc.w SP_Start-SPTable ; Address distance to the SP initialisation routine.
- dc.w SP_Main-SPTable ; Address distance to the SP main routine.
- dc.w Level2Int-SPTable ; Address distance to the Level 2 interrupt routine.
- dc.w SP_User-SPTable ; Address distance to the SP user routine.
- dc.w $0000 ; /
- ; ===========================================================================
- ; ---------------------------------------------------------------------------
- ; Offset 00102A
- ; ---------------------------------------------------------------------------
- SP_Start:
- lea ($FFFF8020).w,a0 ; Load the communications register space to a0.
- moveq #$00,d0 ; Clear d0.
- move.b d0,-$11(a0) ; Clear the communications port (except for the set MCPU flag).
- move.l d0,(a0)+ ; ''
- move.l d0,(a0)+ ; ''
- move.l d0,(a0)+ ; ''
- move.l d0,(a0)+ ; ''
- lea unk_106A(pc),a0 ; Load the drive table of contents into a0.
- move.w #$0010,d0 ; Set to run that BIOS function.
- jsr ($5F22).w ; Run that BIOS function.
- loc_1048: ; CODE XREF: ROM:00001056j
- move.w #$81,d0 ; Get CD BIOS status.
- jsr ($5F22).w ; Run that BIOS function.
- andi.b #$F0,($5E80).w ; Check the CD status output, to see if the CD is ready (i.e. not reading TOC, tray closed, with a disk).
- bne.s loc_1048 ; If it isn't, loop.
- andi.b #$FA,($FFFF8003).w ; Set MCD mode 2.
- move.w #0,d0 ; Set to initialise the VInt routine address.
- jsr (JT1+$5000).l ; Run that routine.
- SP_User:
- rts ; Run SP_Main.
- ; ---------------------------------------------------------------------------
- unk_106A: dc.b $01 ; First entry of the drive table.
- dc.b $FF ; Read until the last track.
- aSpx____bin1: dc.b 'SPX___.BIN',';1'
- aSpx____bin_End:
- dc.w $0000
- ; ---------------------------------------------------------------------------
- SP_Main:
- move.w #3,d0 ; Load init routine 3: Set to initialise the directory on the next call.
- jsr (JT1+$5000).l ; Run the routine.
- loc_1084: ; CODE XREF: ROM:00001092j
- jsr ($5F10).w ; Wait for VBlank. //
- move.w #2,d0 ; Load init routine 2. TODO
- jsr (JT1+$5000).l ; Check to see if VBlank has ran.
- bcs.s loc_1084 ; If it hasn't, branch. TODO
- cmpi.w #$64,d0 ; 'd'
- bne.w loc_10B6
- lea aSpx____bin1(pc),a0 ; "SPX___.BIN;1"
- lea ($B800).l,a1 ; Load RAM to dump to.
- jsr (loc_2800+$5000).w
- lea ($10000).l,sp ; Set as stack.
- jmp (SPX_Start+$B800).l ; Run SPX___.BIN at offset +$800. TODO IMPORTANT: SPX DOESN'T START FROM 0, ORG IT!
- ; ---------------------------------------------------------------------------
- loc_10B6: ; CODE XREF: ROM:00001098j
- ; ROM:000010BAj
- nop
- nop
- bra.s loc_10B6
- ; ---------------------------------------------------------------------------
- align $2400
- ; ===========================================================================
- ; ---------------------------------------------------------------------------
- ; Other Data (Offset 2400)
- ; ---------------------------------------------------------------------------
- loc_2400:
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 5
- dc.b 0
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $B
- dc.b $B
- dc.b $B
- dc.b 0
- dc.b $23 ; #
- dc.b $19
- dc.b $1F
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b $10
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- ; ---------------------------------------------------------------------------
- ; Sub CPU VBlank pointer.
- Level2Int:
- movem.l d0-a6,-(sp) ; Store used registers onto the stack.
- move.w #1,d0 ; Load init routine 1.
- jsr (JT1+$5000).l ; Run it.
- movem.l (sp)+,d0-a6 ; Restore register values.
- rts ; Return from L2 int.
- ; ---------------------------------------------------------------------------
- align $800
- ; ---------------------------------------------------------------------------
- loc_2800: ; CODE XREF: ROM:0000281Ej
- move.w #4,d0
- jsr (JT1+$5000).l
- loc_280A: ; CODE XREF: ROM:00002818j
- jsr ($5F10).w
- move.w #2,d0
- jsr (JT1+$5000).l
- bcs.s loc_280A
- cmpi.w #$64,d0 ; 'd'
- bne.w loc_2800
- rts
- ; ---------------------------------------------------------------------------
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- ; ---------------------------------------------------------------------------
- mulu.w #$D,d0
- lea ($B800).l,a0
- adda.w d0,a0
- rts
- ; ---------------------------------------------------------------------------
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- dc.b 0
- ; ---------------------------------------------------------------------------
- JT1:
- movem.l a0-a6,-(sp) ; Store address registers onto the stack.
- lea ($8C00).l,a5 ; Load buffer RAM space.
- add.w d0,d0 ; Double routine value.
- move.w word_289A(pc,d0.w),d0 ; Get the routine distance.
- jsr word_289A(pc,d0.w) ; Jump there.
- movem.l (sp)+,a0-a6 ; Restore register values.
- rts ; Return.
- ; ---------------------------------------------------------------------------
- word_289A: dc.w VBInit-word_289A
- dc.w UnkSub2-word_289A
- dc.w UnkSub4-word_289A
- dc.w UnkSub1-word_289A
- dc.w UnkSub5-word_289A
- dc.w sub_2A94-word_289A
- dc.w UnkSub6-word_289A
- dc.w UnkSub7-word_289A
- dc.w UnkSub8-word_289A
- ; ---------------------------------------------------------------------------
- UnkSub1:
- move.w #1,$1C(a5) ; Set to initialise directory on next VBlank call.
- move.b #$80,$2A03(a5) ; TODO
- move.l #0,$2A04(a5) ; TODO
- rts ; Return.
- ; =============== S U B R O U T I N E =======================================
- ; VBlank initialisation routine.
- VBInit: ; CODE XREF: ROM:000031D0p
- move.l #loc_28D8+$5000,0(a5) ; Store the address (VBlank) in that section.
- move.w #0,$1C(a5) ; Set the VBlank routine to 0.
- rts ; Return.
- ; End of function VBInit
- ; ---------------------------------------------------------------------------
- UnkSub2:
- movea.l 0(a5),a0 ; Load the VBlank routine address into a0 (loc_28D8).
- jmp (a0) ; Run it.
- ; ---------------------------------------------------------------------------
- loc_28D8: ; CODE XREF: ROM:000029E4j
- ; ROM:00002A3Ej ...
- bsr.w sub_28F4 ; TODO
- loc_28DC:
- move.w $1C(a5),d0 ; Load the VBlank routine into d0.
- add.w d0,d0 ; Double it for word tables.
- move.w word_28EA(pc,d0.w),d0
- jmp word_28EA(pc,d0.w)
- ; ---------------------------------------------------------------------------
- word_28EA: dc.w loc_28D8-word_28EA
- dc.w InitDirectory-word_28EA
- dc.w loc_29F0-word_28EA
- dc.w $3B8
- dc.w $6D6
- ; =============== S U B R O U T I N E =======================================
- sub_28F4: ; CODE XREF: ROM:loc_28D8p
- ; ReadCD:loc_2B4Ap ...
- move.l (sp)+,0(a5) ;
- rts ; Return.
- ; End of function sub_28F4
- ; ---------------------------------------------------------------------------
- InitDirectory:
- move.b #3,$28(a5) ; CDC register - DBCH.
- move.l #$10,4(a5) ; Set to load the directory record table ($10 * $800 = $8000).
- move.l #1,8(a5) ; Set to load 1 sector.
- lea $2100(a5),a0 ; Set to dump to address $AD00.
- move.l a0,$10(a5) ; Store to the destination address buffer.
- bsr.w ReadCD ; Write the data from the CD.
- cmpi.w #$FF9C,$1E(a5) ;
- beq.w loc_29E8
- lea $2100(a5),a1 ; Load the directory record table address.
- move.l $A2(a1),4(a5) ; Get the big endian sector location of the main directory.
- move.l $AA(a1),d0 ; Get the big endian length of the table.
- divu.w #$800,d0 ; Divide by $800 to get the size in sectors.
- swap d0 ; Check the remainder (a valid sector size will be divisible by $800, and hence have a remainder of 0).
- tst.w d0 ; Is there a remainder value?
- beq.s loc_2944 ; If there isn't, branch.
- addi.l #$10000,d0 ; If there is, round upwards to the nearest sector size.
- loc_2944: ; CODE XREF: ROM:0000293Cj
- swap d0 ; Restore the sector address.
- move.w d0,$18(a5) ; Store in RAM.
- clr.w $20(a5) ; Clear directory record counter.
- loc_294E: ; CODE XREF: ROM:000029D4j
- move.l #1,8(a5) ; Set to load 1 sector.
- lea $2100(a5),a1 ; Set to dump to address $AD00.
- move.l a1,$10(a5) ; Store to the destination address buffer.
- bsr.w ReadCD ; Load the main directory at $AD00.
- cmpi.w #$FF9C,$1E(a5) ;
- beq.w loc_29E8
- lea $100(a5),a0 ; Load buffer space address.
- move.w $20(a5),d0 ; Get directory record counter entry.
- mulu.w #$20,d0 ; Each entry is allocated $20 bytes.
- adda.l d0,a0 ; Find the base entry.
- lea $2100(a5),a1 ; Load the dumped main directory.
- moveq #0,d0 ; Clear d0.
- loc_2980: ; CODE XREF: ROM:000029CEj
- move.b 0(a1),d0 ; Get the length of the TODO.
- beq.s loc_29D0 ; If there's no length, branch.
- move.b $19(a1),$17(a0) ; Copy the file flags into the buffer.
- moveq #0,d1 ; Clear d1.
- loc_298E: ; CODE XREF: ROM:000029A0j
- move.b 6(a1,d1.w),$18(a0,d1.w) ; Copy the first address byte into the buffer.
- move.b $E(a1,d1.w),$1C(a0,d1.w) ; Copy the first byte of the table length.
- addq.w #1,d1 ; Set to load the successive byte.
- cmpi.w #4,d1 ; Has a full longword been written?
- blt.s loc_298E ; If not, loop until it has.
- moveq #0,d1 ; Clear d1.
- loc_29A4: ; CODE XREF: ROM:000029B0j
- move.b $21(a1,d1.w),(a0,d1.w) ; Get the first character of the file name.
- addq.w #1,d1 ; Set to load the next character.
- cmp.b $20(a1),d1 ; Is there any more characters left to write?
- blt.s loc_29A4 ; If there are, loop.
- loc_29B2: ; CODE XREF: ROM:000029C0j
- cmpi.b #$C,d1 ; Have $D characters been written?
- bge.s loc_29C2 ; If they have, branch.
- move.b #$20,(a0,d1.w) ; Fill in the rest with blank spaces.
- addq.w #1,d1 ; Load the next character space.
- bra.s loc_29B2 ; Loop until $D characters have been written.
- ; ---------------------------------------------------------------------------
- loc_29C2: ; CODE XREF: ROM:000029B6j
- addq.w #1,$20(a5) ; Set to load the next main directory record.
- adda.l d0,a1 ; Get the next MD address.
- adda.l #$20,a0 ; Load the next entry in the buffer.
- bra.s loc_2980 ; Repeat.
- ; ---------------------------------------------------------------------------
- loc_29D0: ; CODE XREF: ROM:00002984j
- subq.w #1,$18(a5) ; Subtract 1 from the table length.
- bne.w loc_294E
- move.w #$64,$1E(a5) ; 'd'
- loc_29DE: ; CODE XREF: ROM:000029EEj
- move.w #0,$1C(a5) ; Set the VBlank routine to 0.
- bra.w loc_28D8
- ; ---------------------------------------------------------------------------
- loc_29E8: ; CODE XREF: ROM:00002922j
- ; ROM:00002968j
- move.w #$FFFF,$1E(a5)
- bra.s loc_29DE
- ; ---------------------------------------------------------------------------
- loc_29F0:
- move.b #3,$28(a5) ; CDC register - DBCH.
- lea $2A(a5),a0 ; Load the string buffer address.
- bsr.w sub_2A94
- bcs.w loc_2A42
- move.l $18(a0),4(a5)
- move.l $1C(a0),d1
- move.l d1,$18(a5)
- move.l #1,8(a5)
- loc_2A18: ; CODE XREF: ROM:00002A24j
- subi.l #$800,d1
- ble.s loc_2A26
- addq.l #1,8(a5)
- bra.s loc_2A18
- ; ---------------------------------------------------------------------------
- loc_2A26: ; CODE XREF: ROM:00002A1Ej
- bsr.w ReadCD
- cmpi.w #$64,$1E(a5) ; 'd'
- beq.s loc_2A38
- move.w #$FFFD,$1E(a5)
- loc_2A38: ; CODE XREF: ROM:00002A30j
- ; ROM:00002A48j
- move.w #0,$1C(a5)
- bra.w loc_28D8
- ; ---------------------------------------------------------------------------
- loc_2A42: ; CODE XREF: ROM:000029FEj
- move.w #$FFFE,$1E(a5)
- bra.s loc_2A38
- ; ---------------------------------------------------------------------------
- UnkSub4:
- cmpi.w #0,$1C(a5) ; Is the TODO routine set to 0?
- bne.s loc_2A72 ; If not, branch.
- move.w $1E(a5),d0
- cmpi.w #$64,d0 ; 'd'
- bne.s loc_2A62
- move.l $18(a5),d1
- bra.s loc_2A6C
- ; ---------------------------------------------------------------------------
- loc_2A62: ; CODE XREF: ROM:00002A5Aj
- cmpi.w #$FFFD,d0
- bne.s loc_2A6C
- move.w $26(a5),d1
- loc_2A6C: ; CODE XREF: ROM:00002A60j
- ; ROM:00002A66j
- move #0,ccr
- rts
- ; ---------------------------------------------------------------------------
- loc_2A72: ; CODE XREF: ROM:00002A50j
- move #1,ccr ; Branch on bcs.
- rts ; Return.
- ; ---------------------------------------------------------------------------
- UnkSub5:
- move.w #2,$1C(a5)
- move.l a1,$10(a5) ; $B800
- movea.l a0,a1
- lea $2A(a5),a2
- move.w #(aSpx____bin1-aSpx____bin_End)-1,d1
- loc_2A8C: ; CODE XREF: ROM:00002A8Ej
- move.b (a1)+,(a2)+ ; Dump a character into the buffer.
- dbf d1,loc_2A8C ; Repeat for the number of characters.
- rts ; Return.
- ; =============== S U B R O U T I N E =======================================
- sub_2A94: ; CODE XREF: ROM:000029FAp
- ; ROM:00002CACp ...
- move.l a2,-(sp) ; Store d2 onto the stack.
- moveq #0,d1 ; Clear d1.
- movea.l a0,a1 ; Copy string buffer to a1.
- move.w #$A,d0 ; Set to check $B characters.
- loc_2A9E: ; CODE XREF: sub_2A94+1Ej
- tst.b (a1) ; Is the first character empty?
- beq.s loc_2AB6 ; If it is, branch.
- cmpi.b #$3B,(a1) ; Is the character a semi-colon (;)?
- beq.s loc_2AB6 ; If it is, branch.
- cmpi.b #$20,(a1) ; Is the character a blank space?
- beq.s loc_2AB6 ; If it is, branch.
- addq.w #1,d1
- addq.w #1,a1 ; Load the next character.
- dbf d0,loc_2A9E ; Check the next character.
- loc_2AB6: ; CODE XREF: sub_2A94+Cj sub_2A94+12j ...
- move.w $20(a5),d0
- movea.l a0,a1 ; Restore string buffer starting address.
- lea $100(a5),a0
- lea InvalidChars(pc),a2
- bsr.w sub_2C5C
- beq.w loc_2AE4
- movea.l a0,a2
- subq.w #1,d0
- loc_2AD0: ; CODE XREF: sub_2A94+46j
- bsr.w sub_2C5C
- beq.s loc_2AE0
- adda.w #$20,a2 ; ' '
- dbf d0,loc_2AD0
- bra.s loc_2AE8
- ; ---------------------------------------------------------------------------
- loc_2AE0: ; CODE XREF: sub_2A94+40j
- moveq #1,d0
- movea.l a2,a0
- loc_2AE4: ; CODE XREF: sub_2A94+34j sub_2A94+58j
- movea.l (sp)+,a2
- rts
- ; ---------------------------------------------------------------------------
- loc_2AE8: ; CODE XREF: sub_2A94+4Aj
- move #1,ccr
- bra.s loc_2AE4
- ; End of function sub_2A94
- ; =============== S U B R O U T I N E =======================================
- InvalidChars: ; DATA XREF: sub_2A94+2Co
- dc.b '\ ',0
- ; =============== S U B R O U T I N E =======================================
- ReadCD: ; CODE XREF: ROM:00002918p
- ; ROM:0000295Ep ...
- move.l (sp)+,$C(a5)
- move.w #0,$26(a5)
- move.w #$1E,$24(a5) ; Set to repeat routine $1E times in case of data error.
- loc_2B0A: ; CODE XREF: ReadCD+68j ReadCD+8Cj ...
- move.b $28(a5),($FF8004).l ; Set CDC register address.
- lea 4(a5),a0 ; \\
- move.l (a0),d0
- divu.w #$4B,d0 ; 'K'
- swap d0
- ext.l d0
- divu.w #$A,d0 ; 00060001
- move.b d0,d1 ; 00000001
- lsl.b #4,d1 ; 00000010
- swap d0 ; 00010006
- move #0,ccr ; Clear any set CCR flags for abcd.
- abcd d1,d0 ; 00010016
- move.b d0,$29(a5) ; TODO - Time?
- move.w #$89,d0 ; CDCSTOP function.
- jsr ($5F22).w ; Run the function; throw out the current sector.
- move.w #$20,d0 ; ' ' ; ROMREADN function.
- jsr ($5F22).w ; Run the function; TODO IMPORTANT.
- move.w #$258,$22(a5) ; Set to check $258 times in case of data preparation delay.
- loc_2B4A: ; CODE XREF: ReadCD+62j
- bsr.w sub_28F4
- loc_2B4E: ; CODE XREF: ReadCD+126j
- move.w #$8A,d0 ; CDCSTAT function.
- jsr ($5F22).w ; Run the function; check to see if the data has been prepared.
- bcc.s loc_2B68 ; If the data has been prepared, branch.
- subq.w #1,$22(a5) ; Subtract from the preparation delay counter.
- bge.s loc_2B4A ; If it hasn't depleted, repeat.
- subq.w #1,$24(a5) ; Subtract from data error counter.
- bge.s loc_2B0A ; Repeat routine again if not depleted.
- bra.w loc_2C38 ; TODO - It returns.
- ; ---------------------------------------------------------------------------
- loc_2B68: ; CODE XREF: ReadCD+5Cj
- move.w #$8B,d0 ; CDCREAD function.
- jsr ($5F22).w ; Read the frame of data.
- bcs.w loc_2B82 ; If the prepared data is not present, branch.
- move.l d0,$14(a5) ; Store the header time (mm|ss|ff|MD).
- move.b $29(a5),d0 ;
- cmp.b $16(a5),d0 ; Do the frames match?
- beq.s loc_2B8E ; If they do, branch.
- ;
- loc_2B82: ; CODE XREF: ReadCD+76j
- subq.w #1,$24(a5) ; Subtract from the data error counter.
- bge.w loc_2B0A ; Repeat routine again if not depleted.
- bra.w loc_2C38 ; TODO - It returns.
- ; ---------------------------------------------------------------------------
- loc_2B8E: ; CODE XREF: ReadCD+86j
- move.w #$7FF,d0 ; Set to check $7FF times.
- loc_2B92: ; CODE XREF: ReadCD+A0j
- btst #6,($FF8004).l ; Has the data been set in RS1?
- dbne d0,loc_2B92 ; If it hasn't, loop until it has / $7FF times.
- bne.s loc_2BAC ; Branch if it has been set.
- subq.w #1,$24(a5) ; If it hasn't, subtract from the data error counter.
- bge.w loc_2B0A ; Repeat routine again if not completed.
- bra.w loc_2C38 ; TODO - It returns.
- ; ---------------------------------------------------------------------------
- loc_2BAC: ; CODE XREF: ReadCD+A4j
- cmpi.b #2,$28(a5)
- beq.w loc_2C40
- move.w #$8C,d0 ; CDCTRN function.
- movea.l $10(a5),a0 ; Set the data destination.
- lea $14(a5),a1 ; Load the header address.
- jsr ($5F22).w
- bcs.s loc_2BD2 ; If the data transfer isn't complete, branch.
- move.b $29(a5),d0
- cmp.b $16(a5),d0
- beq.s loc_2BDE
- loc_2BD2: ; CODE XREF: ReadCD+CCj
- subq.w #1,$24(a5)
- bge.w loc_2B0A
- bra.w loc_2C38
- ; ---------------------------------------------------------------------------
- loc_2BDE: ; CODE XREF: ReadCD+D6j
- move #0,ccr ; Clear the status flags.
- moveq #1,d1
- abcd d1,d0
- move.b d0,$29(a5) ; Store
- cmpi.b #$75,$29(a5)
- bcs.s loc_2BF8
- move.b #0,$29(a5)
- loc_2BF8: ; CODE XREF: ReadCD+F6j
- ; ReadCD+158j
- move.w #$8D,d0 ; CDCACK function.
- jsr ($5F22).w ; Stop reading the frame.
- move.w #6,$22(a5) ;
- move.w #$1E,$24(a5)
- addi.l #$800,$10(a5) ; Load next block of memory to dump next sector.
- addq.w #1,$26(a5)
- addq.l #1,4(a5)
- subq.l #1,8(a5) ; Subtract from the number of sectors to load.
- bgt.w loc_2B4E ; If there's any left, branch.
- move.w #$64,$1E(a5) ; 'd'
- loc_2C2A: ; CODE XREF: ReadCD+144j
- move.b $28(a5),($FF8004).l ; Write to CDC register address (CA0/1) TODO - Check the LC89510 Sanyo manual TODO 2 - WTF is that?
- movea.l $C(a5),a0 ;
- jmp (a0) ;
- ; ---------------------------------------------------------------------------
- loc_2C38: ; CODE XREF: ReadCD+6Aj ReadCD+90j ...
- move.w #$FF9C,$1E(a5)
- bra.s loc_2C2A
- ; ---------------------------------------------------------------------------
- loc_2C40: ; CODE XREF: ReadCD+B8j
- move.w #6,$22(a5)
- loc_2C46: ; CODE XREF: ReadCD+15Ej
- bsr.w sub_28F4
- btst #7,($FF8004).l
- bne.s loc_2BF8
- subq.w #1,$22(a5)
- bge.s loc_2C46
- bra.s loc_2C38
- ; End of function ReadCD
- ; =============== S U B R O U T I N E =======================================
- sub_2C5C: ; CODE XREF: sub_2A94+30p
- ; sub_2A94:loc_2AD0p
- movem.l d1/a1-a2,-(sp)
- loc_2C60: ; CODE XREF: sub_2C5C+8j
- cmpm.b (a1)+,(a2)+ ; Is the character an invalid character for that section of the filename?
- bne.s loc_2C6A ;
- dbf d1,loc_2C60
- moveq #0,d1
- loc_2C6A: ; CODE XREF: sub_2C5C+6j
- movem.l (sp)+,d1/a1-a2
- rts
- ; End of function sub_2C5C
- ; ---------------------------------------------------------------------------
- UnkSub6:
- move.b #$80,$2A03(a5)
- move.w #3,$1C(a5)
- move.l #$40000,$10(a5)
- move.w #0,$2A00(a5)
- bset #7,$2A03(a5)
- movea.l a0,a1
- lea $2A(a5),a2
- move.w #$B,d1
- loc_2C9A: ; CODE XREF: ROM:00002C9Cj
- move.b (a1)+,(a2)+
- dbf d1,loc_2C9A
- rts
- ; ---------------------------------------------------------------------------
- move.b #3,$28(a5)
- lea $2A(a5),a0
- bsr.w sub_2A94
- bcs.w loc_2CF4
- move.l $18(a0),4(a5)
- move.l $1C(a0),d1
- move.l d1,$18(a5)
- move.l #1,8(a5)
- loc_2CCA: ; CODE XREF: ROM:00002CD6j
- subi.l #$800,d1
- ble.s loc_2CD8
- addq.l #1,8(a5)
- bra.s loc_2CCA
- ; ---------------------------------------------------------------------------
- loc_2CD8: ; CODE XREF: ROM:00002CD0j
- bsr.w sub_2CFC
- cmpi.w #$64,$1E(a5) ; 'd'
- beq.s loc_2CEA
- move.w #$FFFD,$1E(a5)
- loc_2CEA: ; CODE XREF: ROM:00002CE2j
- ; ROM:00002CFAj
- move.w #0,$1C(a5)
- bra.w loc_28D8
- ; ---------------------------------------------------------------------------
- loc_2CF4: ; CODE XREF: ROM:00002CB0j
- move.w #$FFFE,$1E(a5)
- bra.s loc_2CEA
- ; =============== S U B R O U T I N E =======================================
- sub_2CFC: ; CODE XREF: ROM:loc_2CD8p
- move.l (sp)+,$C(a5)
- move.w #0,$26(a5)
- move.w #$A,$24(a5)
- loc_2D0C: ; CODE XREF: sub_2CFC+68j sub_2CFC+90j ...
- move.b $28(a5),($FF8004).l
- lea 4(a5),a0
- move.l (a0),d0
- divu.w #$4B,d0 ; 'K'
- swap d0
- ext.l d0
- divu.w #$A,d0
- move.b d0,d1
- lsl.b #4,d1
- swap d0
- move #0,ccr
- abcd d1,d0
- move.b d0,$29(a5)
- move.w #$89,d0 ; '‰'
- jsr ($5F22).w
- move.w #$20,d0 ; ' '
- jsr ($5F22).w
- move.w #$258,$22(a5)
- loc_2D4C: ; CODE XREF: sub_2CFC+62j
- bsr.w sub_28F4
- loc_2D50: ; CODE XREF: sub_2CFC+1B6j
- move.w #$8A,d0 ; 'Š'
- jsr ($5F22).w
- bcc.s loc_2D6A
- subq.w #1,$22(a5)
- bge.s loc_2D4C
- subq.w #1,$24(a5)
- bge.s loc_2D0C
- bra.w loc_2ECA
- ; ---------------------------------------------------------------------------
- loc_2D6A: ; CODE XREF: sub_2CFC+5Cj
- move.w #$8B,d0 ; '‹'
- jsr ($5F22).w
- bcs.w loc_2D84
- move.l d0,$14(a5)
- move.b $29(a5),d0
- cmp.b $16(a5),d0
- beq.s loc_2D94
- loc_2D84: ; CODE XREF: sub_2CFC+76j
- addq.l #1,$2A04(a5)
- subq.w #1,$24(a5)
- bge.w loc_2D0C
- bra.w loc_2ECA
- ; ---------------------------------------------------------------------------
- loc_2D94: ; CODE XREF: sub_2CFC+86j
- move.w #$7FF,d0
- loc_2D98: ; CODE XREF: sub_2CFC+A4j
- btst #6,($FF8004).l
- dbne d0,loc_2D98
- bne.s loc_2DB2
- subq.w #1,$24(a5)
- bge.w loc_2D0C
- bra.w loc_2ECA
- ; ---------------------------------------------------------------------------
- loc_2DB2: ; CODE XREF: sub_2CFC+A8j
- cmpi.b #2,$28(a5)
- beq.w loc_2F74
- move.w #$8C,d0 ; 'Œ'
- movea.l $10(a5),a0
- lea $14(a5),a1
- jsr ($5F22).w
- bcs.s loc_2DD8
- move.b $29(a5),d0
- cmp.b $16(a5),d0
- beq.s loc_2DE8
- loc_2DD8: ; CODE XREF: sub_2CFC+D0j
- addq.l #1,$2A04(a5)
- subq.w #1,$24(a5)
- bge.w loc_2D0C
- bra.w loc_2ECA
- ; ---------------------------------------------------------------------------
- loc_2DE8: ; CODE XREF: sub_2CFC+DAj
- move #0,ccr
- moveq #1,d1
- abcd d1,d0
- move.b d0,$29(a5)
- cmpi.b #$75,$29(a5) ; 'u'
- bcs.s loc_2E02
- move.b #0,$29(a5)
- loc_2E02: ; CODE XREF: sub_2CFC+FEj
- ; sub_2CFC+28Aj
- move.w #$8D,d0 ; ''
- jsr ($5F22).w
- move.w #6,$22(a5)
- move.w #$A,$24(a5)
- move.w $2A00(a5),d0
- cmpi.w #$F,d0
- beq.s loc_2E32
- cmpi.w #$4A,d0 ; 'J'
- beq.s loc_2E4A
- addi.l #$800,$10(a5)
- bra.w loc_2E94
- ; ---------------------------------------------------------------------------
- loc_2E32: ; CODE XREF: sub_2CFC+122j
- move.b #1,$2A02(a5)
- bclr #7,$2A03(a5)
- move.l #$C0000,$10(a5)
- bra.w loc_2E94
- ; ---------------------------------------------------------------------------
- loc_2E4A: ; CODE XREF: sub_2CFC+128j
- bset #0,($FFFF800F).w
- bset #7,$2A03(a5)
- bset #5,$2A03(a5)
- loc_2E5C: ; CODE XREF: sub_2CFC+166j
- ; sub_2CFC+16Ej
- btst #0,($FFFF800E).w
- beq.s loc_2E5C
- btst #0,($FFFF800E).w
- beq.s loc_2E5C
- bclr #0,($FFFF800F).w
- bchg #0,($FFFF8003).w
- loc_2E78: ; CODE XREF: sub_2CFC+182j
- btst #1,($FFFF8003).w
- bne.s loc_2E78
- move.b #0,$2A02(a5)
- move.l #$40000,$10(a5)
- bset #7,$2A03(a5)
- loc_2E94: ; CODE XREF: sub_2CFC+132j
- ; sub_2CFC+14Aj
- addq.w #1,$26(a5)
- addq.l #1,4(a5)
- addq.w #1,$2A00(a5)
- cmpi.w #$4B,$2A00(a5) ; 'K'
- bcs.s loc_2EAE
- move.w #0,$2A00(a5)
- loc_2EAE: ; CODE XREF: sub_2CFC+1AAj
- subq.l #1,8(a5)
- bgt.w loc_2D50
- move.w #$64,$1E(a5) ; 'd'
- loc_2EBC: ; CODE XREF: sub_2CFC+274j
- move.b $28(a5),($FF8004).l
- movea.l $C(a5),a0
- jmp (a0)
- ; ---------------------------------------------------------------------------
- loc_2ECA: ; CODE XREF: sub_2CFC+6Aj sub_2CFC+94j ...
- move.w $2A00(a5),d0
- cmpi.w #$F,d0
- beq.s loc_2EE6
- cmpi.w #$4A,d0 ; 'J'
- beq.s loc_2EFE
- addi.l #$800,$10(a5)
- bra.w loc_2F48
- ; ---------------------------------------------------------------------------
- loc_2EE6: ; CODE XREF: sub_2CFC+1D6j
- move.b #1,$2A02(a5)
- bclr #7,$2A03(a5)
- move.l #$C0000,$10(a5)
- bra.w loc_2F48
- ; ---------------------------------------------------------------------------
- loc_2EFE: ; CODE XREF: sub_2CFC+1DCj
- bset #0,($FFFF800F).w
- bset #7,$2A03(a5)
- bset #5,$2A03(a5)
- loc_2F10: ; CODE XREF: sub_2CFC+21Aj
- ; sub_2CFC+222j
- btst #0,($FFFF800E).w
- beq.s loc_2F10
- btst #0,($FFFF800E).w
- beq.s loc_2F10
- bclr #0,($FFFF800F).w
- bchg #0,($FFFF8003).w
- loc_2F2C: ; CODE XREF: sub_2CFC+236j
- btst #1,($FFFF8003).w
- bne.s loc_2F2C
- move.b #0,$2A02(a5)
- move.l #$40000,$10(a5)
- bset #7,$2A03(a5)
- loc_2F48: ; CODE XREF: sub_2CFC+1E6j
- ; sub_2CFC+1FEj
- addq.w #1,$26(a5)
- addq.l #1,4(a5)
- addq.w #1,$2A00(a5)
- cmpi.w #$4B,$2A00(a5) ; 'K'
- bcs.s loc_2F62
- move.w #0,$2A00(a5)
- loc_2F62: ; CODE XREF: sub_2CFC+25Ej
- subq.l #1,8(a5)
- bgt.w loc_2D0C
- move.w #$FF91,$1E(a5)
- bra.w loc_2EBC
- ; ---------------------------------------------------------------------------
- loc_2F74: ; CODE XREF: sub_2CFC+BCj
- move.w #6,$22(a5)
- loc_2F7A: ; CODE XREF: sub_2CFC+292j
- bsr.w sub_28F4
- btst #7,($FF8004).l
- bne.w loc_2E02
- subq.w #1,$22(a5)
- bge.s loc_2F7A
- bra.w loc_2ECA
- ; End of function sub_2CFC
- ; ---------------------------------------------------------------------------
- UnkSub8:
- move.b #$80,$2A03(a5)
- move.w #4,$1C(a5)
- move.l #$C0000,$10(a5)
- move.w #0,$2A00(a5)
- movea.l a0,a1
- lea $2A(a5),a2
- move.w #$B,d1
- loc_2FB8: ; CODE XREF: ROM:00002FBAj
- move.b (a1)+,(a2)+
- dbf d1,loc_2FB8
- rts
- ; ---------------------------------------------------------------------------
- move.b #3,$28(a5)
- lea $2A(a5),a0
- bsr.w sub_2A94
- bcs.w loc_3012
- move.l $18(a0),4(a5)
- move.l $1C(a0),d1
- move.l d1,$18(a5)
- move.l #0,8(a5)
- loc_2FE8: ; CODE XREF: ROM:00002FF4j
- subi.l #$800,d1
- ble.s loc_2FF6
- addq.l #1,8(a5)
- bra.s loc_2FE8
- ; ---------------------------------------------------------------------------
- loc_2FF6: ; CODE XREF: ROM:00002FEEj
- bsr.w sub_301A
- cmpi.w #$64,$1E(a5) ; 'd'
- beq.s loc_3008
- move.w #$FFFD,$1E(a5)
- loc_3008: ; CODE XREF: ROM:00003000j
- ; ROM:00003018j
- move.w #0,$1C(a5)
- bra.w loc_28D8
- ; ---------------------------------------------------------------------------
- loc_3012: ; CODE XREF: ROM:00002FCEj
- move.w #$FFFE,$1E(a5)
- bra.s loc_3008
- ; =============== S U B R O U T I N E =======================================
- sub_301A: ; CODE XREF: ROM:loc_2FF6p
- move.l (sp)+,$C(a5)
- move.w #0,$26(a5)
- move.w #$A,$24(a5)
- loc_302A: ; CODE XREF: sub_301A+68j sub_301A+90j ...
- move.b $28(a5),($FF8004).l
- lea 4(a5),a0
- move.l (a0),d0
- divu.w #$4B,d0 ; 'K'
- swap d0
- ext.l d0
- divu.w #$A,d0
- move.b d0,d1
- lsl.b #4,d1
- swap d0
- move #0,ccr
- abcd d1,d0
- move.b d0,$29(a5)
- move.w #$89,d0 ; '‰'
- jsr ($5F22).w
- move.w #$20,d0 ; ' '
- jsr ($5F22).w
- move.w #$258,$22(a5)
- loc_306A: ; CODE XREF: sub_301A+62j
- bsr.w sub_28F4
- loc_306E: ; CODE XREF: sub_301A+178j
- move.w #$8A,d0 ; 'Š'
- jsr ($5F22).w
- bcc.s loc_3088
- subq.w #1,$22(a5)
- bge.s loc_306A
- subq.w #1,$24(a5)
- bge.s loc_302A
- bra.w loc_31AA
- ; ---------------------------------------------------------------------------
- loc_3088: ; CODE XREF: sub_301A+5Cj
- move.w #$8B,d0 ; '‹'
- jsr ($5F22).w
- bcs.w loc_30A2
- move.l d0,$14(a5)
- move.b $29(a5),d0
- cmp.b $16(a5),d0
- beq.s loc_30B2
- loc_30A2: ; CODE XREF: sub_301A+76j
- addq.l #1,$2A04(a5)
- subq.w #1,$24(a5)
- bge.w loc_302A
- bra.w loc_31AA
- ; ---------------------------------------------------------------------------
- loc_30B2: ; CODE XREF: sub_301A+86j
- move.w #$7FF,d0
- loc_30B6: ; CODE XREF: sub_301A+A4j
- btst #6,($FF8004).l
- dbne d0,loc_30B6
- bne.s loc_30D0
- subq.w #1,$24(a5)
- bge.w loc_302A
- bra.w loc_31AA
- ; ---------------------------------------------------------------------------
- loc_30D0: ; CODE XREF: sub_301A+A8j
- cmpi.b #2,$28(a5)
- beq.w loc_31B2
- move.w #$8C,d0 ; 'Œ'
- movea.l $10(a5),a0
- lea $14(a5),a1
- jsr ($5F22).w
- bcs.s loc_30F6
- move.b $29(a5),d0
- cmp.b $16(a5),d0
- beq.s loc_3106
- loc_30F6: ; CODE XREF: sub_301A+D0j
- addq.l #1,$2A04(a5)
- subq.w #1,$24(a5)
- bge.w loc_302A
- bra.w loc_31AA
- ; ---------------------------------------------------------------------------
- loc_3106: ; CODE XREF: sub_301A+DAj
- move #0,ccr
- moveq #1,d1
- abcd d1,d0
- move.b d0,$29(a5)
- cmpi.b #$75,$29(a5) ; 'u'
- bcs.s loc_3120
- move.b #0,$29(a5)
- loc_3120: ; CODE XREF: sub_301A+FEj
- ; sub_301A+1AAj
- move.w #$8D,d0 ; ''
- jsr ($5F22).w
- move.w #6,$22(a5)
- move.w #$A,$24(a5)
- addq.w #1,$26(a5)
- addq.l #1,4(a5)
- addq.w #1,$2A00(a5)
- move.w $2A00(a5),d0
- cmpi.w #5,d0
- beq.s loc_3156
- addi.l #$800,$10(a5) ; Load next sector address.
- bra.w loc_318E
- ; ---------------------------------------------------------------------------
- loc_3156: ; CODE XREF: sub_301A+12Ej
- bset #0,($FFFF800F).w
- loc_315C: ; CODE XREF: sub_301A+148j
- ; sub_301A+150j
- btst #0,($FFFF800E).w
- beq.s loc_315C
- btst #0,($FFFF800E).w
- beq.s loc_315C
- bclr #0,($FFFF800F).w
- bchg #0,($FFFF8003).w
- loc_3178: ; CODE XREF: sub_301A+164j
- btst #1,($FFFF8003).w
- bne.s loc_3178
- move.l #$C0000,$10(a5)
- move.w #0,$2A00(a5)
- loc_318E: ; CODE XREF: sub_301A+138j
- subq.l #1,8(a5) ; Subtract from the number of sectors to load.
- bgt.w loc_306E ; If there are none left, branch.
- move.w #$64,$1E(a5) ; 'd'
- loc_319C: ; CODE XREF: sub_301A+196j
- move.b $28(a5),($FF8004).l
- movea.l $C(a5),a0
- jmp (a0)
- ; ---------------------------------------------------------------------------
- loc_31AA: ; CODE XREF: sub_301A+6Aj sub_301A+94j ...
- move.w #$FF91,$1E(a5)
- bra.s loc_319C
- ; ---------------------------------------------------------------------------
- loc_31B2: ; CODE XREF: sub_301A+BCj
- move.w #6,$22(a5)
- loc_31B8: ; CODE XREF: sub_301A+1B2j
- bsr.w sub_28F4
- btst #7,($FF8004).l
- bne.w loc_3120
- subq.w #1,$22(a5)
- bge.s loc_31B8
- bra.s loc_31AA
- ; End of function sub_301A
- ; ---------------------------------------------------------------------------
- UnkSub7:
- bsr.w VBInit
- rts
- ; ===========================================================================
- SP_End:
Advertisement
Add Comment
Please, Sign In to add comment