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
29 ;------------------------------------------ Defines for CPM Structures
34 #define PARTID_CPM 0x52 /* Partition table id */
35 /* http://www.win.tue.nl/~aeb/partitions/partition_types-1.html */
36 ;----------------------------------------------- Start of Data Segment
40 ;----------------------------------------------- Start of Code Segment
43 ; ====================================================================
44 ; Function: Does a Disk write operation
45 ; ====================================================================
47 ; --------------------------------------------------------------------
49 ; Variables : [r] seekdsk Number of Disk to Read
50 ; [r] seeksec Sector to read
51 ; [r] seektrk Track to read
52 ; hostdsk = host disk #, (partition #)
53 ; hostlba = host block #, relative to partition start
54 ; Read/Write "hostsize" bytes to/from hostbuf
55 ; --------------------------------------------------------------------
57 ; ====================================================================
69 rcall dsk_getpartentry ; get partition entry
71 lds temp,hostlba ; get sector to access
81 ldd xl,z+5 ; get disksize
85 cp temp,xl ; check given sector against disksize
111 ldd xl,z+1 ; get startsector of partition
116 add xl,temp ; add offset to startsector
141 ; ====================================================================
142 ; Function: Does a Disk write operation
143 ; ====================================================================
145 ; --------------------------------------------------------------------
147 ; Variables : [r] seekdsk Number of Disk to Read
148 ; [r] seeksec Sector to read
149 ; [r] seektrk Track to read
150 ; --------------------------------------------------------------------
152 ; ====================================================================
157 printstring "host write "
169 ; ====================================================================
170 ; Function: Does a Disk read operation
171 ; ====================================================================
173 ; --------------------------------------------------------------------
175 ; Variables : [r] seekdsk Number of Disk to Read
176 ; [r] seeksec Sector to read
177 ; [r] seektrk Track to read
178 ; --------------------------------------------------------------------
180 ; ====================================================================
184 printstring "host read "
203 ; ====================================================================
204 ; Function: Add's a CP/M Partition to the Partition table
205 ; ====================================================================
207 ; --------------------------------------------------------------------
209 ; Variables : [r] seekdsk Number of Disk to Read
210 ; [r] seeksec Sector to read
211 ; [r] seektrk Track to read
212 ; --------------------------------------------------------------------
214 ; ====================================================================
220 ldd temp,z+PART_START
222 ldd temp,z+PART_START+1
224 ldd temp,z+PART_START+2
226 ldd temp,z+PART_START+3
231 ldd temp,z+PART_SIZE+1
233 ldd temp,z+PART_SIZE+2
235 ldd temp,z+PART_SIZE+3