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 ; $Id: bios.asm 71 2010-08-06 19:38:10Z leo $
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
45 nsects equ ($-ccp)/128 ;warm start sector count
69 ;Drive A B C D E F G H I J K L
70 dphtab: dtbl <dpha,dphb,dphc,dphd, , , , ,dphi,dphj,dphk,dphl>
72 ; Name spt bls dks dir cks off
73 dpb0: dpb dpb243, 26, 1024, 243, 64, 64, 2
74 dpb dp8192s,32, 4096,2046, 512, 512, 2
75 dpb dp8192, 32, 4096,2046,1024,1024, 2
76 ; dpb dpbrd, 32, 1024, 56, 32, 0, 2
77 dpb rd1016, 32, 2048, 508, 192, 0, 2
78 dpb rd1024, 32, 2048, 512, 192, 0, 0
79 dpb rd0960, 32, 2048, 480, 192, 0, 0
99 db msize - (msize/10)*10 + '0' ;modulo doesn't work?
188 ld d,(hl) ;de = dpb of first ram disk
190 ; Check, if we have reserved tracks.
195 ld a,(hl) ;# of reserved tracks
198 jp z,boot1 ;Skip if not.
200 ; Save CPM to ram disk.
202 ld a,(de) ;sectors per track
209 ld d,1 ;sektor (0 based, skip ipl)
228 pop bc ;b = # of secs, c = track
235 cp d ;if sector >= spt then change tracks
258 ld a,1 shl BOOT_FUNC ;init (de)blocking
266 ld d,1 ;sektor (0 based)
293 cp d ;if sector >= spt then change tracks
323 msgSel: db 13,10,"Sel: ",0
330 ld a,(hl) ;get table entry for selected disk
334 or h ;no entry, no disk
340 ld a,e ;reselection bit
344 ; First select after (w)boot
346 in a,(15) ;querry, if disk exists
349 ld hl,0 ;error return code
356 ld bc,0 ; same as seek to track 0
385 and 3 ;mask write type
393 ;translate sector bc using table at de, res into hl