1 ; Various functions for the Interaction with the CPM Filesystem
3 ; Copyright (C) 2010 Frank Zoll
5 ; This file is part of avrcpm.
7 ; avrcpm is free software: you can redistribute it and/or modify it
8 ; under the terms of the GNU General Public License as published by
9 ; the Free Software Foundation, either version 3 of the License, or
10 ; (at your option) any later version.
12 ; avrcpm is distributed in the hope that it will be useful,
13 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ; GNU General Public License for more details.
17 ; You should have received a copy of the GNU General Public License
18 ; along with avrcpm. If not, see <http://www.gnu.org/licenses/>.
23 #ifndef CPMDSK_SUPPORT
24 #define CPMDSK_SUPPORT 1
30 ;----------------------------------------------- Start of Code Segment
33 ; ====================================================================
34 ; Function: Does a Disk write operation
35 ; ====================================================================
37 ; --------------------------------------------------------------------
39 ; Variables : [r] seekdsk Number of Disk to Read
40 ; [r] seeksec Sector to read
41 ; [r] seektrk Track to read
42 ; hostdsk = host disk #, (partition #)
43 ; hostlba = host block #, relative to partition start
44 ; Read/Write "hostsize" bytes to/from hostbuf
45 ; --------------------------------------------------------------------
47 ; ====================================================================
59 rcall dsk_getpartentry ; get partition entry
61 lds temp,hostlba ; get sector to access
75 ldd xl,z+5 ; get disksize
78 cp temp,xl ; check given sector against disksize
103 ldd xl,z+1 ; get startsector of partition
108 add xl,temp ; add offset to startsector
133 ; ====================================================================
134 ; Function: Does a Disk write operation
135 ; ====================================================================
137 ; --------------------------------------------------------------------
139 ; Variables : [r] seekdsk Number of Disk to Read
140 ; [r] seeksec Sector to read
141 ; [r] seektrk Track to read
142 ; --------------------------------------------------------------------
144 ; ====================================================================
149 printstring "host write "
161 ; ====================================================================
162 ; Function: Does a Disk read operation
163 ; ====================================================================
165 ; --------------------------------------------------------------------
167 ; Variables : [r] seekdsk Number of Disk to Read
168 ; [r] seeksec Sector to read
169 ; [r] seektrk Track to read
170 ; --------------------------------------------------------------------
172 ; ====================================================================
176 printstring "host read "
195 ; ====================================================================
196 ; Function: Add's a CP/M Partition to the Partition table
197 ; ====================================================================
199 ; --------------------------------------------------------------------
201 ; Variables : [r] seekdsk Number of Disk to Read
202 ; [r] seeksec Sector to read
203 ; [r] seektrk Track to read
204 ; --------------------------------------------------------------------
206 ; ====================================================================
212 ldd temp,z+PART_START
214 ldd temp,z+PART_START+1
216 ldd temp,z+PART_START+2
218 ldd temp,z+PART_START+3
221 ldd temp,z+PART_SIZE+2
222 ldd temp2,z+PART_SIZE+3
223 or temp,temp2 ;part size larger than 65535 sectors?
228 ldd temp,z+PART_SIZE+1
241 ; vim:set ts=8 noet nowrap