2 ; Copyright (C) 2010 Sprite_tm
4 ; This program is free software: you can redistribute it and/or modify
5 ; it under the terms of the GNU General Public License as published by
6 ; the Free Software Foundation, either version 3 of the License, or
7 ; (at your option) any later version.
9 ; This program is distributed in the hope that it will be useful,
10 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 ; GNU General Public License for more details.
14 ; You should have received a copy of the GNU General Public License
15 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
20 msize: equ 62 ;size of available RAM in k
22 bias: equ (msize-20) * 1024
23 ccp: equ 3400h+bias ;base of cpm ccp
24 bdos: equ ccp+806h ;base of bdos
25 bios: equ ccp+1600h ;base of bios
26 cdisk: equ 0004h ;current disk number (0 ... 15)
27 iobyte: equ 0003h ;intel iobyte
28 buff: equ 0080h ;default buffer address
29 retry: equ 3 ;max retries on disk i/o before error
40 nsects: equ ($-ccp)/128 ;warm start sector count
64 db msize - (msize/10)*10 + '0' ;modulo doesn't work?
152 ld d,(hl) ;de = dpb of first ram disk
157 add 3 ;ToDo: this works only up to 252 dir entries
159 rrca ;4 dir entries per sector
160 rrca ;Number of sectors to init
165 ld c,(hl) ;Start track (= # of reserved tracks)
168 ; Check, if we have reserved tracks.
171 jp z,boot0 ;Skip if not.
173 ; Save CPM to ram disk.
175 ld a,(de) ;sectors per track
182 ld d,1 ;sektor (0 based)
208 cp d ;if sector >= spt then change tracks
223 ; Clear directory area of ram disk.
229 ld d,a ;d = # of sectors
232 ld hl,dirbuf ;Clear dirbuf
264 ld a,1<<BOOT_FUNC ;init (de)blocking
272 ld d,1 ;sektor (0 based)
299 cp d ;if sector >= spt then change tracks
334 ld a,(hl) ;get table entry for selected disk
338 or h ;no entry, no disk
343 in a,(15) ;querry, if disk exists
346 ld hl,0 ;error return code
353 ld bc,0 ; same as seek to track 0
382 and 3 ;mask write type
390 ;translate sector bc using table at de, res into hl
422 ;Disk Parameter Header
424 dpe0: dw 0 ;XLT: No sector translation table
425 dw 0 ;000: Scratchpad
426 dw 0 ;000: Scratchpad
427 dw 0 ;000: Scratchpad
428 dw dirbuf ;DIRBUF: Address of a dirbuff scratchpad
429 dw dpb ;DPB: Address of a disk parameter block
430 dw chk0 ;CSV: Address of scratchpad area for changed disks
431 dw all0 ;ALV: Address of an allocation info sratchpad
432 dpe1: dw 0 ;XLT: No sector translation table
433 dw 0 ;000: Scratchpad
434 dw 0 ;000: Scratchpad
435 dw 0 ;000: Scratchpad
436 dw dirbuf ;DIRBUF: Address of a dirbuff scratchpad
437 dw dpb ;DPB: Address of a disk parameter block
438 dw chk1 ;CSV: Address of scratchpad area for changed disks
439 dw all1 ;ALV: Address of an allocation info sratchpad
440 dpe2: dw 0 ;XLT: No sector translation table
441 dw 0 ;000: Scratchpad
442 dw 0 ;000: Scratchpad
443 dw 0 ;000: Scratchpad
444 dw dirbuf ;DIRBUF: Address of a dirbuff scratchpad
445 dw dpb ;DPB: Address of a disk parameter block
446 dw chk2 ;CSV: Address of scratchpad area for changed disks
447 dw all2 ;ALV: Address of an allocation info sratchpad
448 dpe3: dw 0 ;XLT: No sector translation table
449 dw 0 ;000: Scratchpad
450 dw 0 ;000: Scratchpad
451 dw 0 ;000: Scratchpad
452 dw dirbuf ;DIRBUF: Address of a dirbuff scratchpad
453 dw dpb ;DPB: Address of a disk parameter block
454 dw chk3 ;CSV: Address of scratchpad area for changed disks
455 dw all3 ;ALV: Address of an allocation info sratchpad
457 dperd0: dw 0 ;XLT: No sector translation table
458 dw 0 ;000: Scratchpad
459 dw 0 ;000: Scratchpad
460 dw 0 ;000: Scratchpad
461 dw dirbuf ;DIRBUF: Address of a dirbuff scratchpad
462 dw dpbrd ;DPB: Address of a disk parameter block
463 dw chkrd0 ;CSV: Address of scratchpad area for changed disks
464 dw allrd0 ;ALV: Address of an allocation info sratchpad
467 dpb: dw 26 ;SPT: sectors per track
468 db 3 ;BSH: data allocation block shift factor
469 db 7 ;BLM: Data Allocation Mask
471 dw 242 ;DSM: Disk storage capacity
472 dw 63 ;DRM, no of directory entries
475 dw 16 ;CKS, size of dir check vector
476 dw 2 ;OFF, no of reserved tracks
478 dpbrd: dw 32 ;SPT: sectors per track
479 db 3 ;BSH: data allocation block shift factor
480 db 7 ;BLM: Data Allocation Mask
482 dw 55 ;DSM: Disk storage capacity
483 dw 31 ;DRM, no of directory entries
486 dw 0 ;CKS, size of dir check vector
487 dw 2 ;OFF, no of reserved tracks