home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / ENTERPRS / CPM / UTILS / A / BIOS-R62.LZH / CXEQU.LIB < prev    next >
Text File  |  2000-06-30  |  17KB  |  663 lines

  1.  
  2.  
  3.  
  4. $*MACRO
  5.  
  6. false        equ    0
  7. true        equ    not false
  8.  
  9. use$fast    equ    false
  10. use$6551    equ    false    ;true
  11.  
  12. use$vt100    equ    false
  13. use$1581    equ    true
  14. banked        equ    true
  15. EXTSYS        equ    false    ; use external system as disk and char I/O
  16. pre$release    equ    false
  17.  
  18. ; start at Jan 1,1978     78  79  80  81  82  83  84  85  86
  19. dt$hx$yr    equ    365+365+366+365+365+365+366+365+365
  20. ;    1985              1  2  3  4  5  6  7  8  9 10 11 12
  21. date$hex    equ    dt$hx$yr+31+28+31+30+28
  22.  
  23. date    macro
  24.     db    '28 May 87'
  25.     endm
  26. ;
  27. ;    this is only for Pre-Released versions (done in RED)
  28. ;
  29. warning    macro
  30.     if    pre$release
  31.      db    cr,lf,lf
  32.      db    esc,esc,esc,red+20h
  33.      db    'User Beware:',cr,lf
  34.         ;1234567890123456789012345678901234567890
  35.      db    '       This version of the software is a',cr,lf
  36.      db    '  PRE-RELEASE  for testing only.  It has',cr,lf
  37.      db    '  been tested but has not yet passed QA.',cr,lf
  38.      db    esc,esc,esc,purple+50h
  39.      endif
  40.     endm
  41.  
  42.  
  43. space    macro    ?x,for
  44. ?x    equ    start
  45. start    set    start+for
  46.     endm
  47.  
  48. ;
  49. ; boot memory map (bank 0 only)
  50. ;
  51. bios02        equ    3000h    ;
  52. block$buffer    equ    3400h    ; uses 2K
  53. boot$parm    equ    3C00h    ; uses about 256 bytes
  54. ;
  55. ; bank 0 low memory map
  56. ;
  57. ROM        equ    0000h
  58. VIC$color    equ    1000h    ; I/O page only (IO$0 selected)
  59. SYS$key$area    equ    1000h    ; 3 256 byte blocks (allow 4)
  60. screen$40    equ    1400h    ; 2 X 80 X 25 = 4000 
  61. BANK$parm$blk    equ    2400h    ; allow 0.5K of parameters
  62. BIOS8502    equ    2600h    ; 1.5K
  63. VIC$screen    equ    2C00h    ; 1K
  64. ccp$buffer    equ    3000h    ; 0c80h (allow 4K)
  65. bank0$free    equ    4000h    ; start of free area in bank 0
  66. ;
  67. ; mapped I/O locations
  68. ;
  69. VIC        equ    0D000h        ; 8564
  70. SID        equ    0D400h        ; 6581
  71. MMU        equ    0D500h        ; 8722
  72. DS8563        equ    0D600h        ; 8563
  73. INT$6551    equ    0D700h        ; 6551 (added to enginnerring units)
  74. VIC$C$H        equ    0D800h        ; (memory mapped only in IO$0)
  75. VIC$C$L        equ    01000h        ; (memory and i/o mapped in IO$0)
  76. CIA1        equ    0DC00h        ; 6526
  77. CIA2        equ    0DD00h        ; 6526
  78. USART        equ    0DE00h        ; 6551 (extrn card)
  79. RAM$dsk$base    equ    0DF00h        ; 8726
  80.  
  81. ;
  82. ; Common memory allocation
  83. ;
  84. int$block    equ    0FC00h    ; mode 2 interrupt pointers (to FDFDh) 
  85. parm$block    equ    0FD00h    ; system parameters
  86. @buffer        equ    0FE00h    ; disk buffer (256 bytes)
  87. ;            0FF00h    ; to 0FFFFh used by 8502
  88. ;
  89. ; the following are C128 system equates
  90. ;
  91. enable$z80    equ    0FFD0h        ; 8502 code
  92. return$z80    equ    0FFDCh
  93. enable$6502    equ    0FFE0h        ; Z80 code
  94. return$6502    equ    0FFEEh
  95.  
  96.     page
  97. start    set    parm$block+1    ; 1st byte used as Intterrupt pointer
  98. space    vic$cmd,1        ;; bios8502 command byte
  99. space    vic$drv,1        ;  bios8502 drive (bit 0 set, drv 0)
  100. space    vic$trk,1        ;; bios8502 track #
  101. space    vic$sect,1        ;; bios8502 sector #
  102. space    vic$count,1        ;  bios8502 sector count
  103. space    vic$data,1        ;; bios8502 data byte to/from
  104. space    cur$drv,1        ;  current disk installed to Vir. drive
  105. space    fast,1            ;  bit 0 set, drv 0 is fast. ect. 
  106.  
  107. space    key$tbl,2        ;; pointer to keyboard table
  108. space    fun$tbl,2        ;; pointer to function table
  109. space    color$tbl$ptr,2        ;; pointer to logical color table
  110. space    fun$offset,1        ;; function # to be preformed
  111. space    sound$1,2        ;;
  112. space    sound$2,2        ;;
  113. space    sound$3,2        ;;
  114.  
  115. space    @trk,2            ;; current track number
  116. space    @dma,2            ;; current DMA address
  117. ;
  118. ; below here not used by ROM
  119. ;
  120. space    @sect,2            ; current sector number
  121. space    @cnt,1            ; record count for multisector transfer
  122. space    @cbnk,1            ; bank for processor operations
  123. space    @dbnk,1            ; bank for DMA operations
  124. space    @adrv,1            ; currently selected disk drive
  125. space    @rdrv,1            ; controller relative disk drive
  126. space    sys$speed,0    ; byte value 0=1MHz, 1=2 MHz (no 40 column disp)
  127. space    ccp$count,1        ; number of records in the CCP (not used)
  128. space    stat$enable,1        ; status line enable
  129.                 ;  7 kybrd, key codes(1), functions(0)
  130.                 ;  6 40 column tracking on(0), off(1)
  131.                 ;  0 disk stat, enable(1), disable(0) 
  132. space    emulation$adr,2        ; address of current emulation
  133. space    usart$adr,2        ; PTR to 6551 reg (not used before 6 Dec 85)
  134. ; CXIO equates
  135. space    int$hl,2+20        ; interrupt HL hold location
  136. space    int$stack,0        ; currently only 10*2 used
  137. space    user$hl$temp,2        ; user function HL hold location
  138. space    hl$temp,2        ; misc temp storage (used by VECTOR)
  139. space    de$temp,2        ; misc temp storage (used by VECTOR)
  140. space    a$temp,1        ; misc temp storage (used by VECTOR)
  141. space    source$bnk,1        ; inter bank move source bank #
  142. space    dest$bnk,1        ; inter bank move dest bank #
  143. space    MFM$tbl$ptr,2        ; pointer to MFM table
  144. ; 1st release end (3 June and 1 Aug 85)
  145. space    prt$conv$1,2        ; pointer to printer 1 ASCII Conversion
  146. space    prt$conv$2,2        ; pointer to printer 2 ASCII Conversion
  147. space    key$FX$function,2
  148. space    XxD$config,1        ; bit 7    0 = no parity    1 = parity
  149.                 ; bit 6    0 = mark/space    1 = odd/even
  150.                 ; bit 5    0 = space/even    1 = mark/odd
  151.                 ; bit 1    0 = 1 stop bit    1 = 2 stop bits
  152.                 ; bit 0    0 = 7 data bits    1 = 8 data bits
  153.  
  154. space    RS232$status,1        ; bit 7, 1=send data, 0=no data
  155.                 ; bit 6, 1=sending data
  156.                 ; bit 5, 1=recv que active
  157.                 ; bit 4, 1=parity error
  158.                 ; bit 3, 1=framing error
  159.                 ; bit 2, 1=recv over run (no used)
  160.                 ; bit 1, 1=receiving data
  161.                 ; bit 0, 1=Data byte ready
  162.  
  163. space    xmit$data,1        ; data byte to send
  164. space    recv$data,1        ; received data byte
  165.  
  166. ;
  167. ; The following equates are used by the interrupt driven keyboard handler
  168. ;
  169. space    int$rate,1
  170. ;
  171. ;    1st byte is a pointer into table, 2nd to 12th byte represent
  172. ;    the keyboards current state (active low), NOTE: only
  173. ;    current if key$buffer is not full
  174. ;
  175. space    key$scan$tbl,12
  176. ;
  177. ;    keyboard roll over buffer
  178. ;
  179. key$buf$size    equ    8*2        ; must be an even number of bytes
  180. space    key$get$ptr,2
  181. space    key$put$ptr,2
  182. space    key$buffer,key$buf$size
  183. ;
  184. ;    software UART recv buffer
  185. ;
  186. RxD$buf$size    equ    64
  187. space    RxD$buf$count,1
  188. space    RxD$buf$put,1
  189. space    RxD$buf$get,1
  190. space    RxD$buffer,RxD$buf$size
  191. space    tick$vol,1
  192.  
  193. INT$vector    equ    0FDFDh        ;; contains a JMP int$handler
  194.                     ; (in common)
  195.     page
  196. ;===> 40 column misc parm
  197. start    set    BANK$parm$blk
  198. space    temp$1,2        ;;
  199. space    @off40,0        ;;
  200. space    cur$offset,2        ;;
  201. space    old$offset,1        ;;
  202. space    prt$flg,1        ;;
  203. space    flash$pos,2        ;;
  204. ;
  205. ;===> 40 column position and color storage
  206. space    paint$size,1        ;;
  207. space    char$adr$40,2        ;;
  208. space    char$col$40,1        ;;
  209. space    char$row$40,1        ;;
  210. space    attr$40,1        ;;
  211. space    bg$color$40,1        ;;
  212. space    bd$color$40,1        ;;
  213. space    rev$40,1        ;;
  214. ;
  215. ;===> 80 column position and color storage
  216. space    char$adr,2        ;;
  217. space    char$col,1        ;;
  218. space    char$row,1        ;;
  219. space    current$atr,1        ;;
  220. space    bg$color$80,1        ;;
  221. space    char$color$80,1        ;;
  222. ;    ROM uses localtions above this point
  223. ;
  224. ;===> Emulation parameters
  225. space    parm$base,2
  226. space    parm$area$80,3
  227.     ;    ds    2    ; 80 column exec$adr
  228.     ;    ds    1    ; 80 column row #
  229. space    parm$area$40,3
  230.     ;    ds    2    ; 40 column exec$adr
  231.     ;    ds    1    ; 40 column row #
  232. space    buffer$80$col,40*2
  233. ;
  234. ;===> CXIO parameters
  235. ;    int$count not used by releases past 10 Oct 85
  236. space    int$count,1        ; one added every 1/60th sec
  237. space    key$buf,1
  238. ;
  239. ;===> CXKEYS parameters
  240. space    key$down$tbl,11*2    ; not used any more (int code)
  241. ;;;;; free space above, new interrupt driven code does not require this space 
  242. ; control$keys    equ    key$down$tbl+11*2 ; byte, not used any more (int code)
  243.  
  244. space    commodore$mode,1
  245. space    msgptr,2
  246. space    offset,1
  247. space    cur$pos,1
  248. space    string$index,1
  249. ; 1st release end (3 June 85)
  250. space    sys$freq,1        ; -1=50Hz, 0=60Hz
  251. ; 2nd release end (1 Aug 85)
  252.  
  253.     page
  254.  
  255. ;===> temp ROM boot data storage
  256. blk$ptr$cnt    equ    32
  257. start    set    boot$parm
  258. space    load$count,2        ; number of 128 byte blocks to load
  259. space    ld$blk$ptr,2        ; current sector dma pointer
  260. space    blk$unld$ptr,2        ; read memory block (1k,2K) pointer
  261. space    block$size,1        ; block size (1K=32 or 2K=64)
  262. space    block$end,2        ; allow 48K cpm.sys to load
  263. space    block$ptrs,blk$ptr$cnt    ; end of block load buffer (+1K or +2K)
  264. space    info$buffer,12
  265.                     ; CPM3.sys load adr's and counts
  266. space    ext$num,1        ; CPM3.SYS current ext #
  267. space    retry,1+64
  268. space    boot$stack,0        ; allow 64 bytes of stack
  269.  
  270. ;===> special equates used by CXKEY
  271. special        equ    00010111b
  272. SF$exit        equ    001h        ; RETURN KEY
  273. SF$insert    equ    028h        ; PLUS KEY
  274. SF$delete    equ    02Bh        ; MINUS KEY
  275. alpha$toggle    equ    03Dh        ; commodore key
  276. alt$key        equ    050h        ; alterant key
  277. SF$left        equ    055h        ; left arrow key
  278. lf$arrow    equ    055h        ; left arrow key
  279. SF$right    equ    056h        ; right arrow key
  280. rt$arrow    equ    056h        ; right arrow key
  281.  
  282.  
  283. buff$large    equ    25
  284. buff$small    equ    7
  285. buff$pos    equ    7
  286.  
  287.  
  288.     page
  289. ;===> External RS232 interface controls
  290. rxd$6551    equ    0        ; read
  291. txd$6551    equ    0        ; write
  292. status$6551    equ    1        ; read
  293. reset$6551    equ    1        ; write
  294. command$6551    equ    2        ; read/write
  295. control$6551    equ    3        ; read/write
  296.  
  297. txrdy        equ    10h
  298. rxrdy        equ    08h
  299. cmd$init    equ    0bh    ; no parity, enable txd + rxd, interrupts off
  300. cntr$init$19200    equ    1Fh    ; 1 stop, 8 bits, 19200 baud 
  301. cntr$init$9600    equ    1Eh    ; 1 stop, 8 bits, 9600 baud (internal)
  302. cntr$init$600    equ    17h    ; 600 baud
  303.  
  304. ;===> memory management loactions
  305. mmu$start    equ    MMU
  306. conf$reg    equ    MMU        ; 3eh
  307. conf$reg$1     equ    MMU+1        ; 3fh
  308. conf$reg$2    equ    MMU+2        ; 7fh
  309. conf$reg$3    equ    MMU+3        ; 3eh
  310. conf$reg$4    equ    MMU+4        ; 7eh
  311. mode$reg    equ    MMU+5        ; b1h
  312. ram$reg        equ    MMU+6        ; 0bh 16K top Common
  313. page$0$l    equ    MMU+7        ; 00h
  314. page$0$h    equ    MMU+8        ; 01h
  315. page$1$l    equ    MMU+9        ; 01h    
  316. page$1$h    equ    MMU+10        ; 01h
  317. mmu$version    equ    MMU+11        ; ??h
  318.  
  319. enable$C64    equ    11110001b    ; FS=0
  320. z80$off        equ    10110001b    ; value to be write to enable 8502
  321. z80$on        equ    10110000b
  322. fast$rd$en    equ    Z80$on+0    ; fast serial read
  323. fast$wr$en    equ    Z80$on+8    ; fast serial write
  324. common$4K    equ    09h        ; top  4K common
  325. common$8K    equ    0ah        ; top  8K common
  326. common$16K    equ    0bh        ; top 16K common
  327.  
  328. ;===> preconfiguration maps
  329. force$map    equ    0ff00h
  330. bank$0        equ    0ff01h        ; 3fh
  331. bank$1        equ    0ff02h        ; 7fh
  332. io        equ    0ff03h        ; 3eh
  333. io$0        equ    0ff03h        ; 3eh
  334. io$1        equ    0ff04h        ; 7eh
  335.  
  336.     page
  337. ;===> 80 column display equates
  338. DS$index$reg    equ    DS8563
  339. DS$status$reg    equ    DS8563
  340. DS$data$reg    equ    DS8563+1
  341. ;===> register pointers
  342. DS$cursor$high    equ    14
  343. DS$cursor$low    equ    15
  344. DS$rw$ptr$high    equ    18
  345. DS$rw$ptr$low    equ    19
  346. DS$rw$data    equ    31
  347. DS$color    equ    26
  348. ;===> status bits
  349. DS$ready    equ    80h
  350. DS$lt$pen    equ    40h
  351. ;===> display memory layout  (16K) 0-3fffh 
  352. DS$screen    equ    0000h
  353. DS$attribute    equ    0800h
  354. DS$char$def    equ    2000h
  355. ;
  356. ;===> VIC equates  (8564)
  357. ;
  358. VIC$blk        equ    VIC+17        ; bit 4 = 1 for screen on
  359. VIC$blk$msk    equ    00010000b    ;
  360.  
  361. VIC$key$row    equ    VIC+47        ; output
  362.  
  363. VIC$speed    equ    VIC+48        ; bit 0 = 1 for fast
  364. VIC$speed$msk    equ    00000001b    ;
  365.  
  366. ; vic colors
  367. black        equ    0
  368. white        equ    1
  369. red        equ    2
  370. cyan        equ    3
  371. purple        equ    4
  372. green        equ    5
  373. blue        equ    6
  374. yellow        equ    7
  375. orange        equ    8
  376. brown        equ    9
  377. lt$red        equ    10
  378. dark$grey    equ    11
  379. med$gray    equ    12
  380. lt$green    equ    13
  381. lt$blue        equ    14
  382. lt$grey        equ    15
  383.  
  384.     page
  385.  
  386. RM$status    equ    RAM$dsk$base    ;read only register
  387. ;   bit 7    Interrupt pending if 1
  388. ;    6    Transfer complete if 1
  389. ;    5    Block verify error if 1
  390. ;   note:  bits 5-7 are cleared when read
  391. ;    4    128K if 0,  512K if 1
  392. ;    3-0    Version #
  393. ;
  394. RM$command    equ    RAM$dsk$base+1    ;r/w
  395. ;   bit    7    execute per current config. if set
  396. ;    6    reserved
  397. ;    5    enable auto reload if set (restores all register to
  398. ;            value before command was done, else point to
  399. ;            next byte to read/write.)
  400. ;    4    disable FF00 decode if set (do operation after command writen)
  401. ;    3,2    reserved
  402. ;    1,0    00 = transfer C128 --> Ram Disk
  403. ;        01 = Transfer C128 <-- Ram Disk
  404. ;        10 = swap     C128 <-> Ram Disk
  405. ;        11 = Verify   C128  =  Ram Disk
  406. ;
  407. RM$128$low    equ    RAM$dsk$base+2    ;r/w
  408. ;    bits 0 to 7 of C128 address
  409. ;
  410. RM$128$mid    equ    RAM$dsk$base+3    ;r/w
  411. ;    bits 8 to 15 of the C128 address
  412. ;
  413. RM$ext$low    equ    RAM$dsk$base+4    ;r/w
  414. ;    bits 0 to 7 of Ram Disk address
  415. ;
  416. RM$ext$mid    equ    RAM$dsk$base+5    ;r/w
  417. ;    bits 8 to 15 of Ram Disk address
  418. ;
  419. RM$ext$hi    equ    RAM$dsk$base+6    ;r/w
  420. ;    bit  16       of Ram Disk address if 128K version
  421. ;    bits 16 to 18 of Ram Disk address if 512K version
  422. ;
  423. RM$count$low    equ    RAM$dsk$base+7    ;r/w
  424. ;    low byte transfer count (bits 0-7)
  425. ;
  426. RM$count$hi    equ    RAM$dsk$base+8    ;r/w
  427. ;    hi byte transfer count  (bits 8-15)
  428. ;
  429. RM$intr$mask    equ    RAM$dsk$base+9    ;r/w
  430. ;   bit    7    1=enable chip interrupts
  431. ;    6    1=enable end of block interrupts
  432. ;    5    1=enable verify error interrupts
  433. ;
  434. RM$control    equ    RAM$dsk$base+10    ;r/w
  435. ;   bit    7,6        00    Increment both addresses  (default)
  436. ;        01    Fix expansion address
  437. ;        10    Fix C128 address
  438. ;        11    Fix both addresses
  439. ;
  440.  
  441.     page
  442. ;===> CIA equates
  443.  
  444. Data$a        equ    00h
  445. Data$b        equ    01h
  446. Data$dir$a    equ    02h
  447. Data$dir$b    equ    03h
  448. timer$a$low    equ    04h
  449. timer$a$high    equ    05h
  450. timer$b$low    equ    06h
  451. timer$b$high    equ    07h
  452. tod$sec$60    equ    08h
  453. tod$sec        equ    09h
  454. tod$min        equ    0ah
  455. tod$hrs        equ    0bh
  456. sync$data    equ    0ch
  457. int$ctrl    equ    0dh
  458. cia$ctrl$a    equ    0eh
  459. cia$ctrl$b    equ    0fh
  460. CIA$hours    equ    CIA1+tod$hrs
  461.  
  462. key$row        equ    CIA1+Data$a    ; output
  463. key$col        equ    CIA1+Data$b    ; input
  464.  
  465.  
  466. data$hi        equ    4        ; RS232 data line HI
  467. data$low    equ    0        ; RS232 data line LOW
  468.  
  469. lf$shift$key    equ    80h
  470. rt$shift$key    equ    10h
  471. commodore$key    equ    20h
  472. control$key    equ    04h
  473.  
  474. type$lower    equ    0
  475. type$upper    equ    1
  476. type$shift    equ    2
  477. type$cntrl    equ    3
  478. type$field    equ    00000011b
  479.     
  480.     page
  481.  
  482. bnk1    equ    1
  483. page0    equ    0
  484. page1    equ    1
  485.  
  486. MMU$tbl$M    macro
  487.     db    3fh,3fh,7fh,3eh,7eh        ; config reg's
  488.     db    z80$on,common$8K        ; mode & mem
  489.     db    page0,bnk1,page1,bnk1        ; page reg's 
  490.     endm
  491.  
  492.     page
  493. ;
  494. ;    ROM functions
  495. ;
  496. TJMP    macro    x
  497.     rst 2 ! db x
  498.     endm
  499.  
  500. TCALL    macro    x
  501.     mvi l,x ! rst 4
  502.     endm
  503.  
  504. RJMP    macro    x
  505.     rst 3 ! db x
  506.     endm
  507.  
  508. RCALL    macro    x
  509.     mvi l,x ! rst 5
  510.     endm
  511.  
  512. FR$40            equ    2    ; offset to 40 column ROM functions
  513.  
  514. FR$wr$char        equ    00h    ; D=char auto advance
  515. FR$cursor$pos        equ    04h    ; B=row, C=column
  516. FR$cursor$up        equ    08h
  517. FR$cursor$down        equ    0Ch
  518. FR$cursor$left        equ    10h
  519. FR$cursor$rt        equ    14h
  520. FR$do$cr        equ    18h
  521. FR$CEL            equ    1Ch
  522. FR$CES            equ    20h
  523. FR$char$ins        equ    24h
  524. FR$char$del        equ    28h
  525. FR$line$ins        equ    2Ch
  526. FR$line$del        equ    30h
  527. FR$color        equ    34h    ; B=color
  528. FR$attr            equ    38h    ; B=bit to set/clear, C=bit value
  529. FR$rd$chr$atr        equ    3Ch    ; in  D=row, E=col
  530.                     ; out H=row, L=col, B=char, C=attr(real)
  531. FR$wr$chr$atr        equ    40h    ; in  D=row, E=col, B=char, C=attr(real)
  532.                     ; out H=row, L=col
  533. FR$rd$color        equ    44h
  534. ;FR$wr$color        equ    48h
  535. ;            equ    4Ch
  536.  
  537.     page
  538. ;
  539. FR$trk$sect        equ    50h
  540. FR$check$CBM        equ    52h
  541. FR$bell            equ    54h
  542. ;            equ    56h
  543. ;            equ    58h
  544. ;            equ    5Ah
  545. ;            equ    5Ch
  546. ;            equ    5Eh
  547.  
  548. FR$trk$40        equ    60h
  549. FR$set$cur$40        equ    62h
  550. FR$line$paint        equ    64h
  551. FR$screen$paint        equ    66h
  552. FR$prt$msg$both        equ    68h
  553. FR$prt$de$both        equ    6Ah
  554. FR$update$it        equ    6Ch
  555. ;            equ    6Eh
  556.  
  557. FR$ASCII$to$pet        equ    70h
  558. FR$cur$adr$40        equ    72h
  559. FR$cur$adr$80        equ    74h
  560. FR$look$color        equ    76h
  561. ;            equ    78h
  562. FR$blk$fill        equ    7Ah    ; HL passed on the stack
  563. FR$blk$move        equ    7Ch    ; "
  564. FR$char$inst        equ    7Eh    ; "
  565.  
  566. ;
  567. ;    fixed ROM locations
  568. ;
  569. R$cmp$hl$de        equ    100h-6
  570. R$write$memory        equ    180h+0
  571. R$read$memory        equ    180h+3
  572. R$set$update$adr    equ    180h+6
  573. R$wait            equ    180h+9
  574.  
  575. R$status$color$tbl    equ    1000h-246-16
  576. R$color$convert$tbl    equ    1000h-230-16
  577.  
  578.     page
  579. ;
  580. ;    Disk type byte definition
  581. ;
  582. ;    bit    7    0=GCR,  1=MFM
  583. ;
  584. ;        if bit 7 is 1 (MFM)
  585. ;        6    C0=0,    C1=1    (side 2 #, 0 to (n/2)-1 or n/2 to n-1)
  586. ;        5,4    00=128, 01=256, 10=512, 11=1024  byte/sector
  587. ;        3,2,1    disk type (MFM)
  588. ;        0    starting sector # ( 0 or 1)
  589. ;
  590. ;        if bit 7 is 0 (GCR)
  591. ;        6    unused (set to 0)
  592. ;        5,4    01  (256 byte sectors) (for 1541or 1571)
  593. ;            10  (512 byte sectors) (for 1581)
  594. ;        3,2,1    disk type (GCR)
  595. ;            Type0 = none,  set track and sector as passed
  596. ;            Type1 = C64 CP/M   type disk (1541-71)
  597. ;            Type2 = C128 CP/M  type disk (1541-71) 
  598. ;        0    unused (set to 0)
  599.  
  600. MFM    equ    1*128
  601. C0    equ    0*64        ; 2nd side start at begining
  602. C1    equ    1*64        ; 2nd side continues from first
  603. C1$bit    equ    6
  604.  
  605. Type0    equ    0*2        ; (MFM)    top, bottom then next track
  606.                 ;     (TRK# 0 to (34 or 39))
  607. Type1    equ    1*2        ; (MFM)    top (trk 0 even), bottom (trk 1 odd)
  608.                 ;     (TRK# 0 to (69 or 79))
  609. Type2    equ    2*2        ; (MFM)    top TRK# 0 to 39, bottom TRK# 40 to 79 
  610.                 ;     (TRK# on back start at 39 and go to 0)
  611. Type7    equ    7*2        ; (MFM) pass the byte values supplied in @trk
  612.                 ;    and @sect
  613.  
  614. TypeX    equ    7*2
  615.  
  616. S0    equ    0*1        ; start at sector 0
  617. S1    equ    1*1        ; start at sector 1
  618.  
  619. S128    equ    0*16
  620. S256    equ    1*16
  621. S512    equ    2*16
  622. S1024    equ    3*16
  623.  
  624. ;
  625. dsk$none    equ    Type0+S256    ; access to any sector on the disk
  626. dsk$c64        equ    Type1+S256
  627. dsk$c128    equ    Type2+S256
  628. dsk$1581    equ    Type2+S512
  629.  
  630. dir$track    equ    18        ; C64   disk dir track
  631. c1581$dir$trk    equ    39        ; C1581 disk dir track
  632.  
  633.     page
  634. ;
  635. ;    6510 commands
  636. ;
  637. vic$reset    equ    -1    ; reboot C128
  638. vic$init    equ    0    ; initilize the bios8502
  639. vic$rd        equ    1    ; read one sector of data (256 bytes) 
  640. vic$wr        equ    2    ; write one sector of data
  641. vic$rdF        equ    3    ; set-up for fast read (many sectors)
  642. vic$wrF        equ    4    ; set-up for fast write
  643. vic$test    equ    5    ; test current disk in drive
  644. vic$query    equ    6    ; get start sectors and #sector/trk
  645. vic$prt        equ    7    ; print data character
  646. vic$frmt    equ    8    ; format a disk (1541)
  647. vic$user$fun    equ    9
  648. vic$RM$rd    equ    10    ; RAM disk read
  649. vic$RM$wr    equ    11    ; RAM disk write
  650.  
  651. ;
  652. ;    control charactors
  653. ;
  654. eom        equ    00h
  655. bell        equ    07h
  656. bs        equ    08h
  657. lf        equ    0ah
  658. cr        equ    0dh
  659. xon        equ    11h
  660. xoff        equ    13h
  661. esc        equ    1bh
  662.  
  663.