]> cloudbase.mooo.com Git - avrcpm.git/blame - avrcpm/z80/bios.asm
added Atmega8 support
[avrcpm.git] / avrcpm / z80 / bios.asm
CommitLineData
fdcfcd44
L
1; CP/M BIOS for avrcpm
2; Copyright (C) 2010 Sprite_tm
3;
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.
8;
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.
13;
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/>.
16
17
18org $4A00+$A800
19 jp boot
20 jp wboot
21 jp const
22 jp conin
23 jp conout
24 jp list
25 jp punch
26 jp reader
27 jp home
28 jp seldsk
29 jp settrk
30 jp setsec
31 jp setdma
32 jp read
33 jp write
34 jp listst
35 jp sectran
36
37boot:
38 xor a
39 ld (3),a
40 ld (4),a
41
42wboot:
43 ld a,'B'
44 out (2),a
45 ld a,'I'
46 out (2),a
47 ld a,'O'
48 out (2),a
49 ld a,'S'
50 out (2),a
51 ld a,13
52 out (2),a
53 ld a,10
54 out (2),a
55
56 ;ToDo: re-load CP/M
57
58 ld hl,firstBytes
59 ld de,0
60 ld c,100 ;7
61fbloop:
62 ld a,(hl)
63 ld (de),a
64 inc hl
65 inc de
66 dec c
67 jp nz,fbloop
68
69 ld c,0
70 jp $3400+$A800
71
72const:
73 in a,(0)
74 ret
75
76conin:
77 in a,(0)
78 cp $ff
79 jp nz,conin
80
81 in a,(1)
82 ret
83
84conout:
85 push af
86 ld a,c
87 out (2),a
88 pop af
89 ret
90
91list:
92 ret
93
94punch:
95 ret
96
97reader:
98 ld a,$1F
99 ret
100
101home:
102 push af
103 ld a,0
104 out (16),a
105 pop af
106 ret
107
108seldsk:
109 push af
110 ld a,c
111 cp 0
112 jp nz,seldsk_na
113 ld hl,dph
114 pop af
115 ret
116seldsk_na:
117 ld hl,0
118 pop af
119 ret
120
121settrk:
122 push af
123 ld a,c
124 out (16),a
125 pop af
126 ret
127
128setsec:
129 push af
130 ld a,c
131 out (18),a
132 pop af
133 ret
134
135setdma:
136 push af
137 ld a,c
138 out (20),a
139 ld a,b
140 out (21),a
141 pop af
142 ret
143
144read:
145 ld a,1
146 out (22),a
147 ld a,0
148 ret
149
150write:
151 ld a,2
152 out (22),a
153 ld a,0
154 ret
155
156listst:
157 ld a,0
158 ret
159
160sectran:
161 ;translate sector bc using table at de, res into hl
162 ;not implemented :)
163 ld h,b
164 ld l,c
165 ret
166
167
168firstBytes:
169 jp $4A03+$A800 ;JMP WBOOT
170 db 0 ;IOBYTE
171 db 0 ;user:drive
172 jp $3C06+$A800 ;JMP BDOS
173
174;Disk Parameter Header
175dph:
176 dw trans ;XLT: Address of translation table
177 dw 0 ;000: Scratchpad
178 dw 0 ;000: Scratchpad
179 dw 0 ;000: Scratchpad
180 dw dirbuf ;DIRBUF: Address of a dirbuff scratchpad
181 dw dpb ;DPB: Address of a disk parameter block
182 dw chk ;CSV: Address of scratchpad area for changed disks
183 dw all ;ALV: Address of an allocation info sratchpad
184
185dpb:
186 dw 26 ;SPT: sectors per track
187 db 3 ;BSH: data allocation block shift factor
188 db 7 ;BLM: Data Allocation Mask
189 db 0 ;Extent mask
190 dw 242 ;DSM: Disk storage capacity
191 dw 63 ;DRM, no of directory entries
192 db 192 ;AL0
193 db 0 ;AL1
194 dw 16 ;CKS, size of dir check vector
195 dw 2 ;OFF, no of reserved tracks
196
197trans:
198 db 0,1,2,3,4,5,6,7,8,9
199 db 10,11,12,13,14,15,16,17,18,19
200 db 19,20,21,22,23,24,25,26
201
202dirbuf:
203 ds 128
204
205chk:
206 ds 16
207
208all:
209 ds 31
210
211end