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/>.
17 msize: equ 62 ;size of available RAM in k
19 bias: equ (msize-20) * 1024
20 ccp: equ 3400h+bias ;base of cpm ccp
21 bdos: equ ccp+806h ;base of bdos
22 bios: equ ccp+1600h ;base of bios
23 cdisk: equ 0004h ;current disk number (0 ... 15)
24 iobyte: equ 0003h ;intel iobyte
25 buff: equ 0080h ;default buffer address
26 retry: equ 3 ;max retries on disk i/o before error
37 nsects: equ ($-ccp)/128 ;warm start sector count
61 db msize - (msize/10)*10 + '0' ;modulo doesn't work?
149 ld d,(hl) ;de = dpb of first ram disk
156 rrca ;4 dir entries per sector
157 rrca ;Number of sectors to init
162 ld c,(hl) ;Start track
165 ; Check, if we have reserved tracks.
168 jp z,boot0 ;Skip if not.
170 ; Save CPM to ram disk.
172 ld a,(de) ;sectors per track
179 ld d,1 ;sektor (0 based)
205 cp d ;if sector >= spt then change tracks
220 ; Clear directory area of ram disk.
226 ld d,a ;d = # of sectors
229 ld hl,dirbuf ;Clear dirbuf
261 ld a,1<<BOOT_FUNC ;init (de)blocking
269 ld d,1 ;sektor (0 based)
296 cp d ;if sector >= spt then change tracks
331 ld a,(hl) ;get table entry for selected disk
335 or h ;no entry, no disk
340 in a,(15) ;querry, if disk exists
343 ld hl,0 ;error return code
350 ld bc,0 ; same as seek to track 0
379 and 3 ;mask write type
387 ;translate sector bc using table at de, res into hl
419 ;Disk Parameter Header
421 dpe0: dw 0 ;XLT: No sector translation table
422 dw 0 ;000: Scratchpad
423 dw 0 ;000: Scratchpad
424 dw 0 ;000: Scratchpad
425 dw dirbuf ;DIRBUF: Address of a dirbuff scratchpad
426 dw dpb ;DPB: Address of a disk parameter block
427 dw chk0 ;CSV: Address of scratchpad area for changed disks
428 dw all0 ;ALV: Address of an allocation info sratchpad
429 dpe1: dw 0 ;XLT: No sector translation table
430 dw 0 ;000: Scratchpad
431 dw 0 ;000: Scratchpad
432 dw 0 ;000: Scratchpad
433 dw dirbuf ;DIRBUF: Address of a dirbuff scratchpad
434 dw dpb ;DPB: Address of a disk parameter block
435 dw chk1 ;CSV: Address of scratchpad area for changed disks
436 dw all1 ;ALV: Address of an allocation info sratchpad
437 dpe2: dw 0 ;XLT: No sector translation table
438 dw 0 ;000: Scratchpad
439 dw 0 ;000: Scratchpad
440 dw 0 ;000: Scratchpad
441 dw dirbuf ;DIRBUF: Address of a dirbuff scratchpad
442 dw dpb ;DPB: Address of a disk parameter block
443 dw chk2 ;CSV: Address of scratchpad area for changed disks
444 dw all2 ;ALV: Address of an allocation info sratchpad
445 dpe3: dw 0 ;XLT: No sector translation table
446 dw 0 ;000: Scratchpad
447 dw 0 ;000: Scratchpad
448 dw 0 ;000: Scratchpad
449 dw dirbuf ;DIRBUF: Address of a dirbuff scratchpad
450 dw dpb ;DPB: Address of a disk parameter block
451 dw chk3 ;CSV: Address of scratchpad area for changed disks
452 dw all3 ;ALV: Address of an allocation info sratchpad
454 dperd0: dw 0 ;XLT: No sector translation table
455 dw 0 ;000: Scratchpad
456 dw 0 ;000: Scratchpad
457 dw 0 ;000: Scratchpad
458 dw dirbuf ;DIRBUF: Address of a dirbuff scratchpad
459 dw dpbrd ;DPB: Address of a disk parameter block
460 dw chkrd0 ;CSV: Address of scratchpad area for changed disks
461 dw allrd0 ;ALV: Address of an allocation info sratchpad
464 dpb: dw 26 ;SPT: sectors per track
465 db 3 ;BSH: data allocation block shift factor
466 db 7 ;BLM: Data Allocation Mask
468 dw 242 ;DSM: Disk storage capacity
469 dw 63 ;DRM, no of directory entries
472 dw 16 ;CKS, size of dir check vector
473 dw 2 ;OFF, no of reserved tracks
475 dpbrd: dw 32 ;SPT: sectors per track
476 db 3 ;BSH: data allocation block shift factor
477 db 7 ;BLM: Data Allocation Mask
479 dw 55 ;DSM: Disk storage capacity
480 dw 31 ;DRM, no of directory entries
483 dw 0 ;CKS, size of dir check vector
484 dw 2 ;OFF, no of reserved tracks