Advertisement
Guest User

Untitled

a guest
Sep 24th, 2023
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.41 KB | None | 0 0
  1. ;-----------------------------------------------------------------------;
  2. ; File Name - CDBIOS.INC ;
  3. ;-----------------------------------------------------------------------;
  4. ;File includes all the macro calls for using the BIOS routines. ;
  5. ; ;
  6. ; REVISION HISTORY: ;
  7. ; ;
  8. ; name date comments ;
  9. ; ---- ------- ----------------------------------- ;
  10. ; DRM 04/25/93 file created ;
  11. ; DWM 04/28/93 converted to SNASM format ;
  12. ; DWM 05/25/93 added backup ram macro calls ;
  13. ; JMY 03/31/94 added bios_cdbstat macro def
  14. ;-----------------------------------------------------------------------;
  15.  
  16. ;-----------------------------------------------------------------------
  17. ; This file defines the entry points and other essential information
  18. ; needed to call the BIOS from assembly language. It also defines a set
  19. ; of macros for calling BIOS functions.
  20. ;-----------------------------------------------------------------------
  21.  
  22. if ~def (CDBIOS_INC)
  23. CDBIOS_INC EQU 1
  24.  
  25. ;-----------------------------------------------------------------------
  26. ; INCLUDES
  27. ;-----------------------------------------------------------------------
  28.  
  29.  
  30. ;-----------------------------------------------------------------------
  31. ; BIOS FUNCTION CODES
  32. ;-----------------------------------------------------------------------
  33.  
  34. MSCSTOP EQU $0002
  35. MSCPAUSEON EQU $0003
  36. MSCPAUSEOFF EQU $0004
  37. MSCSCANFF EQU $0005
  38. MSCSCANFR EQU $0006
  39. MSCSCANOFF EQU $0007
  40.  
  41. ROMPAUSEON EQU $0008
  42. ROMPAUSEOFF EQU $0009
  43.  
  44. DRVOPEN EQU $000A
  45. DRVINIT EQU $0010
  46.  
  47. MSCPLAY EQU $0011
  48. MSCPLAY1 EQU $0012
  49. MSCPLAYR EQU $0013
  50. MSCPLAYT EQU $0014
  51. MSCSEEK EQU $0015
  52. MSCSEEKT EQU $0016
  53.  
  54. ROMREAD EQU $0017
  55. ROMSEEK EQU $0018
  56.  
  57. MSCSEEK1 EQU $0019
  58. TESTENTRY EQU $001E
  59. TESTENTRYLOOP EQU $001F
  60.  
  61. ROMREADN EQU $0020
  62. ROMREADE EQU $0021
  63.  
  64. CDBCHK EQU $0080
  65. CDBSTAT EQU $0081
  66. CDBTOCWRITE EQU $0082
  67. CDBTOCREAD EQU $0083
  68. CDBPAUSE EQU $0084
  69.  
  70. FDRSET EQU $0085
  71. FDRCHG EQU $0086
  72.  
  73. CDCSTART EQU $0087
  74. CDCSTARTP EQU $0088
  75. CDCSTOP EQU $0089
  76. CDCSTAT EQU $008A
  77. CDCREAD EQU $008B
  78. CDCTRN EQU $008C
  79. CDCACK EQU $008D
  80.  
  81. SCDINIT EQU $008E
  82. SCDSTART EQU $008F
  83. SCDSTOP EQU $0090
  84. SCDSTAT EQU $0091
  85. SCDREAD EQU $0092
  86. SCDPQ EQU $0093
  87. SCDPQL EQU $0094
  88.  
  89. LEDSET EQU $0095
  90.  
  91. CDCSETMODE EQU $0096
  92.  
  93. WONDERREQ EQU $0097
  94. WONDERCHK EQU $0098
  95.  
  96. CBTINIT EQU $0000
  97. CBTINT EQU $0001
  98. CBTOPENDISC EQU $0002
  99. CBTOPENSTAT EQU $0003
  100. CBTCHKDISC EQU $0004
  101. CBTCHKSTAT EQU $0005
  102. CBTIPDISC EQU $0006
  103. CBTIPSTAT EQU $0007
  104. CBTSPDISC EQU $0008
  105. CBTSPSTAT EQU $0009
  106.  
  107. BRMINIT EQU $0000
  108. BRMSTAT EQU $0001
  109. BRMSERCH EQU $0002
  110. BRMREAD EQU $0003
  111. BRMWRITE EQU $0004
  112. BRMDEL EQU $0005
  113. BRMFORMAT EQU $0006
  114. BRMDIR EQU $0007
  115. BRMVERIFY EQU $0008
  116.  
  117. ;-----------------------------------------------------------------------
  118. ; BIOS ENTRY POINTS
  119. ;-----------------------------------------------------------------------
  120.  
  121. _ADRERR EQU $00005F40
  122. _BOOTSTAT EQU $00005EA0
  123. _BURAM EQU $00005F16
  124. _CDBIOS EQU $00005F22
  125. _CDBOOT EQU $00005F1C
  126. _CDSTAT EQU $00005E80
  127. _CHKERR EQU $00005F52
  128. _CODERR EQU $00005F46
  129. _DEVERR EQU $00005F4C
  130. _LEVEL1 EQU $00005F76
  131. _LEVEL2 EQU $00005F7C
  132. _LEVEL3 EQU $00005F82 ;TIMER INTERRUPT
  133. _LEVEL4 EQU $00005F88
  134. _LEVEL5 EQU $00005F8E
  135. _LEVEL6 EQU $00005F94
  136. _LEVEL7 EQU $00005F9A
  137. _NOCOD0 EQU $00005F6A
  138. _NOCOD1 EQU $00005F70
  139. _SETJMPTBL EQU $00005F0A
  140. _SPVERR EQU $00005F5E
  141. _TRACE EQU $00005F64
  142. _TRAP00 EQU $00005FA0
  143. _TRAP01 EQU $00005FA6
  144. _TRAP02 EQU $00005FAC
  145. _TRAP03 EQU $00005FB2
  146. _TRAP04 EQU $00005FB8
  147. _TRAP05 EQU $00005FBE
  148. _TRAP06 EQU $00005FC4
  149. _TRAP07 EQU $00005FCA
  150. _TRAP08 EQU $00005FD0
  151. _TRAP09 EQU $00005FD6
  152. _TRAP10 EQU $00005FDC
  153. _TRAP11 EQU $00005FE2
  154. _TRAP12 EQU $00005FE8
  155. _TRAP13 EQU $00005FEE
  156. _TRAP14 EQU $00005FF4
  157. _TRAP15 EQU $00005FFA
  158. _TRPERR EQU $00005F58
  159. _USERCALL0 EQU $00005F28 ;INIT
  160. _USERCALL1 EQU $00005F2E ;MAIN
  161. _USERCALL2 EQU $00005F34 ;VINT
  162. _USERCALL3 EQU $00005F3A ;NOT DEFINED
  163. _USERMODE EQU $00005EA6
  164. _WAITVSYNC EQU $00005F10
  165.  
  166. ;-----------------------------------------------------------------------
  167. ; CDBIOS - Calls the BIOS with a specified function number. Assumes
  168. ; that all preparatory and cleanup work is done externally.
  169. ;
  170. ; input:
  171. ; fcode BIOS function code
  172. ;
  173. ; returns:
  174. ; nothing
  175. ;-----------------------------------------------------------------------
  176. CDBIOS macro fcode
  177. move.w \fcode,d0
  178. jsr _CDBIOS
  179. endm
  180.  
  181.  
  182. ;-----------------------------------------------------------------------
  183. ; BURAM - Calls the Backup Ram with a specified function number.
  184. ; Assumes that all preparatory and cleanup work is done externally.
  185. ;
  186. ; input:
  187. ; fcode Backup Ram function code
  188. ;
  189. ; returns:
  190. ; nothing
  191. ;-----------------------------------------------------------------------
  192. BURAM macro fcode
  193. move.w \fcode,d0
  194. jsr _BURAM
  195. endm
  196.  
  197.  
  198. ;-----------------------------------------------------------------------
  199. ; DRIVE MECHANISM
  200. ;-----------------------------------------------------------------------
  201.  
  202. ;-----------------------------------------------------------------------
  203. ; BIOS_DRVINIT - Closes the disk tray and reads the TOC from the CD.
  204. ; Pauses for 2 seconds after reading the TOC. If bit 7 of the TOC track
  205. ; is set, the BIOS starts playing the first track automatically. Waits
  206. ; for a DRVOPEN request if there is no disk in the drive.
  207. ;
  208. ; input:
  209. ; a0.l address of initialization parameters:
  210. ; dc.b $01 ; Track # to read TOC from (normally $01)
  211. ; dc.b $FF ; Last track # ($FF = read all tracks)
  212. ;
  213. ; returns:
  214. ; nothing
  215. ;-----------------------------------------------------------------------
  216. BIOS_DRVINIT macro
  217. CDBIOS #DRVINIT
  218. endm
  219.  
  220. ;-----------------------------------------------------------------------
  221. ; BIOS_DRVOPEN - Opens the drive.
  222. ;
  223. ; input:
  224. ; none
  225. ;
  226. ; returns:
  227. ; nothing
  228. ;-----------------------------------------------------------------------
  229. BIOS_DRVOPEN macro
  230. CDBIOS #DRVOPEN
  231. endm
  232.  
  233.  
  234. ;-----------------------------------------------------------------------
  235. ; MUSIC
  236. ;-----------------------------------------------------------------------
  237.  
  238. ;-----------------------------------------------------------------------
  239. ; BIOS_MSCSTOP - Stops playing a track if it's currently playing.
  240. ;
  241. ; input:
  242. ; none
  243. ;
  244. ; returns:
  245. ; nothing
  246. ;-----------------------------------------------------------------------
  247. BIOS_MSCSTOP macro
  248. CDBIOS #MSCSTOP
  249. endm
  250.  
  251. ;-----------------------------------------------------------------------
  252. ; BIOS_MSCPLAY - Starts playing at a specified track. Continues playing
  253. ; through subsequent tracks.
  254. ;
  255. ; input:
  256. ; a0.l address of 16 bit track number
  257. ;
  258. ; returns:
  259. ; nothing
  260. ;-----------------------------------------------------------------------
  261. BIOS_MSCPLAY macro
  262. CDBIOS #MSCPLAY
  263. endm
  264.  
  265. ;-----------------------------------------------------------------------
  266. ; BIOS_MSCPLAY1 - Plays a track once and pauses.
  267. ;
  268. ; input:
  269. ; a0.l address of a 16 bit track number
  270. ;
  271. ; returns:
  272. ; nothing
  273. ;-----------------------------------------------------------------------
  274. BIOS_MSCPLAY1 macro
  275. CDBIOS #MSCPLAY1
  276. endm
  277.  
  278. ;-----------------------------------------------------------------------
  279. ; BIOS_MSCPLAYR - Plays the designated track repeatedly.
  280. ;
  281. ; input:
  282. ; a0.l address of a 16 bit track number
  283. ;
  284. ; returns:
  285. ; nothing
  286. ;-----------------------------------------------------------------------
  287. BIOS_MSCPLAYR macro
  288. CDBIOS #MSCPLAYR
  289. endm
  290.  
  291. ;-----------------------------------------------------------------------
  292. ; BIOS_MSCPLAYT - Starts playing from a specified time.
  293. ;
  294. ; input:
  295. ; a0.l address of a 32 bit BCD time code in the format mm:ss:ff:00
  296. ;
  297. ; returns:
  298. ; nothing
  299. ;-----------------------------------------------------------------------
  300. BIOS_MSCPLAYT macro
  301. CDBIOS #MSCPLAYT
  302. endm
  303.  
  304. ;-----------------------------------------------------------------------
  305. ; BIOS_MSCSEEK - Seeks to the beginning of the selected track and pauses.
  306. ;
  307. ; input:
  308. ; a0.l address of a 16 bit track number
  309. ;
  310. ; returns:
  311. ; nothing
  312. ;-----------------------------------------------------------------------
  313. BIOS_MSCSEEK macro
  314. CDBIOS #MSCSEEK
  315. endm
  316.  
  317. ;-----------------------------------------------------------------------
  318. ; BIOS_MSCSEEK1 - Seeks to the beginning of the selected track and pauses.
  319. ; Once the BIOS detects a pause state, it plays the track once.
  320. ;
  321. ; input:
  322. ; a0.l address of a 16 bit track number
  323. ;
  324. ; returns:
  325. ; nothing
  326. ;-----------------------------------------------------------------------
  327. BIOS_MSCSEEK1 macro
  328. CDBIOS #MSCSEEK1
  329. endm
  330.  
  331. ;-----------------------------------------------------------------------
  332. ; BIOS_MSCSEEKT - Seeks to a specified time.
  333. ;
  334. ; input:
  335. ; a0.l address of a 32 bit BCD time code in the format mm:ss:ff:00
  336. ;
  337. ; returns:
  338. ; nothing
  339. ;-----------------------------------------------------------------------
  340. BIOS_MSCSEEKT macro
  341. CDBIOS #MSCSEEKT
  342. endm
  343.  
  344. ;-----------------------------------------------------------------------
  345. ; BIOS_MSCPAUSEON - Pauses the drive when a track is playing. If the
  346. ; drive is left paused it will stop after a programmable delay (see
  347. ; CDBPAUSE).
  348. ;
  349. ; input:
  350. ; none
  351. ;
  352. ; returns:
  353. ; nothing
  354. ;-----------------------------------------------------------------------
  355. BIOS_MSCPAUSEON macro
  356. CDBIOS #MSCPAUSEON
  357. endm
  358.  
  359. ;-----------------------------------------------------------------------
  360. ; BIOS_MSCPAUSEOFF - Resumes playing a track after a pause. If the drive
  361. ; has timed out and stopped, the BIOS will seek to the pause time (with
  362. ; the attendant delay) and resume playing.
  363. ;
  364. ; input:
  365. ; none
  366. ;
  367. ; returns:
  368. ; nothing
  369. ;-----------------------------------------------------------------------
  370. BIOS_MSCPAUSEOFF macro
  371. CDBIOS #MSCPAUSEOFF
  372. endm
  373.  
  374. ;-----------------------------------------------------------------------
  375. ; BIOS_MSCSCANFF - Starts playing from the current position in fast
  376. ; forward.
  377. ;
  378. ; input:
  379. ; none
  380. ;
  381. ; returns:
  382. ; nothing
  383. ;-----------------------------------------------------------------------
  384. BIOS_MSCSCANFF macro
  385. CDBIOS #MSCSCANFF
  386. endm
  387.  
  388. ;-----------------------------------------------------------------------
  389. ; BIOS_MSCSCANFR - Same as MSCSCANFF, but backwards.
  390. ;
  391. ; input:
  392. ; none
  393. ;
  394. ; returns:
  395. ; nothing
  396. ;-----------------------------------------------------------------------
  397. BIOS_MSCSCANFR macro
  398. CDBIOS #MSCSCANFR
  399. endm
  400.  
  401. ;-----------------------------------------------------------------------
  402. ; BIOS_MSCSCANOFF - Returns to normal play mode. If the drive was
  403. ; paused before the scan was initiated, it will be returned to pause.
  404. ;
  405. ; input:
  406. ; none
  407. ;
  408. ; returns:
  409. ; nothing
  410. ;-----------------------------------------------------------------------
  411. BIOS_MSCSCANOFF macro
  412. CDBIOS #MSCSCANOFF
  413. endm
  414.  
  415.  
  416. ;-----------------------------------------------------------------------
  417. ; CD-ROM
  418. ;-----------------------------------------------------------------------
  419.  
  420. ;-----------------------------------------------------------------------
  421. ; BIOS_ROMREAD - Begins reading data from the CDROM at the designated
  422. ; logical sector. Executes a CDCSTART to begin the read, but doesn't
  423. ; stop automatically.
  424. ;
  425. ; Note - ROMREAD actually pre-seeks by 2 sectors, but doesn't start
  426. ; passing data to the CDC until the desired sector is reached.
  427. ;
  428. ; input:
  429. ; a0.l address of a 32 bit logical sector number
  430. ;
  431. ; returns:
  432. ; nothing
  433. ;-----------------------------------------------------------------------
  434. BIOS_ROMREAD macro
  435. CDBIOS #ROMREAD
  436. endm
  437.  
  438. ;-----------------------------------------------------------------------
  439. ; BIOS_ROMREADN - Same as ROMREAD, but stops after reading the requested
  440. ; number of sectors.
  441. ;
  442. ; input:
  443. ; a0.l address of a 32 bit sector number and 32 bit sector count
  444. ; dc.l $00000001 ; First sector to read
  445. ; dc.l $00001234 ; Number of sectors to read
  446. ;
  447. ; returns:
  448. ; nothing
  449. ;-----------------------------------------------------------------------
  450. BIOS_ROMREADN macro
  451. CDBIOS #ROMREADN
  452. endm
  453.  
  454. ;-----------------------------------------------------------------------
  455. ; BIOS_ROMREADE - Same as ROMREAD, but reads between two logical sectors.
  456. ;
  457. ; input:
  458. ; a0.l address of table of 32 bit logical sector numbers
  459. ; dc.l $00000001 ; First sector to read
  460. ; dc.l $00000123 ; Last sector to read
  461. ;
  462. ; returns:
  463. ; nothing
  464. ;-----------------------------------------------------------------------
  465. BIOS_ROMREADE macro
  466. CDBIOS #ROMREADE
  467. endm
  468.  
  469. ;-----------------------------------------------------------------------
  470. ; BIOS_ROMSEEK - Seeks to the designated logical sector and pauses.
  471. ;
  472. ; input:
  473. ; a0.l address of a 32 bit logical sector number
  474. ;
  475. ; returns:
  476. ; nothing
  477. ;-----------------------------------------------------------------------
  478. BIOS_ROMSEEK macro
  479. CDBIOS #ROMSEEK
  480. endm
  481.  
  482. ;-----------------------------------------------------------------------
  483. ; BIOS_ROMPAUSEON - Stops reading data into the CDC and pauses.
  484. ;
  485. ; input:
  486. ; none
  487. ;
  488. ; returns:
  489. ; nothing
  490. ;-----------------------------------------------------------------------
  491. BIOS_ROMPAUSEON macro
  492. CDBIOS #ROMPAUSEON
  493. endm
  494.  
  495. ;-----------------------------------------------------------------------
  496. ; BIOS_ROMPAUSEOFF - Resumes reading data into the CDC from the current
  497. ; logical sector.
  498. ;
  499. ; input:
  500. ; none
  501. ;
  502. ; returns:
  503. ; nothing
  504. ;-----------------------------------------------------------------------
  505. BIOS_ROMPAUSEOFF macro
  506. CDBIOS #ROMPAUSEOFF
  507. endm
  508.  
  509.  
  510. ;-----------------------------------------------------------------------
  511. ; MISC BIOS FUNCTIONS
  512. ;-----------------------------------------------------------------------
  513.  
  514. ;-----------------------------------------------------------------------
  515. ; BIOS_CDBCHK - Querys the BIOS on the status of the last command.
  516. ; Returns success if the command has been executed, not if it's complete.
  517. ; This means that CDBCHK will return success on a seek command once the
  518. ; seek has started, NOT when the seek is actually finished.
  519. ;
  520. ; input:
  521. ; none
  522. ;
  523. ; returns:
  524. ; cc Command has been executed
  525. ; cs BIOS is busy
  526. ;-----------------------------------------------------------------------
  527. BIOS_CDBCHK macro
  528. CDBIOS #CDBCHK
  529. endm
  530.  
  531. ;-----------------------------------------------------------------------
  532. ; BIOS_CDBSTAT
  533. ;
  534. ; input:
  535. ; none
  536. ;
  537. ; returns:
  538. ; a0.l address of BIOS status table
  539. ;-----------------------------------------------------------------------
  540. BIOS_CDBSTAT macro
  541. CDBIOS #CDBSTAT
  542. endm
  543.  
  544. ;-----------------------------------------------------------------------
  545. ; BIOS_CDBTOCREAD - Gets the time for the specified track from the TOC.
  546. ; If the track isn't in the TOC, the BIOS will either return the time of
  547. ; the last track read or the beginning of the disk. Don't call this
  548. ; function while the BIOS is loading the TOC (see DRVINIT).
  549. ;
  550. ; input:
  551. ; d1.w 16 bit track number
  552. ;
  553. ; returns:
  554. ; d0.l BCD time of requested track in mm:ss:ff:## format where ## is
  555. ; the requested track number or 00 if there was an error
  556. ;
  557. ; d1.b Track type:
  558. ; $00 = CD-DA track
  559. ; $FF = CD-ROM track
  560. ;-----------------------------------------------------------------------
  561. BIOS_CDBTOCREAD macro
  562. CDBIOS #CDBTOCREAD
  563. endm
  564.  
  565. ;-----------------------------------------------------------------------
  566. ; BIOS_CDBTOCWRITE - Writes data to the TOC in memory. Don't write to
  567. ; the TOC while the BIOS is performing a DRVINIT.
  568. ;
  569. ; input:
  570. ; a0.l address of a table of TOC entries to write to the TOC. Format
  571. ; of the entries is mm:ss:ff:## where ## is the track number.
  572. ;
  573. ; returns:
  574. ; nothing
  575. ;-----------------------------------------------------------------------
  576. BIOS_CDBTOCWRITE macro
  577. CDBIOS #CDBTOCWRITE
  578. endm
  579.  
  580. ;-----------------------------------------------------------------------
  581. ; BIOS_CDBPAUSE - Sets the delay time before the BIOS switches from
  582. ; pause to standby. Normal ranges for this delay time are $1194 - $FFFE.
  583. ; A delay of $FFFF prevents the drive from stopping, but can damage the
  584. ; drive if used improperly.
  585. ;
  586. ; input:
  587. ; d1.w 16 bit delay time
  588. ;
  589. ; returns:
  590. ; nothing
  591. ;-----------------------------------------------------------------------
  592. BIOS_CDBPAUSE macro
  593. CDBIOS #CDBPAUSE
  594. endm
  595.  
  596.  
  597. ;-----------------------------------------------------------------------
  598. ; FADER
  599. ;-----------------------------------------------------------------------
  600.  
  601. ;-----------------------------------------------------------------------
  602. ; BIOS_FDRSET - Sets the audio volume. If bit 15 of the volume parameter
  603. ; is 1, sets the master volume level. There's a delay of up to 13ms
  604. ; before the volume begins to change and another 23ms for the new volume
  605. ; level to take effect. The master volume sets a maximum level which the
  606. ; volume level can't exceed.
  607. ;
  608. ; input:
  609. ; d1.w 16 bit volume ($0000 = min $0400 = max)
  610. ; 16 bit master volume ($8000 = min $8400 = max)
  611. ;
  612. ; returns:
  613. ; nothing
  614. ;-----------------------------------------------------------------------
  615. BIOS_FDRSET macro
  616. CDBIOS #FDRSET
  617. endm
  618.  
  619. ;-----------------------------------------------------------------------
  620. ; BIOS_FDRCHG - Ramps the audio volume from its current level to a new
  621. ; level at the requested rate. As in FDRSET, there's a delay of up to
  622. ; 13ms before the change starts.
  623. ;
  624. ; input:
  625. ; d1.l 32 bit volume change
  626. ; high word: new 16 bit volume ($0000 = min $0400 = max)
  627. ; low word: 16 bit rate in steps/vblank
  628. ; $0001 = slow
  629. ; $0200 = fast
  630. ; $0400 = set immediately
  631. ;
  632. ; returns:
  633. ; nothing
  634. ;-----------------------------------------------------------------------
  635. BIOS_FDRCHG macro
  636. CDBIOS #FDRCHG
  637. endm
  638.  
  639.  
  640. ;-----------------------------------------------------------------------
  641. ; CDC
  642. ;-----------------------------------------------------------------------
  643.  
  644. ;-----------------------------------------------------------------------
  645. ; BIOS_CDCSTART - Starts reading data from the current logical sector
  646. ; into the CDC. The BIOS pre-seeks by 2 to 4 sectors and data read
  647. ; actually begins before the requested sector. It's up to the caller
  648. ; to identify the correct starting sector (usually by checking the time
  649. ; codes in the headers as they're read from the CDC buffer).
  650. ;
  651. ; input:
  652. ; none
  653. ;
  654. ; returns:
  655. ; nothing
  656. ;-----------------------------------------------------------------------
  657. BIOS_CDCSTART macro
  658. CDBIOS #CDCSTART
  659. endm
  660.  
  661. ;-----------------------------------------------------------------------
  662. ; BIOS_CDCSTOP - Stops reading data into the CDC. If a sector is being
  663. ; read when CDCSTOP is called, it's lost.
  664. ;
  665. ; input:
  666. ; none
  667. ;
  668. ; returns:
  669. ; nothing
  670. ;-----------------------------------------------------------------------
  671. BIOS_CDCSTOP macro
  672. CDBIOS #CDCSTOP
  673. endm
  674.  
  675. ;-----------------------------------------------------------------------
  676. ; BIOS_CDCSTAT - Queries the CDC buffer. If no sector is ready for
  677. ; read, the carry bit will be set. Up to 5 sectors can be buffered in
  678. ; the CDC buffer.
  679. ;
  680. ; input:
  681. ; none
  682. ;
  683. ; returns:
  684. ; cc Sector available for read
  685. ; cs No sectors available
  686. ;-----------------------------------------------------------------------
  687. BIOS_CDCSTAT macro
  688. CDBIOS #CDCSTAT
  689. endm
  690.  
  691. ;-----------------------------------------------------------------------
  692. ; BIOS_CDCREAD - If a sector is ready in the CDC buffer, the BIOS
  693. ; prepares to send the sector to the current device destination. Make
  694. ; sure to set the device destination BEFORE calling CDCREAD. If a
  695. ; sector is ready, the carry bit will be cleared on return and it's
  696. ; necessary to respond with a call to CDCACK.
  697. ;
  698. ; input:
  699. ; none
  700. ;
  701. ; returns:
  702. ; cc Sector ready for transfer
  703. ; d0.l Sector header in BCD mm:ss:ff:md format where md is sector mode
  704. ; $00 = CD-DA
  705. ; $01 = CD-ROM mode 1
  706. ; $02 = CD-ROM mode 2
  707. ; cs Sector not ready
  708. ;-----------------------------------------------------------------------
  709. BIOS_CDCREAD macro
  710. CDBIOS #CDCREAD
  711. endm
  712.  
  713. ;-----------------------------------------------------------------------
  714. ; BIOS_CDCTRN - Uses the Sub-CPU to read one sector into RAM. The
  715. ; device destination must be set to SUB-CPU read before calling CDCTRN.
  716. ;
  717. ; input:
  718. ; a0.l address of sector destination buffer (at least 2336 bytes)
  719. ; a1.l address of header destination buffer (at least 4 bytes)
  720. ;
  721. ; returns:
  722. ; cc Sector successfully transferred
  723. ; cs Transfer failed
  724. ; a0.l Next sector destination address (a0 + 2336)
  725. ; a1.l Next header destination address (a1 + 4)
  726. ;-----------------------------------------------------------------------
  727. BIOS_CDCTRN macro
  728. CDBIOS #CDCTRN
  729. endm
  730.  
  731. ;-----------------------------------------------------------------------
  732. ; BIOS_CDCACK - Informs the CDC that the current sector has been read
  733. ; and the caller is ready for the next sector.
  734. ;
  735. ; input:
  736. ; none
  737. ;
  738. ; returns:
  739. ; nothing
  740. ;-----------------------------------------------------------------------
  741. BIOS_CDCACK macro
  742. CDBIOS #CDCACK
  743. endm
  744.  
  745.  
  746. ;-----------------------------------------------------------------------
  747. ; BIOS_CDCSETMODE - Tells the BIOS which mode to read the CD in. Accepts
  748. ; bit flags that allow selection of the three basic CD modes as follows:
  749. ;
  750. ; Mode 0 (CD-DA) 2
  751. ; Mode 1 (CD-ROM with full error correction) 0
  752. ; Mode 2 (CD-ROM with CRC only) 1
  753. ;
  754. ; input:
  755. ; d1.w FEDCBA9876543210
  756. ; ||||
  757. ; |||+--> CD Mode 2
  758. ; ||+---> CD-DA mode
  759. ; |+----> transfer error block with data
  760. ; +-----> re-read last data
  761. ;
  762. ; returns:
  763. ; nothing
  764. ;-----------------------------------------------------------------------
  765. BIOS_CDCSETMODE macro
  766. CDBIOS #CDCSETMODE
  767. endm
  768.  
  769.  
  770. ;-----------------------------------------------------------------------
  771. ; SUBCODES
  772. ;-----------------------------------------------------------------------
  773.  
  774. ;-----------------------------------------------------------------------
  775. ; BIOS_SCDINIT - Initializes the BIOS for subcode reads.
  776. ;
  777. ; input:
  778. ; a0.l address of scratch buffer (at least $750 long)
  779. ;
  780. ; returns:
  781. ; nothing
  782. ;-----------------------------------------------------------------------
  783. BIOS_SCDINIT macro
  784. CDBIOS #SCDINIT
  785. endm
  786.  
  787. ;-----------------------------------------------------------------------
  788. ; BIOS_SCDSTART - Enables reading of subcode data by the CDC.
  789. ;
  790. ; input:
  791. ; d1.w Subcode processing mode
  792. ; 0 = --------
  793. ; 1 = --RSTUVW
  794. ; 2 = PQ------
  795. ; 3 = PQRSTUVW
  796. ;
  797. ; returns:
  798. ; nothing
  799. ;-----------------------------------------------------------------------
  800. BIOS_SCDSTART macro
  801. CDBIOS #SCDSTART
  802. endm
  803.  
  804. ;-----------------------------------------------------------------------
  805. ; BIOS_SCDSTOP - Disables reading of subcode data by the CDC.
  806. ;
  807. ; input:
  808. ; none
  809. ;
  810. ; returns:
  811. ; nothing
  812. ;-----------------------------------------------------------------------
  813. BIOS_SCDSTOP macro
  814. CDBIOS #SCDSTOP
  815. endm
  816.  
  817. ;-----------------------------------------------------------------------
  818. ; BIOS_SCDSTAT - Checks subcode error status.
  819. ;
  820. ; input:
  821. ; none
  822. ;
  823. ; returns:
  824. ; d0.l errqcodecrc / errpackcirc / scdflag / restrcnt
  825. ; d1.l erroverrun / errpacketbufful / errqcodefufful / errpackfufful
  826. ;-----------------------------------------------------------------------
  827. BIOS_SCDSTAT macro
  828. CDBIOS #SCDSTAT
  829. endm
  830.  
  831. ;-----------------------------------------------------------------------
  832. ; BIOS_SCDREAD - Reads R through W subcode channels.
  833. ;
  834. ; input:
  835. ; a0.l address of subcode buffer (24 bytes minimum)
  836. ;
  837. ; returns:
  838. ; cc Read successful
  839. ; cs Read failed
  840. ; a0.l address of next subcode buffer (a0.l + 24)
  841. ;-----------------------------------------------------------------------
  842. BIOS_SCDREAD macro
  843. CDBIOS #SCDREAD
  844. endm
  845.  
  846. ;-----------------------------------------------------------------------
  847. ; BIOS_SCDPQ - Gets P & Q codes from subcode.
  848. ;
  849. ; input:
  850. ; a0.l address of Q code buffer (12 bytes minimum)
  851. ;
  852. ; returns:
  853. ; cc Read successful
  854. ; cs Read failed
  855. ; a0.l address of next Q code buffer (a0.l + 12)
  856. ;-----------------------------------------------------------------------
  857. BIOS_SCDPQ macro
  858. CDBIOS #SCDPQ
  859. endm
  860.  
  861. ;-----------------------------------------------------------------------
  862. ; BIOS_SCDPQL - Gets the last P & Q codes.
  863. ;
  864. ; input:
  865. ; a0.l address of Q code buffer (12 bytes minimum)
  866. ;
  867. ; returns:
  868. ; cc Read successful
  869. ; cs Read failed
  870. ; a0.l address of next Q code buffer (a0.l + 12)
  871. ;-----------------------------------------------------------------------
  872. BIOS_SCDPQL macro
  873. CDBIOS #SCDPQL
  874. endm
  875.  
  876.  
  877. ;-----------------------------------------------------------------------
  878. ; FRONT PANEL LEDS
  879. ;-----------------------------------------------------------------------
  880.  
  881. ;-----------------------------------------------------------------------
  882. ; BIOS_LEDSET - Controls the Ready and Access LED's on the front panel
  883. ; of the CD unit.
  884. ;
  885. ; input:
  886. ; d1.w MODE Ready (green) Access (red) System Indication
  887. ; ---------------------------------------------------------------
  888. ; off off only at reset
  889. ; LEDREADY (0) on blink CD ready / no disk
  890. ; LEDDISCIN (1) on off CD ready / disk ok
  891. ; LEDACCESS (2) on on CD accessing
  892. ; LEDSTANDBY (3) blink off standby mode
  893. ; LEDERROR (4) blink blink reserved
  894. ; LEDMODE5 (5) blink on reserved
  895. ; LEDMODE6 (6) off blink reserved
  896. ; LEDMODE7 (7) off on reserved
  897. ; LEDSYSTEM (?) rtn ctrl to BIOS
  898. ;
  899. ; returns:
  900. ; nothing
  901. ;-----------------------------------------------------------------------
  902. BIOS_LEDSET macro
  903. CDBIOS #LEDSET
  904. endm
  905.  
  906.  
  907. ;-----------------------------------------------------------------------
  908. ; Back-Up RAM
  909. ;-----------------------------------------------------------------------
  910.  
  911.  
  912. ;-----------------------------------------------------------------------
  913. ; NOTE: The backup ram on the super target devlopment systems is write
  914. ; protected if the production Boot Rom is being used. A
  915. ; Development Boot Rom must be obtained before the backup ram can
  916. ; be used.
  917. ;
  918. ; The name of the save game files must be registered with SOJ before
  919. ; a game can be shipped.
  920. ;
  921. ; Please make sure to read the CD Software Standards section in the
  922. ; manual. There is a section on backup ram standards that must be
  923. ; followed.
  924. ;
  925. ; For a full description of each Back-Up Ram function, see the BIOS
  926. ; section of the CD manual.
  927. ;
  928. ; Some of the Back-Up RAM functions require a string buffer to
  929. ; be passed into the function. Some of these functions return
  930. ; 0 terminated text strings.
  931. ;-------------------------------------------------------------------------
  932.  
  933.  
  934. ;-----------------------------------------------------------------------
  935. ; BIOS_BRMINIT - Prepares to write into and read from Back-Up Ram.
  936. ;
  937. ; input:
  938. ; a0.l pointer to scratch ram (size $640 bytes).
  939. ;
  940. ; a1.l pointer to the buffer for display strings (size: 12 bytes)
  941. ;
  942. ; returns:
  943. ; cc SEGA formatted RAM is present
  944. ; cs Not formatted or no RAM
  945. ; d0.w size of backup RAM $2(000) ~ $100(000) bytes
  946. ; d1.w 0 : No RAM
  947. ; 1 : Not Formatted
  948. ; 2 : Other Format
  949. ; a1.l pointer to display strings
  950. ;-----------------------------------------------------------------------
  951. BIOS_BRMINIT macro
  952. BURAM #BRMINIT
  953. endm
  954.  
  955. ;-----------------------------------------------------------------------
  956. ; BIOS_BRMSTAT - Returns how much Back-Up RAM has been used.
  957. ;
  958. ; input:
  959. ; a1.l pointer to display string buffer (size: 12 bytes)
  960. ;
  961. ; returns:
  962. ; d0.w number of blocks of free area
  963. ; d1.w number of files in directory
  964. ;-----------------------------------------------------------------------
  965. BIOS_BRMSTAT macro
  966. BURAM #BRMSTAT
  967. endm
  968.  
  969. ;-----------------------------------------------------------------------
  970. ; BIOS_BRMSERCH - Searches for the desired file in Back-Up Ram. The file
  971. ; names are 11 ASCII characters terminated with a 0.
  972. ;
  973. ; input:
  974. ; a0.l pointer to parameter (file name) table
  975. ; file name = 11 ASCII chars [0~9 A~Z_] 0 terminated
  976. ;
  977. ; returns:
  978. ; cc file name found
  979. ; cs file name not found
  980. ; d0.w number of blocks
  981. ; d1.b MODE
  982. ; 0 : normal
  983. ; -1 : data protected (with protect function)
  984. ; a0.l backup ram start address for search
  985. ;-----------------------------------------------------------------------
  986. BIOS_BRMSERCH macro
  987. BURAM #BRMSERCH
  988. endm
  989.  
  990. ;-----------------------------------------------------------------------
  991. ; BIOS_BRMREAD - reads data from Back-Up RAM.
  992. ;
  993. ; input:
  994. ; a0.l pointer to parameter (file name) table
  995. ; a1.l pointer to write buffer
  996. ;
  997. ; returns:
  998. ; cc Read Okay
  999. ; cs Error
  1000. ; d0.w number of blocks
  1001. ; d1.b MODE
  1002. ; 0 : normal
  1003. ; -1 : data protected
  1004. ;-----------------------------------------------------------------------
  1005. BIOS_BRMREAD macro
  1006. BURAM #BRMREAD
  1007. endm
  1008.  
  1009. ;-----------------------------------------------------------------------
  1010. ; BIOS_BRMWRITE - Writes data in Back-Up RAM.
  1011. ;
  1012. ; input:
  1013. ; a0.l pointer to parameter (file name) table
  1014. ; flag.b $00: normal
  1015. ; $FF: encoded (with protect function)
  1016. ; block_size.w $00: 1 block = $40 bytes
  1017. ; $FF: 1 block = $20 bytes
  1018. ; a1.l pointer to save data
  1019. ;
  1020. ; returns:
  1021. ; cc Okay, complete
  1022. ; cs Error, cannot write in the file
  1023. ;-----------------------------------------------------------------------
  1024. BIOS_BRMWRITE macro
  1025. BURAM #BRMWRITE
  1026. endm
  1027.  
  1028. ;-----------------------------------------------------------------------
  1029. ; BIOS_BRMDEL - Deletes data on Back-Up Ram.
  1030. ;
  1031. ; input:
  1032. ; a0.l pointer to parameter (file name) table
  1033. ;
  1034. ; returns:
  1035. ; cc deleted
  1036. ; cs not found
  1037. ;-----------------------------------------------------------------------
  1038. BIOS_BRMDEL macro
  1039. BURAM #BRMDEL
  1040. endm
  1041.  
  1042. ;-----------------------------------------------------------------------
  1043. ; BIOS_BRMFORMAT - First initializes the directory and then formats the
  1044. ; Back-Up RAM
  1045. ;
  1046. ; Call BIOS_BRMINIT before calling this function
  1047. ;
  1048. ; input:
  1049. ; none
  1050. ;
  1051. ; returns:
  1052. ; cc Okay, formatted
  1053. ; cs Error, cannot format
  1054. ;-----------------------------------------------------------------------
  1055. BIOS_BRMFORMAT macro
  1056. BURAM #BRMFORMAT
  1057. endm
  1058.  
  1059. ;-----------------------------------------------------------------------
  1060. ; BIOS_BRMDIR - Reads directory
  1061. ;
  1062. ; input:
  1063. ; d1.l H: number of files to skip when all files cannot be read in one try
  1064. ; L: size of directory buffer (# of files that can be read in the
  1065. ; directory buffer)
  1066. ; a0.l pointer to parameter (file name) table
  1067. ; a1.l pointer to directory buffer
  1068. ;
  1069. ; returns:
  1070. ; cc Okay, complete
  1071. ; cs Full, too much to read into directory buffer
  1072. ;-----------------------------------------------------------------------
  1073. BIOS_BRMDIR macro
  1074. BURAM #BRMDIR
  1075. endm
  1076.  
  1077. ;-----------------------------------------------------------------------
  1078. ; BIOS_BRMVERIFY - Checks data written on Back-Up Ram.
  1079. ;
  1080. ; input:
  1081. ; a0.l pointer to parameter (file name) table
  1082. ; flag.b $00: normal
  1083. ; $FF: encoded (with protect function)
  1084. ; block_size.w $00: 1 block = $40 bytes
  1085. ; $FF: 1 block = $20 bytes
  1086. ; a1.l pointer to save data
  1087. ;
  1088. ; returns:
  1089. ; cc Okay
  1090. ; cs Error
  1091. ; d0.w Error Number
  1092. ; -1 : Data does not match
  1093. ; 0 : File not found
  1094. ;-----------------------------------------------------------------------
  1095. BIOS_BRMVERIFY macro
  1096. BURAM #BRMVERIFY
  1097. endm
  1098.  
  1099.  
  1100.  
  1101. endif
  1102.  
  1103. ;-----------------------------------------------------------------------;
  1104. ; File Name - CDBIOS.INC ;
  1105. ; End of file ;
  1106. ;-----------------------------------------------------------------------;
  1107.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement