Dandaman955

SCDBoot

Jul 25th, 2017
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 51.11 KB | None | 0 0
  1. ; ===========================================================================
  2. ; ---------------------------------------------------------------------------
  3. ; Boot Code (European Version)
  4. ; ---------------------------------------------------------------------------
  5. ; This boot code is required for Sonic CD to run on the Mega CD, altering it
  6. ; in any way will result in an unbootable Sonic CD ISO.
  7. ; This code is disassembled for research purposes only.
  8. ; This code gets transfered to FF0000 of the Mega Drive's RAM.
  9. ; The European BIOS is checked byte for byte from address $200 to $76D for
  10. ; any changes in the code, so anything after $76E will run fine.
  11. ; ---------------------------------------------------------------------------
  12.  
  13. lea Boot_Data(pc),a1 ; load boot data address
  14. jsr ($0364).w ; run routine to display and perform the data at a1
  15. bra.w loc_76E ; continue to first address possible after security check.
  16.  
  17. ; ===========================================================================
  18. ; ---------------------------------------------------------------------------
  19. ; Offset FF020C Boot Data (Palette, Art, Mappings, Music, etc)
  20. ; ---------------------------------------------------------------------------
  21.  
  22. Boot_Data:
  23. dc.b $60 ; Palette buffer address to dump the palette to (+60 4th line)
  24. dc.b $0F ; Number of colours to dump (10 minus 1 for dbf)
  25. incbin "BootData/PalLogo.bin" ; Palette colour data
  26. even
  27. incbin "BootData/ArtLogo.nem" ; SEGA logo art
  28. even
  29. incbin "BootData/ArtSonic.nem" ; Sonic Art
  30. even
  31.  
  32. dc.b $00,$00,$06,$03,$00,$00,$00,$01,$05,$10,$12,$C2,$04,$88,$50,$11 ; Enigma compressed plane mappings TODO.
  33. dc.b $04,$80,$14,$05,$10,$9A,$21,$54,$42,$60,$05,$05,$01,$34,$38,$11
  34. dc.b $40,$51,$11,$81,$14,$04,$01,$10,$20,$C5,$05,$01,$5C,$58,$02,$20
  35. dc.b $40,$1F,$02,$00,$88,$10,$07,$C3,$80,$C8,$04,$01,$A1,$38,$B4,$94
  36. dc.b $01,$00,$AC,$58,$0E,$20,$40,$1A,$13,$93,$B1,$A9,$A8,$1C,$5D,$8D
  37. dc.b $42,$E2,$68,$6C,$0F,$F0,$05,$00,$00,$00,$00,$00,$39,$0A,$41,$06
  38. dc.b $01,$81,$80,$90,$29,$AF,$F8
  39.  
  40. dc.b 'PRODUCED BY OR UNDER LICENSE',$00 ; Raw mappings, byte each gets turned into word (00 = new line, FF = terminate)
  41. dc.b $00
  42. dc.b ' FROM SEGA ENTERPRISES, LTD.'
  43. dc.b $FF
  44.  
  45. 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).
  46. dc.b $00,$00,$1C,$14,$11,$80,$80,$80,$1D,$11,$00,$00,$00,$00
  47.  
  48. include "BootData/MusicLogo.asm" ; SMPS music
  49. even
  50.  
  51. ; ===========================================================================
  52. ; ---------------------------------------------------------------------------
  53. ; Offset FF076E - Start of Initial Program (IP) Code
  54. ; ---------------------------------------------------------------------------
  55.  
  56. loc_76E:
  57. move.l #loc_82C+$FEFE00,($FFFFFD08).w ; Set the VBlank address.
  58. move.w #$FD0C,($A12006).l ; Set the HBlank address.
  59. move.l #loc_834+$FEFE00,($FFFFFD0E).w ; Set the HBlank address pointer ($FD0C-D contains the machine code for a long jump).
  60.  
  61. loc_786:
  62. bset #$01,($A12003).l ; Give WRAM to the sub CPU.
  63. beq.s loc_786 ; Wait until it has been transferred properly.
  64. lea ($A12010).l,a0 ; Load the communications port into a0.
  65. moveq #$00,d0 ; clear d0
  66. move.b d0,-$02(a0) ; Clear communications ports.
  67. move.l d0,(a0)+ ; ''
  68. move.l d0,(a0)+ ; ''
  69. move.l d0,(a0)+ ; ''
  70. move.l d0,(a0)+ ; ''
  71. lea loc_7BE(pc),a0 ; load routine to be executed
  72. lea ($00FF1000).l,a1 ; load memory space where it is to be executed
  73. move.w #(loc_7BE_End-loc_7BE)-$01,d7 ; set repeat times
  74.  
  75. loc_7B2:
  76. move.b (a0)+,(a1)+ ; dump instructions over to the memory
  77. dbf d7,loc_7B2 ; repeat til done
  78. jmp ($00FF1000).l ; execute instructions (loc_7BE).
  79.  
  80. ; ===========================================================================
  81. ; ---------------------------------------------------------------------------
  82. ; Offset 7BE - (Gets loaded to 00FF1000 and is executed there)
  83. ; ---------------------------------------------------------------------------
  84.  
  85. loc_7BE:
  86. moveq #$23,d0 ; Set the file in SPX___.BIN to load.
  87. jsr (loc_80C+$FEFE00).l ; Wait for the SCPU.
  88. movea.l ($200008).l,a0 ; Load the MMD entry point.
  89. move.l ($200002).l,d0 ; Load the RAM address value to copy WRAM values to. If there isn't one...
  90. beq.s loc_7E8 ; ...Skip the dumping.
  91. movea.l d0,a2 ; Set as an address.
  92. lea ($200100).l,a1 ; Load the source address to dump.
  93. move.w ($200006).l,d7 ; Get the size of the data block, divided by 4, minus 1.
  94.  
  95. loc_7E2:
  96. move.l (a1)+,(a2)+ ; Dump 4 bytes into RAM.
  97. dbf d7,loc_7E2 ; Repeat until it is fully dumped.
  98.  
  99. loc_7E8:
  100. move.l ($20000C).l,d0 ; Load the HBlank address area of the MMD.
  101. beq.s loc_7F4 ; If it is empty, branch.
  102. move.l d0,($FFFFFD0E).w ; Update HBlank address with the one in word RAM, from the MMD.
  103.  
  104. loc_7F4:
  105. move.l ($200010).l,d0 ; Load the VBlank address area of the MMD.
  106. beq.s loc_800 ; If it is empty, branch.
  107. move.l d0,($FFFFFD08).w ; Update VBlank address with the one in word RAM, from the MMD.
  108.  
  109. loc_800:
  110. bset #$01,($A12003).l ; Return WRAM to the sub CPU.
  111. beq.s loc_800 ; Loop until the bit has been set.
  112. jmp (a0) ; Jump to the MMD entry point address in word RAM.
  113.  
  114. loc_7BE_End:
  115.  
  116. ; ===========================================================================
  117. ; ---------------------------------------------------------------------------
  118. ; Offset FF080C Unknown Routine
  119. ; ---------------------------------------------------------------------------
  120. loc_80C:
  121. move.w d0,($A12010).l ; Set file to load.
  122.  
  123. loc_812:
  124. tst.w ($A12020).l ; Has the Sub CPU been ran (has the file been loaded in SPX___.asm)?
  125. beq.s loc_812 ; If it hasn't, loop until it has.
  126. move.w #$0000,($A12010).l ; Clear the register.
  127.  
  128. loc_822:
  129. tst.w ($A12020).l ; Has the Sub CPU been ran?
  130. bne.s loc_822 ; If it hasn't, loop until it has.
  131. rts ; Return.
  132.  
  133. ; ===========================================================================
  134. ; ---------------------------------------------------------------------------
  135. ; Offset FF082C - Initial Program Exception Handlers
  136. ; ---------------------------------------------------------------------------
  137. loc_82C:
  138. bset #$00,($A12000).l ; Run the sub CPU.
  139. loc_834:
  140. rte ; return
  141.  
  142. ; ===========================================================================
  143. ; ---------------------------------------------------------------------------
  144. ; Offset FF0FFE - Unknown Data
  145. ; ---------------------------------------------------------------------------
  146.  
  147. align $0FFE
  148. dc.w $0109
  149. align $1000
  150.  
  151. ; ===========================================================================
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168. ; ===========================================================================
  169. ; ---------------------------------------------------------------------------
  170. ; Main (Offset 1000)
  171. ; ---------------------------------------------------------------------------
  172. ; Start of SP init code:-
  173.  
  174. Main: dc.b 'MAIN '
  175. dc.b $00 ; Zero-terminated.
  176. dc.l $00000000
  177. dc.l $00000000
  178. dc.l SP_End-Main ; Set size of SP code block.
  179. dc.l SPTable-Main ; Set distance to SP table.
  180. dc.l $00000000
  181. SPTable:
  182. dc.w SP_Start-SPTable ; Address distance to the SP initialisation routine.
  183. dc.w SP_Main-SPTable ; Address distance to the SP main routine.
  184. dc.w Level2Int-SPTable ; Address distance to the Level 2 interrupt routine.
  185. dc.w SP_User-SPTable ; Address distance to the SP user routine.
  186. dc.w $0000 ; /
  187.  
  188. ; ===========================================================================
  189. ; ---------------------------------------------------------------------------
  190. ; Offset 00102A
  191. ; ---------------------------------------------------------------------------
  192. SP_Start:
  193. lea ($FFFF8020).w,a0 ; Load the communications register space to a0.
  194. moveq #$00,d0 ; Clear d0.
  195. move.b d0,-$11(a0) ; Clear the communications port (except for the set MCPU flag).
  196. move.l d0,(a0)+ ; ''
  197. move.l d0,(a0)+ ; ''
  198. move.l d0,(a0)+ ; ''
  199. move.l d0,(a0)+ ; ''
  200. lea unk_106A(pc),a0 ; Load the drive table of contents into a0.
  201. move.w #$0010,d0 ; Set to run that BIOS function.
  202. jsr ($5F22).w ; Run that BIOS function.
  203.  
  204. loc_1048: ; CODE XREF: ROM:00001056j
  205. move.w #$81,d0 ; Get CD BIOS status.
  206. jsr ($5F22).w ; Run that BIOS function.
  207. 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).
  208. bne.s loc_1048 ; If it isn't, loop.
  209. andi.b #$FA,($FFFF8003).w ; Set MCD mode 2.
  210. move.w #0,d0 ; Set to initialise the VInt routine address.
  211. jsr (JT1+$5000).l ; Run that routine.
  212. SP_User:
  213. rts ; Run SP_Main.
  214. ; ---------------------------------------------------------------------------
  215. unk_106A: dc.b $01 ; First entry of the drive table.
  216. dc.b $FF ; Read until the last track.
  217. aSpx____bin1: dc.b 'SPX___.BIN',';1'
  218. aSpx____bin_End:
  219. dc.w $0000
  220. ; ---------------------------------------------------------------------------
  221. SP_Main:
  222. move.w #3,d0 ; Load init routine 3: Set to initialise the directory on the next call.
  223. jsr (JT1+$5000).l ; Run the routine.
  224.  
  225. loc_1084: ; CODE XREF: ROM:00001092j
  226. jsr ($5F10).w ; Wait for VBlank. //
  227. move.w #2,d0 ; Load init routine 2. TODO
  228. jsr (JT1+$5000).l ; Check to see if VBlank has ran.
  229. bcs.s loc_1084 ; If it hasn't, branch. TODO
  230. cmpi.w #$64,d0 ; 'd'
  231. bne.w loc_10B6
  232. lea aSpx____bin1(pc),a0 ; "SPX___.BIN;1"
  233. lea ($B800).l,a1 ; Load RAM to dump to.
  234. jsr (loc_2800+$5000).w
  235. lea ($10000).l,sp ; Set as stack.
  236. jmp (SPX_Start+$B800).l ; Run SPX___.BIN at offset +$800. TODO IMPORTANT: SPX DOESN'T START FROM 0, ORG IT!
  237. ; ---------------------------------------------------------------------------
  238.  
  239. loc_10B6: ; CODE XREF: ROM:00001098j
  240. ; ROM:000010BAj
  241. nop
  242. nop
  243. bra.s loc_10B6
  244. ; ---------------------------------------------------------------------------
  245.  
  246. align $2400
  247.  
  248. ; ===========================================================================
  249. ; ---------------------------------------------------------------------------
  250. ; Other Data (Offset 2400)
  251. ; ---------------------------------------------------------------------------
  252. loc_2400:
  253. dc.b 0
  254. dc.b 5
  255. dc.b 0
  256. dc.b 0
  257. dc.b 0
  258. dc.b 5
  259. dc.b 0
  260. dc.b 0
  261. dc.b 0
  262. dc.b 5
  263. dc.b 0
  264. dc.b 0
  265. dc.b 0
  266. dc.b 5
  267. dc.b 0
  268. dc.b 0
  269. dc.b 0
  270. dc.b 5
  271. dc.b 0
  272. dc.b 0
  273. dc.b 0
  274. dc.b 5
  275. dc.b 0
  276. dc.b 0
  277. dc.b 0
  278. dc.b 5
  279. dc.b 0
  280. dc.b 0
  281. dc.b 0
  282. dc.b 5
  283. dc.b 0
  284. dc.b 0
  285. dc.b 0
  286. dc.b 5
  287. dc.b 0
  288. dc.b 0
  289. dc.b 0
  290. dc.b 5
  291. dc.b 0
  292. dc.b 0
  293. dc.b 0
  294. dc.b 5
  295. dc.b 0
  296. dc.b 0
  297. dc.b 0
  298. dc.b 5
  299. dc.b 0
  300. dc.b 0
  301. dc.b 0
  302. dc.b 5
  303. dc.b 0
  304. dc.b 0
  305. dc.b 0
  306. dc.b 5
  307. dc.b 0
  308. dc.b 0
  309. dc.b 0
  310. dc.b 5
  311. dc.b 0
  312. dc.b 0
  313. dc.b 0
  314. dc.b 5
  315. dc.b 0
  316. dc.b 0
  317. dc.b 0
  318. dc.b 5
  319. dc.b 0
  320. dc.b 0
  321. dc.b 0
  322. dc.b 5
  323. dc.b 0
  324. dc.b 0
  325. dc.b 0
  326. dc.b 5
  327. dc.b 0
  328. dc.b 0
  329. dc.b 0
  330. dc.b 5
  331. dc.b 0
  332. dc.b 0
  333. dc.b 0
  334. dc.b 5
  335. dc.b 0
  336. dc.b 0
  337. dc.b 0
  338. dc.b 5
  339. dc.b 0
  340. dc.b 0
  341. dc.b 0
  342. dc.b 5
  343. dc.b 0
  344. dc.b 0
  345. dc.b 0
  346. dc.b 5
  347. dc.b 0
  348. dc.b 0
  349. dc.b 0
  350. dc.b 5
  351. dc.b 0
  352. dc.b 0
  353. dc.b 0
  354. dc.b 5
  355. dc.b 0
  356. dc.b 0
  357. dc.b 0
  358. dc.b 5
  359. dc.b 0
  360. dc.b 0
  361. dc.b 0
  362. dc.b 5
  363. dc.b 0
  364. dc.b 0
  365. dc.b 0
  366. dc.b 5
  367. dc.b 0
  368. dc.b 0
  369. dc.b 0
  370. dc.b 5
  371. dc.b 0
  372. dc.b 0
  373. dc.b 0
  374. dc.b 5
  375. dc.b 0
  376. dc.b 0
  377. dc.b 0
  378. dc.b 5
  379. dc.b 0
  380. dc.b 0
  381. dc.b 0
  382. dc.b 5
  383. dc.b 0
  384. dc.b 0
  385. dc.b 0
  386. dc.b 5
  387. dc.b 0
  388. dc.b 0
  389. dc.b 0
  390. dc.b 5
  391. dc.b 0
  392. dc.b 0
  393. dc.b 0
  394. dc.b 5
  395. dc.b 0
  396. dc.b 0
  397. dc.b 0
  398. dc.b 5
  399. dc.b 0
  400. dc.b 0
  401. dc.b 0
  402. dc.b 5
  403. dc.b 0
  404. dc.b 0
  405. dc.b 0
  406. dc.b 5
  407. dc.b 0
  408. dc.b 0
  409. dc.b 0
  410. dc.b 5
  411. dc.b 0
  412. dc.b 0
  413. dc.b 0
  414. dc.b 5
  415. dc.b 0
  416. dc.b 0
  417. dc.b 0
  418. dc.b 5
  419. dc.b 0
  420. dc.b 0
  421. dc.b 0
  422. dc.b 5
  423. dc.b 0
  424. dc.b 0
  425. dc.b 0
  426. dc.b 5
  427. dc.b 0
  428. dc.b 0
  429. dc.b 0
  430. dc.b 5
  431. dc.b 0
  432. dc.b 0
  433. dc.b 0
  434. dc.b 5
  435. dc.b 0
  436. dc.b 0
  437. dc.b 0
  438. dc.b 5
  439. dc.b 0
  440. dc.b 0
  441. dc.b 0
  442. dc.b 5
  443. dc.b 0
  444. dc.b 0
  445. dc.b 0
  446. dc.b 5
  447. dc.b 0
  448. dc.b 0
  449. dc.b 0
  450. dc.b 5
  451. dc.b 0
  452. dc.b 0
  453. dc.b 0
  454. dc.b 5
  455. dc.b 0
  456. dc.b 0
  457. dc.b 0
  458. dc.b 5
  459. dc.b 0
  460. dc.b 0
  461. dc.b 0
  462. dc.b 5
  463. dc.b 0
  464. dc.b 0
  465. dc.b 0
  466. dc.b 5
  467. dc.b 0
  468. dc.b 0
  469. dc.b 0
  470. dc.b 5
  471. dc.b 0
  472. dc.b 0
  473. dc.b 0
  474. dc.b 5
  475. dc.b 0
  476. dc.b 0
  477. dc.b 0
  478. dc.b 5
  479. dc.b 0
  480. dc.b 0
  481. dc.b 0
  482. dc.b 5
  483. dc.b 0
  484. dc.b 0
  485. dc.b 0
  486. dc.b 5
  487. dc.b 0
  488. dc.b 0
  489. dc.b 0
  490. dc.b 5
  491. dc.b 0
  492. dc.b 0
  493. dc.b 0
  494. dc.b 5
  495. dc.b 0
  496. dc.b 0
  497. dc.b 0
  498. dc.b 5
  499. dc.b 0
  500. dc.b 0
  501. dc.b 0
  502. dc.b 5
  503. dc.b 0
  504. dc.b 0
  505. dc.b 0
  506. dc.b 5
  507. dc.b 0
  508. dc.b 0
  509. dc.b 0
  510. dc.b 5
  511. dc.b 0
  512. dc.b 0
  513. dc.b 0
  514. dc.b 5
  515. dc.b 0
  516. dc.b 0
  517. dc.b 0
  518. dc.b 5
  519. dc.b 0
  520. dc.b 0
  521. dc.b 0
  522. dc.b 5
  523. dc.b 0
  524. dc.b 0
  525. dc.b 0
  526. dc.b 5
  527. dc.b 0
  528. dc.b 0
  529. dc.b 0
  530. dc.b 5
  531. dc.b 0
  532. dc.b 0
  533. dc.b 0
  534. dc.b 5
  535. dc.b 0
  536. dc.b 0
  537. dc.b 0
  538. dc.b 5
  539. dc.b 0
  540. dc.b 0
  541. dc.b 0
  542. dc.b 5
  543. dc.b 0
  544. dc.b 0
  545. dc.b 0
  546. dc.b 5
  547. dc.b 0
  548. dc.b 0
  549. dc.b 0
  550. dc.b 5
  551. dc.b 0
  552. dc.b 0
  553. dc.b 0
  554. dc.b 5
  555. dc.b 0
  556. dc.b 0
  557. dc.b 0
  558. dc.b 5
  559. dc.b 0
  560. dc.b 0
  561. dc.b 0
  562. dc.b 5
  563. dc.b 0
  564. dc.b 0
  565. dc.b 0
  566. dc.b 5
  567. dc.b 0
  568. dc.b 0
  569. dc.b 0
  570. dc.b 5
  571. dc.b 0
  572. dc.b 0
  573. dc.b 0
  574. dc.b 5
  575. dc.b 0
  576. dc.b 0
  577. dc.b 0
  578. dc.b 5
  579. dc.b 0
  580. dc.b 0
  581. dc.b 0
  582. dc.b 5
  583. dc.b 0
  584. dc.b 0
  585. dc.b 0
  586. dc.b 5
  587. dc.b 0
  588. dc.b 0
  589. dc.b $B
  590. dc.b $B
  591. dc.b $B
  592. dc.b 0
  593. dc.b $B
  594. dc.b $B
  595. dc.b $B
  596. dc.b 0
  597. dc.b $B
  598. dc.b $B
  599. dc.b $B
  600. dc.b 0
  601. dc.b $B
  602. dc.b $B
  603. dc.b $B
  604. dc.b 0
  605. dc.b $B
  606. dc.b $B
  607. dc.b $B
  608. dc.b 0
  609. dc.b $B
  610. dc.b $B
  611. dc.b $B
  612. dc.b 0
  613. dc.b $B
  614. dc.b $B
  615. dc.b $B
  616. dc.b 0
  617. dc.b $B
  618. dc.b $B
  619. dc.b $B
  620. dc.b 0
  621. dc.b $B
  622. dc.b $B
  623. dc.b $B
  624. dc.b 0
  625. dc.b $B
  626. dc.b $B
  627. dc.b $B
  628. dc.b 0
  629. dc.b $B
  630. dc.b $B
  631. dc.b $B
  632. dc.b 0
  633. dc.b $B
  634. dc.b $B
  635. dc.b $B
  636. dc.b 0
  637. dc.b $B
  638. dc.b $B
  639. dc.b $B
  640. dc.b 0
  641. dc.b $B
  642. dc.b $B
  643. dc.b $B
  644. dc.b 0
  645. dc.b $B
  646. dc.b $B
  647. dc.b $B
  648. dc.b 0
  649. dc.b $B
  650. dc.b $B
  651. dc.b $B
  652. dc.b 0
  653. dc.b $B
  654. dc.b $B
  655. dc.b $B
  656. dc.b 0
  657. dc.b $B
  658. dc.b $B
  659. dc.b $B
  660. dc.b 0
  661. dc.b $B
  662. dc.b $B
  663. dc.b $B
  664. dc.b 0
  665. dc.b $B
  666. dc.b $B
  667. dc.b $B
  668. dc.b 0
  669. dc.b $B
  670. dc.b $B
  671. dc.b $B
  672. dc.b 0
  673. dc.b $B
  674. dc.b $B
  675. dc.b $B
  676. dc.b 0
  677. dc.b $B
  678. dc.b $B
  679. dc.b $B
  680. dc.b 0
  681. dc.b $B
  682. dc.b $B
  683. dc.b $B
  684. dc.b 0
  685. dc.b $B
  686. dc.b $B
  687. dc.b $B
  688. dc.b 0
  689. dc.b $B
  690. dc.b $B
  691. dc.b $B
  692. dc.b 0
  693. dc.b $B
  694. dc.b $B
  695. dc.b $B
  696. dc.b 0
  697. dc.b $B
  698. dc.b $B
  699. dc.b $B
  700. dc.b 0
  701. dc.b $B
  702. dc.b $B
  703. dc.b $B
  704. dc.b 0
  705. dc.b $B
  706. dc.b $B
  707. dc.b $B
  708. dc.b 0
  709. dc.b $B
  710. dc.b $B
  711. dc.b $B
  712. dc.b 0
  713. dc.b $B
  714. dc.b $B
  715. dc.b $B
  716. dc.b 0
  717. dc.b $B
  718. dc.b $B
  719. dc.b $B
  720. dc.b 0
  721. dc.b $B
  722. dc.b $B
  723. dc.b $B
  724. dc.b 0
  725. dc.b $B
  726. dc.b $B
  727. dc.b $B
  728. dc.b 0
  729. dc.b $B
  730. dc.b $B
  731. dc.b $B
  732. dc.b 0
  733. dc.b $B
  734. dc.b $B
  735. dc.b $B
  736. dc.b 0
  737. dc.b $B
  738. dc.b $B
  739. dc.b $B
  740. dc.b 0
  741. dc.b $B
  742. dc.b $B
  743. dc.b $B
  744. dc.b 0
  745. dc.b $B
  746. dc.b $B
  747. dc.b $B
  748. dc.b 0
  749. dc.b $B
  750. dc.b $B
  751. dc.b $B
  752. dc.b 0
  753. dc.b $B
  754. dc.b $B
  755. dc.b $B
  756. dc.b 0
  757. dc.b $B
  758. dc.b $B
  759. dc.b $B
  760. dc.b 0
  761. dc.b $B
  762. dc.b $B
  763. dc.b $B
  764. dc.b 0
  765. dc.b $B
  766. dc.b $B
  767. dc.b $B
  768. dc.b 0
  769. dc.b $B
  770. dc.b $B
  771. dc.b $B
  772. dc.b 0
  773. dc.b $B
  774. dc.b $B
  775. dc.b $B
  776. dc.b 0
  777. dc.b $B
  778. dc.b $B
  779. dc.b $B
  780. dc.b 0
  781. dc.b $B
  782. dc.b $B
  783. dc.b $B
  784. dc.b 0
  785. dc.b $B
  786. dc.b $B
  787. dc.b $B
  788. dc.b 0
  789. dc.b $B
  790. dc.b $B
  791. dc.b $B
  792. dc.b 0
  793. dc.b $B
  794. dc.b $B
  795. dc.b $B
  796. dc.b 0
  797. dc.b $B
  798. dc.b $B
  799. dc.b $B
  800. dc.b 0
  801. dc.b $B
  802. dc.b $B
  803. dc.b $B
  804. dc.b 0
  805. dc.b $B
  806. dc.b $B
  807. dc.b $B
  808. dc.b 0
  809. dc.b $B
  810. dc.b $B
  811. dc.b $B
  812. dc.b 0
  813. dc.b $B
  814. dc.b $B
  815. dc.b $B
  816. dc.b 0
  817. dc.b $B
  818. dc.b $B
  819. dc.b $B
  820. dc.b 0
  821. dc.b $B
  822. dc.b $B
  823. dc.b $B
  824. dc.b 0
  825. dc.b $B
  826. dc.b $B
  827. dc.b $B
  828. dc.b 0
  829. dc.b $B
  830. dc.b $B
  831. dc.b $B
  832. dc.b 0
  833. dc.b $B
  834. dc.b $B
  835. dc.b $B
  836. dc.b 0
  837. dc.b $B
  838. dc.b $B
  839. dc.b $B
  840. dc.b 0
  841. dc.b $B
  842. dc.b $B
  843. dc.b $B
  844. dc.b 0
  845. dc.b $B
  846. dc.b $B
  847. dc.b $B
  848. dc.b 0
  849. dc.b $B
  850. dc.b $B
  851. dc.b $B
  852. dc.b 0
  853. dc.b $B
  854. dc.b $B
  855. dc.b $B
  856. dc.b 0
  857. dc.b $B
  858. dc.b $B
  859. dc.b $B
  860. dc.b 0
  861. dc.b $B
  862. dc.b $B
  863. dc.b $B
  864. dc.b 0
  865. dc.b $B
  866. dc.b $B
  867. dc.b $B
  868. dc.b 0
  869. dc.b $B
  870. dc.b $B
  871. dc.b $B
  872. dc.b 0
  873. dc.b $B
  874. dc.b $B
  875. dc.b $B
  876. dc.b 0
  877. dc.b $B
  878. dc.b $B
  879. dc.b $B
  880. dc.b 0
  881. dc.b $B
  882. dc.b $B
  883. dc.b $B
  884. dc.b 0
  885. dc.b $B
  886. dc.b $B
  887. dc.b $B
  888. dc.b 0
  889. dc.b $B
  890. dc.b $B
  891. dc.b $B
  892. dc.b 0
  893. dc.b $B
  894. dc.b $B
  895. dc.b $B
  896. dc.b 0
  897. dc.b $B
  898. dc.b $B
  899. dc.b $B
  900. dc.b 0
  901. dc.b $B
  902. dc.b $B
  903. dc.b $B
  904. dc.b 0
  905. dc.b $B
  906. dc.b $B
  907. dc.b $B
  908. dc.b 0
  909. dc.b $B
  910. dc.b $B
  911. dc.b $B
  912. dc.b 0
  913. dc.b $B
  914. dc.b $B
  915. dc.b $B
  916. dc.b 0
  917. dc.b $B
  918. dc.b $B
  919. dc.b $B
  920. dc.b 0
  921. dc.b $B
  922. dc.b $B
  923. dc.b $B
  924. dc.b 0
  925. dc.b $23 ; #
  926. dc.b $19
  927. dc.b $1F
  928. dc.b 0
  929. dc.b 0
  930. dc.b 0
  931. dc.b 0
  932. dc.b 0
  933. dc.b $10
  934. dc.b 0
  935. dc.b 0
  936. dc.b 0
  937. dc.b 0
  938. dc.b 0
  939. dc.b 0
  940. dc.b 0
  941. dc.b 0
  942. dc.b 0
  943. dc.b 0
  944. dc.b 0
  945. dc.b 0
  946. dc.b 0
  947. dc.b 0
  948. dc.b 0
  949. dc.b 0
  950. dc.b 0
  951. dc.b 0
  952. dc.b 0
  953. dc.b 0
  954. dc.b 0
  955. dc.b 0
  956. dc.b 0
  957. dc.b 0
  958. dc.b 0
  959. dc.b 0
  960. dc.b 0
  961. dc.b 0
  962. dc.b 0
  963. dc.b 0
  964. dc.b 0
  965. dc.b 0
  966. dc.b 0
  967. dc.b 0
  968. dc.b 0
  969. dc.b 0
  970. dc.b 0
  971. dc.b 0
  972. dc.b 0
  973. dc.b 0
  974. dc.b 0
  975. dc.b 0
  976. dc.b 0
  977. dc.b 0
  978. dc.b 0
  979. dc.b 0
  980. dc.b 0
  981. dc.b 0
  982. dc.b 0
  983. dc.b 0
  984. dc.b 0
  985. dc.b 0
  986. dc.b 0
  987. dc.b 0
  988. dc.b 0
  989. dc.b 0
  990. dc.b 0
  991. dc.b 0
  992. dc.b 0
  993. dc.b 0
  994. dc.b 0
  995. dc.b 0
  996. dc.b 0
  997. dc.b 0
  998. dc.b 0
  999. dc.b 0
  1000. dc.b 0
  1001. dc.b 0
  1002. dc.b 0
  1003. dc.b 0
  1004. dc.b 0
  1005. dc.b 0
  1006. dc.b 0
  1007. dc.b 0
  1008. dc.b 0
  1009. dc.b 0
  1010. dc.b 0
  1011. dc.b 0
  1012. dc.b 0
  1013. dc.b 0
  1014. dc.b 0
  1015. dc.b 0
  1016. dc.b 0
  1017. dc.b 0
  1018. dc.b 0
  1019. dc.b 0
  1020. dc.b 0
  1021. ; ---------------------------------------------------------------------------
  1022. ; Sub CPU VBlank pointer.
  1023.  
  1024. Level2Int:
  1025. movem.l d0-a6,-(sp) ; Store used registers onto the stack.
  1026. move.w #1,d0 ; Load init routine 1.
  1027. jsr (JT1+$5000).l ; Run it.
  1028. movem.l (sp)+,d0-a6 ; Restore register values.
  1029. rts ; Return from L2 int.
  1030. ; ---------------------------------------------------------------------------
  1031.  
  1032. align $800
  1033.  
  1034. ; ---------------------------------------------------------------------------
  1035.  
  1036. loc_2800: ; CODE XREF: ROM:0000281Ej
  1037. move.w #4,d0
  1038. jsr (JT1+$5000).l
  1039.  
  1040. loc_280A: ; CODE XREF: ROM:00002818j
  1041. jsr ($5F10).w
  1042. move.w #2,d0
  1043. jsr (JT1+$5000).l
  1044. bcs.s loc_280A
  1045. cmpi.w #$64,d0 ; 'd'
  1046. bne.w loc_2800
  1047. rts
  1048. ; ---------------------------------------------------------------------------
  1049. dc.b 0
  1050. dc.b 0
  1051. dc.b 0
  1052. dc.b 0
  1053. dc.b 0
  1054. dc.b 0
  1055. dc.b 0
  1056. dc.b 0
  1057. dc.b 0
  1058. dc.b 0
  1059. dc.b 0
  1060. dc.b 0
  1061. dc.b 0
  1062. dc.b 0
  1063. dc.b 0
  1064. dc.b 0
  1065. dc.b 0
  1066. dc.b 0
  1067. dc.b 0
  1068. dc.b 0
  1069. dc.b 0
  1070. dc.b 0
  1071. dc.b 0
  1072. dc.b 0
  1073. dc.b 0
  1074. dc.b 0
  1075. dc.b 0
  1076. dc.b 0
  1077. ; ---------------------------------------------------------------------------
  1078. mulu.w #$D,d0
  1079. lea ($B800).l,a0
  1080. adda.w d0,a0
  1081. rts
  1082. ; ---------------------------------------------------------------------------
  1083. dc.b 0
  1084. dc.b 0
  1085. dc.b 0
  1086. dc.b 0
  1087. dc.b 0
  1088. dc.b 0
  1089. dc.b 0
  1090. dc.b 0
  1091. dc.b 0
  1092. dc.b 0
  1093. dc.b 0
  1094. dc.b 0
  1095. dc.b 0
  1096. dc.b 0
  1097. dc.b 0
  1098. dc.b 0
  1099. dc.b 0
  1100. dc.b 0
  1101. dc.b 0
  1102. dc.b 0
  1103. dc.b 0
  1104. dc.b 0
  1105. dc.b 0
  1106. dc.b 0
  1107. dc.b 0
  1108. dc.b 0
  1109. dc.b 0
  1110. dc.b 0
  1111. dc.b 0
  1112. dc.b 0
  1113. dc.b 0
  1114. dc.b 0
  1115. dc.b 0
  1116. dc.b 0
  1117. dc.b 0
  1118. dc.b 0
  1119. dc.b 0
  1120. dc.b 0
  1121. dc.b 0
  1122. dc.b 0
  1123. dc.b 0
  1124. dc.b 0
  1125. dc.b 0
  1126. dc.b 0
  1127. dc.b 0
  1128. dc.b 0
  1129. dc.b 0
  1130. dc.b 0
  1131. dc.b 0
  1132. dc.b 0
  1133. ; ---------------------------------------------------------------------------
  1134. JT1:
  1135. movem.l a0-a6,-(sp) ; Store address registers onto the stack.
  1136. lea ($8C00).l,a5 ; Load buffer RAM space.
  1137. add.w d0,d0 ; Double routine value.
  1138. move.w word_289A(pc,d0.w),d0 ; Get the routine distance.
  1139. jsr word_289A(pc,d0.w) ; Jump there.
  1140. movem.l (sp)+,a0-a6 ; Restore register values.
  1141. rts ; Return.
  1142. ; ---------------------------------------------------------------------------
  1143. word_289A: dc.w VBInit-word_289A
  1144. dc.w UnkSub2-word_289A
  1145. dc.w UnkSub4-word_289A
  1146. dc.w UnkSub1-word_289A
  1147. dc.w UnkSub5-word_289A
  1148. dc.w sub_2A94-word_289A
  1149. dc.w UnkSub6-word_289A
  1150. dc.w UnkSub7-word_289A
  1151. dc.w UnkSub8-word_289A
  1152. ; ---------------------------------------------------------------------------
  1153. UnkSub1:
  1154. move.w #1,$1C(a5) ; Set to initialise directory on next VBlank call.
  1155. move.b #$80,$2A03(a5) ; TODO
  1156. move.l #0,$2A04(a5) ; TODO
  1157. rts ; Return.
  1158.  
  1159. ; =============== S U B R O U T I N E =======================================
  1160. ; VBlank initialisation routine.
  1161.  
  1162. VBInit: ; CODE XREF: ROM:000031D0p
  1163. move.l #loc_28D8+$5000,0(a5) ; Store the address (VBlank) in that section.
  1164. move.w #0,$1C(a5) ; Set the VBlank routine to 0.
  1165. rts ; Return.
  1166. ; End of function VBInit
  1167.  
  1168. ; ---------------------------------------------------------------------------
  1169. UnkSub2:
  1170. movea.l 0(a5),a0 ; Load the VBlank routine address into a0 (loc_28D8).
  1171. jmp (a0) ; Run it.
  1172. ; ---------------------------------------------------------------------------
  1173.  
  1174. loc_28D8: ; CODE XREF: ROM:000029E4j
  1175. ; ROM:00002A3Ej ...
  1176. bsr.w sub_28F4 ; TODO
  1177. loc_28DC:
  1178. move.w $1C(a5),d0 ; Load the VBlank routine into d0.
  1179. add.w d0,d0 ; Double it for word tables.
  1180. move.w word_28EA(pc,d0.w),d0
  1181. jmp word_28EA(pc,d0.w)
  1182. ; ---------------------------------------------------------------------------
  1183. word_28EA: dc.w loc_28D8-word_28EA
  1184. dc.w InitDirectory-word_28EA
  1185. dc.w loc_29F0-word_28EA
  1186. dc.w $3B8
  1187. dc.w $6D6
  1188.  
  1189. ; =============== S U B R O U T I N E =======================================
  1190.  
  1191.  
  1192. sub_28F4: ; CODE XREF: ROM:loc_28D8p
  1193. ; ReadCD:loc_2B4Ap ...
  1194. move.l (sp)+,0(a5) ;
  1195. rts ; Return.
  1196. ; End of function sub_28F4
  1197.  
  1198. ; ---------------------------------------------------------------------------
  1199. InitDirectory:
  1200. move.b #3,$28(a5) ; CDC register - DBCH.
  1201. move.l #$10,4(a5) ; Set to load the directory record table ($10 * $800 = $8000).
  1202. move.l #1,8(a5) ; Set to load 1 sector.
  1203. lea $2100(a5),a0 ; Set to dump to address $AD00.
  1204. move.l a0,$10(a5) ; Store to the destination address buffer.
  1205. bsr.w ReadCD ; Write the data from the CD.
  1206. cmpi.w #$FF9C,$1E(a5) ;
  1207. beq.w loc_29E8
  1208. lea $2100(a5),a1 ; Load the directory record table address.
  1209. move.l $A2(a1),4(a5) ; Get the big endian sector location of the main directory.
  1210. move.l $AA(a1),d0 ; Get the big endian length of the table.
  1211. divu.w #$800,d0 ; Divide by $800 to get the size in sectors.
  1212. swap d0 ; Check the remainder (a valid sector size will be divisible by $800, and hence have a remainder of 0).
  1213. tst.w d0 ; Is there a remainder value?
  1214. beq.s loc_2944 ; If there isn't, branch.
  1215. addi.l #$10000,d0 ; If there is, round upwards to the nearest sector size.
  1216.  
  1217. loc_2944: ; CODE XREF: ROM:0000293Cj
  1218. swap d0 ; Restore the sector address.
  1219. move.w d0,$18(a5) ; Store in RAM.
  1220. clr.w $20(a5) ; Clear directory record counter.
  1221.  
  1222. loc_294E: ; CODE XREF: ROM:000029D4j
  1223. move.l #1,8(a5) ; Set to load 1 sector.
  1224. lea $2100(a5),a1 ; Set to dump to address $AD00.
  1225. move.l a1,$10(a5) ; Store to the destination address buffer.
  1226. bsr.w ReadCD ; Load the main directory at $AD00.
  1227. cmpi.w #$FF9C,$1E(a5) ;
  1228. beq.w loc_29E8
  1229. lea $100(a5),a0 ; Load buffer space address.
  1230. move.w $20(a5),d0 ; Get directory record counter entry.
  1231. mulu.w #$20,d0 ; Each entry is allocated $20 bytes.
  1232. adda.l d0,a0 ; Find the base entry.
  1233. lea $2100(a5),a1 ; Load the dumped main directory.
  1234. moveq #0,d0 ; Clear d0.
  1235.  
  1236. loc_2980: ; CODE XREF: ROM:000029CEj
  1237. move.b 0(a1),d0 ; Get the length of the TODO.
  1238. beq.s loc_29D0 ; If there's no length, branch.
  1239. move.b $19(a1),$17(a0) ; Copy the file flags into the buffer.
  1240. moveq #0,d1 ; Clear d1.
  1241.  
  1242. loc_298E: ; CODE XREF: ROM:000029A0j
  1243. move.b 6(a1,d1.w),$18(a0,d1.w) ; Copy the first address byte into the buffer.
  1244. move.b $E(a1,d1.w),$1C(a0,d1.w) ; Copy the first byte of the table length.
  1245. addq.w #1,d1 ; Set to load the successive byte.
  1246. cmpi.w #4,d1 ; Has a full longword been written?
  1247. blt.s loc_298E ; If not, loop until it has.
  1248. moveq #0,d1 ; Clear d1.
  1249.  
  1250. loc_29A4: ; CODE XREF: ROM:000029B0j
  1251. move.b $21(a1,d1.w),(a0,d1.w) ; Get the first character of the file name.
  1252. addq.w #1,d1 ; Set to load the next character.
  1253. cmp.b $20(a1),d1 ; Is there any more characters left to write?
  1254. blt.s loc_29A4 ; If there are, loop.
  1255.  
  1256. loc_29B2: ; CODE XREF: ROM:000029C0j
  1257. cmpi.b #$C,d1 ; Have $D characters been written?
  1258. bge.s loc_29C2 ; If they have, branch.
  1259. move.b #$20,(a0,d1.w) ; Fill in the rest with blank spaces.
  1260. addq.w #1,d1 ; Load the next character space.
  1261. bra.s loc_29B2 ; Loop until $D characters have been written.
  1262. ; ---------------------------------------------------------------------------
  1263.  
  1264. loc_29C2: ; CODE XREF: ROM:000029B6j
  1265. addq.w #1,$20(a5) ; Set to load the next main directory record.
  1266. adda.l d0,a1 ; Get the next MD address.
  1267. adda.l #$20,a0 ; Load the next entry in the buffer.
  1268. bra.s loc_2980 ; Repeat.
  1269. ; ---------------------------------------------------------------------------
  1270.  
  1271. loc_29D0: ; CODE XREF: ROM:00002984j
  1272. subq.w #1,$18(a5) ; Subtract 1 from the table length.
  1273. bne.w loc_294E
  1274. move.w #$64,$1E(a5) ; 'd'
  1275.  
  1276. loc_29DE: ; CODE XREF: ROM:000029EEj
  1277. move.w #0,$1C(a5) ; Set the VBlank routine to 0.
  1278. bra.w loc_28D8
  1279. ; ---------------------------------------------------------------------------
  1280.  
  1281. loc_29E8: ; CODE XREF: ROM:00002922j
  1282. ; ROM:00002968j
  1283. move.w #$FFFF,$1E(a5)
  1284. bra.s loc_29DE
  1285. ; ---------------------------------------------------------------------------
  1286. loc_29F0:
  1287. move.b #3,$28(a5) ; CDC register - DBCH.
  1288. lea $2A(a5),a0 ; Load the string buffer address.
  1289. bsr.w sub_2A94
  1290. bcs.w loc_2A42
  1291. move.l $18(a0),4(a5)
  1292. move.l $1C(a0),d1
  1293. move.l d1,$18(a5)
  1294. move.l #1,8(a5)
  1295.  
  1296. loc_2A18: ; CODE XREF: ROM:00002A24j
  1297. subi.l #$800,d1
  1298. ble.s loc_2A26
  1299. addq.l #1,8(a5)
  1300. bra.s loc_2A18
  1301. ; ---------------------------------------------------------------------------
  1302.  
  1303. loc_2A26: ; CODE XREF: ROM:00002A1Ej
  1304. bsr.w ReadCD
  1305. cmpi.w #$64,$1E(a5) ; 'd'
  1306. beq.s loc_2A38
  1307. move.w #$FFFD,$1E(a5)
  1308.  
  1309. loc_2A38: ; CODE XREF: ROM:00002A30j
  1310. ; ROM:00002A48j
  1311. move.w #0,$1C(a5)
  1312. bra.w loc_28D8
  1313. ; ---------------------------------------------------------------------------
  1314.  
  1315. loc_2A42: ; CODE XREF: ROM:000029FEj
  1316. move.w #$FFFE,$1E(a5)
  1317. bra.s loc_2A38
  1318. ; ---------------------------------------------------------------------------
  1319. UnkSub4:
  1320. cmpi.w #0,$1C(a5) ; Is the TODO routine set to 0?
  1321. bne.s loc_2A72 ; If not, branch.
  1322. move.w $1E(a5),d0
  1323. cmpi.w #$64,d0 ; 'd'
  1324. bne.s loc_2A62
  1325. move.l $18(a5),d1
  1326. bra.s loc_2A6C
  1327. ; ---------------------------------------------------------------------------
  1328.  
  1329. loc_2A62: ; CODE XREF: ROM:00002A5Aj
  1330. cmpi.w #$FFFD,d0
  1331. bne.s loc_2A6C
  1332. move.w $26(a5),d1
  1333.  
  1334. loc_2A6C: ; CODE XREF: ROM:00002A60j
  1335. ; ROM:00002A66j
  1336. move #0,ccr
  1337. rts
  1338. ; ---------------------------------------------------------------------------
  1339.  
  1340. loc_2A72: ; CODE XREF: ROM:00002A50j
  1341. move #1,ccr ; Branch on bcs.
  1342. rts ; Return.
  1343. ; ---------------------------------------------------------------------------
  1344. UnkSub5:
  1345. move.w #2,$1C(a5)
  1346. move.l a1,$10(a5) ; $B800
  1347. movea.l a0,a1
  1348. lea $2A(a5),a2
  1349. move.w #(aSpx____bin1-aSpx____bin_End)-1,d1
  1350.  
  1351. loc_2A8C: ; CODE XREF: ROM:00002A8Ej
  1352. move.b (a1)+,(a2)+ ; Dump a character into the buffer.
  1353. dbf d1,loc_2A8C ; Repeat for the number of characters.
  1354. rts ; Return.
  1355.  
  1356. ; =============== S U B R O U T I N E =======================================
  1357.  
  1358.  
  1359. sub_2A94: ; CODE XREF: ROM:000029FAp
  1360. ; ROM:00002CACp ...
  1361. move.l a2,-(sp) ; Store d2 onto the stack.
  1362. moveq #0,d1 ; Clear d1.
  1363. movea.l a0,a1 ; Copy string buffer to a1.
  1364. move.w #$A,d0 ; Set to check $B characters.
  1365.  
  1366. loc_2A9E: ; CODE XREF: sub_2A94+1Ej
  1367. tst.b (a1) ; Is the first character empty?
  1368. beq.s loc_2AB6 ; If it is, branch.
  1369. cmpi.b #$3B,(a1) ; Is the character a semi-colon (;)?
  1370. beq.s loc_2AB6 ; If it is, branch.
  1371. cmpi.b #$20,(a1) ; Is the character a blank space?
  1372. beq.s loc_2AB6 ; If it is, branch.
  1373. addq.w #1,d1
  1374. addq.w #1,a1 ; Load the next character.
  1375. dbf d0,loc_2A9E ; Check the next character.
  1376.  
  1377. loc_2AB6: ; CODE XREF: sub_2A94+Cj sub_2A94+12j ...
  1378. move.w $20(a5),d0
  1379. movea.l a0,a1 ; Restore string buffer starting address.
  1380. lea $100(a5),a0
  1381. lea InvalidChars(pc),a2
  1382. bsr.w sub_2C5C
  1383. beq.w loc_2AE4
  1384. movea.l a0,a2
  1385. subq.w #1,d0
  1386.  
  1387. loc_2AD0: ; CODE XREF: sub_2A94+46j
  1388. bsr.w sub_2C5C
  1389. beq.s loc_2AE0
  1390. adda.w #$20,a2 ; ' '
  1391. dbf d0,loc_2AD0
  1392. bra.s loc_2AE8
  1393. ; ---------------------------------------------------------------------------
  1394.  
  1395. loc_2AE0: ; CODE XREF: sub_2A94+40j
  1396. moveq #1,d0
  1397. movea.l a2,a0
  1398.  
  1399. loc_2AE4: ; CODE XREF: sub_2A94+34j sub_2A94+58j
  1400. movea.l (sp)+,a2
  1401. rts
  1402. ; ---------------------------------------------------------------------------
  1403.  
  1404. loc_2AE8: ; CODE XREF: sub_2A94+4Aj
  1405. move #1,ccr
  1406. bra.s loc_2AE4
  1407. ; End of function sub_2A94
  1408.  
  1409.  
  1410. ; =============== S U B R O U T I N E =======================================
  1411.  
  1412.  
  1413. InvalidChars: ; DATA XREF: sub_2A94+2Co
  1414. dc.b '\ ',0
  1415.  
  1416.  
  1417. ; =============== S U B R O U T I N E =======================================
  1418.  
  1419.  
  1420. ReadCD: ; CODE XREF: ROM:00002918p
  1421. ; ROM:0000295Ep ...
  1422. move.l (sp)+,$C(a5)
  1423. move.w #0,$26(a5)
  1424. move.w #$1E,$24(a5) ; Set to repeat routine $1E times in case of data error.
  1425.  
  1426. loc_2B0A: ; CODE XREF: ReadCD+68j ReadCD+8Cj ...
  1427. move.b $28(a5),($FF8004).l ; Set CDC register address.
  1428. lea 4(a5),a0 ; \\
  1429. move.l (a0),d0
  1430. divu.w #$4B,d0 ; 'K'
  1431. swap d0
  1432. ext.l d0
  1433. divu.w #$A,d0 ; 00060001
  1434. move.b d0,d1 ; 00000001
  1435. lsl.b #4,d1 ; 00000010
  1436. swap d0 ; 00010006
  1437. move #0,ccr ; Clear any set CCR flags for abcd.
  1438. abcd d1,d0 ; 00010016
  1439. move.b d0,$29(a5) ; TODO - Time?
  1440. move.w #$89,d0 ; CDCSTOP function.
  1441. jsr ($5F22).w ; Run the function; throw out the current sector.
  1442. move.w #$20,d0 ; ' ' ; ROMREADN function.
  1443. jsr ($5F22).w ; Run the function; TODO IMPORTANT.
  1444. move.w #$258,$22(a5) ; Set to check $258 times in case of data preparation delay.
  1445.  
  1446. loc_2B4A: ; CODE XREF: ReadCD+62j
  1447. bsr.w sub_28F4
  1448.  
  1449. loc_2B4E: ; CODE XREF: ReadCD+126j
  1450. move.w #$8A,d0 ; CDCSTAT function.
  1451. jsr ($5F22).w ; Run the function; check to see if the data has been prepared.
  1452. bcc.s loc_2B68 ; If the data has been prepared, branch.
  1453. subq.w #1,$22(a5) ; Subtract from the preparation delay counter.
  1454. bge.s loc_2B4A ; If it hasn't depleted, repeat.
  1455. subq.w #1,$24(a5) ; Subtract from data error counter.
  1456. bge.s loc_2B0A ; Repeat routine again if not depleted.
  1457. bra.w loc_2C38 ; TODO - It returns.
  1458. ; ---------------------------------------------------------------------------
  1459.  
  1460. loc_2B68: ; CODE XREF: ReadCD+5Cj
  1461. move.w #$8B,d0 ; CDCREAD function.
  1462. jsr ($5F22).w ; Read the frame of data.
  1463. bcs.w loc_2B82 ; If the prepared data is not present, branch.
  1464. move.l d0,$14(a5) ; Store the header time (mm|ss|ff|MD).
  1465. move.b $29(a5),d0 ;
  1466. cmp.b $16(a5),d0 ; Do the frames match?
  1467. beq.s loc_2B8E ; If they do, branch.
  1468. ;
  1469. loc_2B82: ; CODE XREF: ReadCD+76j
  1470. subq.w #1,$24(a5) ; Subtract from the data error counter.
  1471. bge.w loc_2B0A ; Repeat routine again if not depleted.
  1472. bra.w loc_2C38 ; TODO - It returns.
  1473. ; ---------------------------------------------------------------------------
  1474.  
  1475. loc_2B8E: ; CODE XREF: ReadCD+86j
  1476. move.w #$7FF,d0 ; Set to check $7FF times.
  1477.  
  1478. loc_2B92: ; CODE XREF: ReadCD+A0j
  1479. btst #6,($FF8004).l ; Has the data been set in RS1?
  1480. dbne d0,loc_2B92 ; If it hasn't, loop until it has / $7FF times.
  1481. bne.s loc_2BAC ; Branch if it has been set.
  1482. subq.w #1,$24(a5) ; If it hasn't, subtract from the data error counter.
  1483. bge.w loc_2B0A ; Repeat routine again if not completed.
  1484. bra.w loc_2C38 ; TODO - It returns.
  1485. ; ---------------------------------------------------------------------------
  1486.  
  1487. loc_2BAC: ; CODE XREF: ReadCD+A4j
  1488. cmpi.b #2,$28(a5)
  1489. beq.w loc_2C40
  1490. move.w #$8C,d0 ; CDCTRN function.
  1491. movea.l $10(a5),a0 ; Set the data destination.
  1492. lea $14(a5),a1 ; Load the header address.
  1493. jsr ($5F22).w
  1494. bcs.s loc_2BD2 ; If the data transfer isn't complete, branch.
  1495. move.b $29(a5),d0
  1496. cmp.b $16(a5),d0
  1497. beq.s loc_2BDE
  1498.  
  1499. loc_2BD2: ; CODE XREF: ReadCD+CCj
  1500. subq.w #1,$24(a5)
  1501. bge.w loc_2B0A
  1502. bra.w loc_2C38
  1503. ; ---------------------------------------------------------------------------
  1504.  
  1505. loc_2BDE: ; CODE XREF: ReadCD+D6j
  1506. move #0,ccr ; Clear the status flags.
  1507. moveq #1,d1
  1508. abcd d1,d0
  1509. move.b d0,$29(a5) ; Store
  1510. cmpi.b #$75,$29(a5)
  1511. bcs.s loc_2BF8
  1512. move.b #0,$29(a5)
  1513.  
  1514. loc_2BF8: ; CODE XREF: ReadCD+F6j
  1515. ; ReadCD+158j
  1516. move.w #$8D,d0 ; CDCACK function.
  1517. jsr ($5F22).w ; Stop reading the frame.
  1518. move.w #6,$22(a5) ;
  1519. move.w #$1E,$24(a5)
  1520. addi.l #$800,$10(a5) ; Load next block of memory to dump next sector.
  1521. addq.w #1,$26(a5)
  1522. addq.l #1,4(a5)
  1523. subq.l #1,8(a5) ; Subtract from the number of sectors to load.
  1524. bgt.w loc_2B4E ; If there's any left, branch.
  1525. move.w #$64,$1E(a5) ; 'd'
  1526.  
  1527. loc_2C2A: ; CODE XREF: ReadCD+144j
  1528. move.b $28(a5),($FF8004).l ; Write to CDC register address (CA0/1) TODO - Check the LC89510 Sanyo manual TODO 2 - WTF is that?
  1529. movea.l $C(a5),a0 ;
  1530. jmp (a0) ;
  1531. ; ---------------------------------------------------------------------------
  1532.  
  1533. loc_2C38: ; CODE XREF: ReadCD+6Aj ReadCD+90j ...
  1534. move.w #$FF9C,$1E(a5)
  1535. bra.s loc_2C2A
  1536. ; ---------------------------------------------------------------------------
  1537.  
  1538. loc_2C40: ; CODE XREF: ReadCD+B8j
  1539. move.w #6,$22(a5)
  1540.  
  1541. loc_2C46: ; CODE XREF: ReadCD+15Ej
  1542. bsr.w sub_28F4
  1543. btst #7,($FF8004).l
  1544. bne.s loc_2BF8
  1545. subq.w #1,$22(a5)
  1546. bge.s loc_2C46
  1547. bra.s loc_2C38
  1548. ; End of function ReadCD
  1549.  
  1550.  
  1551. ; =============== S U B R O U T I N E =======================================
  1552.  
  1553.  
  1554. sub_2C5C: ; CODE XREF: sub_2A94+30p
  1555. ; sub_2A94:loc_2AD0p
  1556. movem.l d1/a1-a2,-(sp)
  1557.  
  1558. loc_2C60: ; CODE XREF: sub_2C5C+8j
  1559. cmpm.b (a1)+,(a2)+ ; Is the character an invalid character for that section of the filename?
  1560. bne.s loc_2C6A ;
  1561. dbf d1,loc_2C60
  1562. moveq #0,d1
  1563.  
  1564. loc_2C6A: ; CODE XREF: sub_2C5C+6j
  1565. movem.l (sp)+,d1/a1-a2
  1566. rts
  1567. ; End of function sub_2C5C
  1568.  
  1569. ; ---------------------------------------------------------------------------
  1570. UnkSub6:
  1571. move.b #$80,$2A03(a5)
  1572. move.w #3,$1C(a5)
  1573. move.l #$40000,$10(a5)
  1574. move.w #0,$2A00(a5)
  1575. bset #7,$2A03(a5)
  1576. movea.l a0,a1
  1577. lea $2A(a5),a2
  1578. move.w #$B,d1
  1579.  
  1580. loc_2C9A: ; CODE XREF: ROM:00002C9Cj
  1581. move.b (a1)+,(a2)+
  1582. dbf d1,loc_2C9A
  1583. rts
  1584. ; ---------------------------------------------------------------------------
  1585. move.b #3,$28(a5)
  1586. lea $2A(a5),a0
  1587. bsr.w sub_2A94
  1588. bcs.w loc_2CF4
  1589. move.l $18(a0),4(a5)
  1590. move.l $1C(a0),d1
  1591. move.l d1,$18(a5)
  1592. move.l #1,8(a5)
  1593.  
  1594. loc_2CCA: ; CODE XREF: ROM:00002CD6j
  1595. subi.l #$800,d1
  1596. ble.s loc_2CD8
  1597. addq.l #1,8(a5)
  1598. bra.s loc_2CCA
  1599. ; ---------------------------------------------------------------------------
  1600.  
  1601. loc_2CD8: ; CODE XREF: ROM:00002CD0j
  1602. bsr.w sub_2CFC
  1603. cmpi.w #$64,$1E(a5) ; 'd'
  1604. beq.s loc_2CEA
  1605. move.w #$FFFD,$1E(a5)
  1606.  
  1607. loc_2CEA: ; CODE XREF: ROM:00002CE2j
  1608. ; ROM:00002CFAj
  1609. move.w #0,$1C(a5)
  1610. bra.w loc_28D8
  1611. ; ---------------------------------------------------------------------------
  1612.  
  1613. loc_2CF4: ; CODE XREF: ROM:00002CB0j
  1614. move.w #$FFFE,$1E(a5)
  1615. bra.s loc_2CEA
  1616.  
  1617. ; =============== S U B R O U T I N E =======================================
  1618.  
  1619.  
  1620. sub_2CFC: ; CODE XREF: ROM:loc_2CD8p
  1621. move.l (sp)+,$C(a5)
  1622. move.w #0,$26(a5)
  1623. move.w #$A,$24(a5)
  1624.  
  1625. loc_2D0C: ; CODE XREF: sub_2CFC+68j sub_2CFC+90j ...
  1626. move.b $28(a5),($FF8004).l
  1627. lea 4(a5),a0
  1628. move.l (a0),d0
  1629. divu.w #$4B,d0 ; 'K'
  1630. swap d0
  1631. ext.l d0
  1632. divu.w #$A,d0
  1633. move.b d0,d1
  1634. lsl.b #4,d1
  1635. swap d0
  1636. move #0,ccr
  1637. abcd d1,d0
  1638. move.b d0,$29(a5)
  1639. move.w #$89,d0 ; '‰'
  1640. jsr ($5F22).w
  1641. move.w #$20,d0 ; ' '
  1642. jsr ($5F22).w
  1643. move.w #$258,$22(a5)
  1644.  
  1645. loc_2D4C: ; CODE XREF: sub_2CFC+62j
  1646. bsr.w sub_28F4
  1647.  
  1648. loc_2D50: ; CODE XREF: sub_2CFC+1B6j
  1649. move.w #$8A,d0 ; 'Š'
  1650. jsr ($5F22).w
  1651. bcc.s loc_2D6A
  1652. subq.w #1,$22(a5)
  1653. bge.s loc_2D4C
  1654. subq.w #1,$24(a5)
  1655. bge.s loc_2D0C
  1656. bra.w loc_2ECA
  1657. ; ---------------------------------------------------------------------------
  1658.  
  1659. loc_2D6A: ; CODE XREF: sub_2CFC+5Cj
  1660. move.w #$8B,d0 ; '‹'
  1661. jsr ($5F22).w
  1662. bcs.w loc_2D84
  1663. move.l d0,$14(a5)
  1664. move.b $29(a5),d0
  1665. cmp.b $16(a5),d0
  1666. beq.s loc_2D94
  1667.  
  1668. loc_2D84: ; CODE XREF: sub_2CFC+76j
  1669. addq.l #1,$2A04(a5)
  1670. subq.w #1,$24(a5)
  1671. bge.w loc_2D0C
  1672. bra.w loc_2ECA
  1673. ; ---------------------------------------------------------------------------
  1674.  
  1675. loc_2D94: ; CODE XREF: sub_2CFC+86j
  1676. move.w #$7FF,d0
  1677.  
  1678. loc_2D98: ; CODE XREF: sub_2CFC+A4j
  1679. btst #6,($FF8004).l
  1680. dbne d0,loc_2D98
  1681. bne.s loc_2DB2
  1682. subq.w #1,$24(a5)
  1683. bge.w loc_2D0C
  1684. bra.w loc_2ECA
  1685. ; ---------------------------------------------------------------------------
  1686.  
  1687. loc_2DB2: ; CODE XREF: sub_2CFC+A8j
  1688. cmpi.b #2,$28(a5)
  1689. beq.w loc_2F74
  1690. move.w #$8C,d0 ; 'Œ'
  1691. movea.l $10(a5),a0
  1692. lea $14(a5),a1
  1693. jsr ($5F22).w
  1694. bcs.s loc_2DD8
  1695. move.b $29(a5),d0
  1696. cmp.b $16(a5),d0
  1697. beq.s loc_2DE8
  1698.  
  1699. loc_2DD8: ; CODE XREF: sub_2CFC+D0j
  1700. addq.l #1,$2A04(a5)
  1701. subq.w #1,$24(a5)
  1702. bge.w loc_2D0C
  1703. bra.w loc_2ECA
  1704. ; ---------------------------------------------------------------------------
  1705.  
  1706. loc_2DE8: ; CODE XREF: sub_2CFC+DAj
  1707. move #0,ccr
  1708. moveq #1,d1
  1709. abcd d1,d0
  1710. move.b d0,$29(a5)
  1711. cmpi.b #$75,$29(a5) ; 'u'
  1712. bcs.s loc_2E02
  1713. move.b #0,$29(a5)
  1714.  
  1715. loc_2E02: ; CODE XREF: sub_2CFC+FEj
  1716. ; sub_2CFC+28Aj
  1717. move.w #$8D,d0 ; ''
  1718. jsr ($5F22).w
  1719. move.w #6,$22(a5)
  1720. move.w #$A,$24(a5)
  1721. move.w $2A00(a5),d0
  1722. cmpi.w #$F,d0
  1723. beq.s loc_2E32
  1724. cmpi.w #$4A,d0 ; 'J'
  1725. beq.s loc_2E4A
  1726. addi.l #$800,$10(a5)
  1727. bra.w loc_2E94
  1728. ; ---------------------------------------------------------------------------
  1729.  
  1730. loc_2E32: ; CODE XREF: sub_2CFC+122j
  1731. move.b #1,$2A02(a5)
  1732. bclr #7,$2A03(a5)
  1733. move.l #$C0000,$10(a5)
  1734. bra.w loc_2E94
  1735. ; ---------------------------------------------------------------------------
  1736.  
  1737. loc_2E4A: ; CODE XREF: sub_2CFC+128j
  1738. bset #0,($FFFF800F).w
  1739. bset #7,$2A03(a5)
  1740. bset #5,$2A03(a5)
  1741.  
  1742. loc_2E5C: ; CODE XREF: sub_2CFC+166j
  1743. ; sub_2CFC+16Ej
  1744. btst #0,($FFFF800E).w
  1745. beq.s loc_2E5C
  1746. btst #0,($FFFF800E).w
  1747. beq.s loc_2E5C
  1748. bclr #0,($FFFF800F).w
  1749. bchg #0,($FFFF8003).w
  1750.  
  1751. loc_2E78: ; CODE XREF: sub_2CFC+182j
  1752. btst #1,($FFFF8003).w
  1753. bne.s loc_2E78
  1754. move.b #0,$2A02(a5)
  1755. move.l #$40000,$10(a5)
  1756. bset #7,$2A03(a5)
  1757.  
  1758. loc_2E94: ; CODE XREF: sub_2CFC+132j
  1759. ; sub_2CFC+14Aj
  1760. addq.w #1,$26(a5)
  1761. addq.l #1,4(a5)
  1762. addq.w #1,$2A00(a5)
  1763. cmpi.w #$4B,$2A00(a5) ; 'K'
  1764. bcs.s loc_2EAE
  1765. move.w #0,$2A00(a5)
  1766.  
  1767. loc_2EAE: ; CODE XREF: sub_2CFC+1AAj
  1768. subq.l #1,8(a5)
  1769. bgt.w loc_2D50
  1770. move.w #$64,$1E(a5) ; 'd'
  1771.  
  1772. loc_2EBC: ; CODE XREF: sub_2CFC+274j
  1773. move.b $28(a5),($FF8004).l
  1774. movea.l $C(a5),a0
  1775. jmp (a0)
  1776. ; ---------------------------------------------------------------------------
  1777.  
  1778. loc_2ECA: ; CODE XREF: sub_2CFC+6Aj sub_2CFC+94j ...
  1779. move.w $2A00(a5),d0
  1780. cmpi.w #$F,d0
  1781. beq.s loc_2EE6
  1782. cmpi.w #$4A,d0 ; 'J'
  1783. beq.s loc_2EFE
  1784. addi.l #$800,$10(a5)
  1785. bra.w loc_2F48
  1786. ; ---------------------------------------------------------------------------
  1787.  
  1788. loc_2EE6: ; CODE XREF: sub_2CFC+1D6j
  1789. move.b #1,$2A02(a5)
  1790. bclr #7,$2A03(a5)
  1791. move.l #$C0000,$10(a5)
  1792. bra.w loc_2F48
  1793. ; ---------------------------------------------------------------------------
  1794.  
  1795. loc_2EFE: ; CODE XREF: sub_2CFC+1DCj
  1796. bset #0,($FFFF800F).w
  1797. bset #7,$2A03(a5)
  1798. bset #5,$2A03(a5)
  1799.  
  1800. loc_2F10: ; CODE XREF: sub_2CFC+21Aj
  1801. ; sub_2CFC+222j
  1802. btst #0,($FFFF800E).w
  1803. beq.s loc_2F10
  1804. btst #0,($FFFF800E).w
  1805. beq.s loc_2F10
  1806. bclr #0,($FFFF800F).w
  1807. bchg #0,($FFFF8003).w
  1808.  
  1809. loc_2F2C: ; CODE XREF: sub_2CFC+236j
  1810. btst #1,($FFFF8003).w
  1811. bne.s loc_2F2C
  1812. move.b #0,$2A02(a5)
  1813. move.l #$40000,$10(a5)
  1814. bset #7,$2A03(a5)
  1815.  
  1816. loc_2F48: ; CODE XREF: sub_2CFC+1E6j
  1817. ; sub_2CFC+1FEj
  1818. addq.w #1,$26(a5)
  1819. addq.l #1,4(a5)
  1820. addq.w #1,$2A00(a5)
  1821. cmpi.w #$4B,$2A00(a5) ; 'K'
  1822. bcs.s loc_2F62
  1823. move.w #0,$2A00(a5)
  1824.  
  1825. loc_2F62: ; CODE XREF: sub_2CFC+25Ej
  1826. subq.l #1,8(a5)
  1827. bgt.w loc_2D0C
  1828. move.w #$FF91,$1E(a5)
  1829. bra.w loc_2EBC
  1830. ; ---------------------------------------------------------------------------
  1831.  
  1832. loc_2F74: ; CODE XREF: sub_2CFC+BCj
  1833. move.w #6,$22(a5)
  1834.  
  1835. loc_2F7A: ; CODE XREF: sub_2CFC+292j
  1836. bsr.w sub_28F4
  1837. btst #7,($FF8004).l
  1838. bne.w loc_2E02
  1839. subq.w #1,$22(a5)
  1840. bge.s loc_2F7A
  1841. bra.w loc_2ECA
  1842. ; End of function sub_2CFC
  1843.  
  1844. ; ---------------------------------------------------------------------------
  1845. UnkSub8:
  1846. move.b #$80,$2A03(a5)
  1847. move.w #4,$1C(a5)
  1848. move.l #$C0000,$10(a5)
  1849. move.w #0,$2A00(a5)
  1850. movea.l a0,a1
  1851. lea $2A(a5),a2
  1852. move.w #$B,d1
  1853.  
  1854. loc_2FB8: ; CODE XREF: ROM:00002FBAj
  1855. move.b (a1)+,(a2)+
  1856. dbf d1,loc_2FB8
  1857. rts
  1858. ; ---------------------------------------------------------------------------
  1859. move.b #3,$28(a5)
  1860. lea $2A(a5),a0
  1861. bsr.w sub_2A94
  1862. bcs.w loc_3012
  1863. move.l $18(a0),4(a5)
  1864. move.l $1C(a0),d1
  1865. move.l d1,$18(a5)
  1866. move.l #0,8(a5)
  1867.  
  1868. loc_2FE8: ; CODE XREF: ROM:00002FF4j
  1869. subi.l #$800,d1
  1870. ble.s loc_2FF6
  1871. addq.l #1,8(a5)
  1872. bra.s loc_2FE8
  1873. ; ---------------------------------------------------------------------------
  1874.  
  1875. loc_2FF6: ; CODE XREF: ROM:00002FEEj
  1876. bsr.w sub_301A
  1877. cmpi.w #$64,$1E(a5) ; 'd'
  1878. beq.s loc_3008
  1879. move.w #$FFFD,$1E(a5)
  1880.  
  1881. loc_3008: ; CODE XREF: ROM:00003000j
  1882. ; ROM:00003018j
  1883. move.w #0,$1C(a5)
  1884. bra.w loc_28D8
  1885. ; ---------------------------------------------------------------------------
  1886.  
  1887. loc_3012: ; CODE XREF: ROM:00002FCEj
  1888. move.w #$FFFE,$1E(a5)
  1889. bra.s loc_3008
  1890.  
  1891. ; =============== S U B R O U T I N E =======================================
  1892.  
  1893.  
  1894. sub_301A: ; CODE XREF: ROM:loc_2FF6p
  1895. move.l (sp)+,$C(a5)
  1896. move.w #0,$26(a5)
  1897. move.w #$A,$24(a5)
  1898.  
  1899. loc_302A: ; CODE XREF: sub_301A+68j sub_301A+90j ...
  1900. move.b $28(a5),($FF8004).l
  1901. lea 4(a5),a0
  1902. move.l (a0),d0
  1903. divu.w #$4B,d0 ; 'K'
  1904. swap d0
  1905. ext.l d0
  1906. divu.w #$A,d0
  1907. move.b d0,d1
  1908. lsl.b #4,d1
  1909. swap d0
  1910. move #0,ccr
  1911. abcd d1,d0
  1912. move.b d0,$29(a5)
  1913. move.w #$89,d0 ; '‰'
  1914. jsr ($5F22).w
  1915. move.w #$20,d0 ; ' '
  1916. jsr ($5F22).w
  1917. move.w #$258,$22(a5)
  1918.  
  1919. loc_306A: ; CODE XREF: sub_301A+62j
  1920. bsr.w sub_28F4
  1921.  
  1922. loc_306E: ; CODE XREF: sub_301A+178j
  1923. move.w #$8A,d0 ; 'Š'
  1924. jsr ($5F22).w
  1925. bcc.s loc_3088
  1926. subq.w #1,$22(a5)
  1927. bge.s loc_306A
  1928. subq.w #1,$24(a5)
  1929. bge.s loc_302A
  1930. bra.w loc_31AA
  1931. ; ---------------------------------------------------------------------------
  1932.  
  1933. loc_3088: ; CODE XREF: sub_301A+5Cj
  1934. move.w #$8B,d0 ; '‹'
  1935. jsr ($5F22).w
  1936. bcs.w loc_30A2
  1937. move.l d0,$14(a5)
  1938. move.b $29(a5),d0
  1939. cmp.b $16(a5),d0
  1940. beq.s loc_30B2
  1941.  
  1942. loc_30A2: ; CODE XREF: sub_301A+76j
  1943. addq.l #1,$2A04(a5)
  1944. subq.w #1,$24(a5)
  1945. bge.w loc_302A
  1946. bra.w loc_31AA
  1947. ; ---------------------------------------------------------------------------
  1948.  
  1949. loc_30B2: ; CODE XREF: sub_301A+86j
  1950. move.w #$7FF,d0
  1951.  
  1952. loc_30B6: ; CODE XREF: sub_301A+A4j
  1953. btst #6,($FF8004).l
  1954. dbne d0,loc_30B6
  1955. bne.s loc_30D0
  1956. subq.w #1,$24(a5)
  1957. bge.w loc_302A
  1958. bra.w loc_31AA
  1959. ; ---------------------------------------------------------------------------
  1960.  
  1961. loc_30D0: ; CODE XREF: sub_301A+A8j
  1962. cmpi.b #2,$28(a5)
  1963. beq.w loc_31B2
  1964. move.w #$8C,d0 ; 'Œ'
  1965. movea.l $10(a5),a0
  1966. lea $14(a5),a1
  1967. jsr ($5F22).w
  1968. bcs.s loc_30F6
  1969. move.b $29(a5),d0
  1970. cmp.b $16(a5),d0
  1971. beq.s loc_3106
  1972.  
  1973. loc_30F6: ; CODE XREF: sub_301A+D0j
  1974. addq.l #1,$2A04(a5)
  1975. subq.w #1,$24(a5)
  1976. bge.w loc_302A
  1977. bra.w loc_31AA
  1978. ; ---------------------------------------------------------------------------
  1979.  
  1980. loc_3106: ; CODE XREF: sub_301A+DAj
  1981. move #0,ccr
  1982. moveq #1,d1
  1983. abcd d1,d0
  1984. move.b d0,$29(a5)
  1985. cmpi.b #$75,$29(a5) ; 'u'
  1986. bcs.s loc_3120
  1987. move.b #0,$29(a5)
  1988.  
  1989. loc_3120: ; CODE XREF: sub_301A+FEj
  1990. ; sub_301A+1AAj
  1991. move.w #$8D,d0 ; ''
  1992. jsr ($5F22).w
  1993. move.w #6,$22(a5)
  1994. move.w #$A,$24(a5)
  1995. addq.w #1,$26(a5)
  1996. addq.l #1,4(a5)
  1997. addq.w #1,$2A00(a5)
  1998. move.w $2A00(a5),d0
  1999. cmpi.w #5,d0
  2000. beq.s loc_3156
  2001. addi.l #$800,$10(a5) ; Load next sector address.
  2002. bra.w loc_318E
  2003. ; ---------------------------------------------------------------------------
  2004.  
  2005. loc_3156: ; CODE XREF: sub_301A+12Ej
  2006. bset #0,($FFFF800F).w
  2007.  
  2008. loc_315C: ; CODE XREF: sub_301A+148j
  2009. ; sub_301A+150j
  2010. btst #0,($FFFF800E).w
  2011. beq.s loc_315C
  2012. btst #0,($FFFF800E).w
  2013. beq.s loc_315C
  2014. bclr #0,($FFFF800F).w
  2015. bchg #0,($FFFF8003).w
  2016.  
  2017. loc_3178: ; CODE XREF: sub_301A+164j
  2018. btst #1,($FFFF8003).w
  2019. bne.s loc_3178
  2020. move.l #$C0000,$10(a5)
  2021. move.w #0,$2A00(a5)
  2022.  
  2023. loc_318E: ; CODE XREF: sub_301A+138j
  2024. subq.l #1,8(a5) ; Subtract from the number of sectors to load.
  2025. bgt.w loc_306E ; If there are none left, branch.
  2026. move.w #$64,$1E(a5) ; 'd'
  2027.  
  2028. loc_319C: ; CODE XREF: sub_301A+196j
  2029. move.b $28(a5),($FF8004).l
  2030. movea.l $C(a5),a0
  2031. jmp (a0)
  2032. ; ---------------------------------------------------------------------------
  2033.  
  2034. loc_31AA: ; CODE XREF: sub_301A+6Aj sub_301A+94j ...
  2035. move.w #$FF91,$1E(a5)
  2036. bra.s loc_319C
  2037. ; ---------------------------------------------------------------------------
  2038.  
  2039. loc_31B2: ; CODE XREF: sub_301A+BCj
  2040. move.w #6,$22(a5)
  2041.  
  2042. loc_31B8: ; CODE XREF: sub_301A+1B2j
  2043. bsr.w sub_28F4
  2044. btst #7,($FF8004).l
  2045. bne.w loc_3120
  2046. subq.w #1,$22(a5)
  2047. bge.s loc_31B8
  2048. bra.s loc_31AA
  2049. ; End of function sub_301A
  2050.  
  2051. ; ---------------------------------------------------------------------------
  2052. UnkSub7:
  2053. bsr.w VBInit
  2054. rts
  2055.  
  2056. ; ===========================================================================
  2057. SP_End:
Advertisement
Add Comment
Please, Sign In to add comment