]> cloudbase.mooo.com Git - avrcpm.git/blob - avr/dsk_cpm.asm
Tag for Version 3.2
[avrcpm.git] / avr / dsk_cpm.asm
1 ; Various functions for the Interaction with the CPM Filesystem
2 ;
3 ; Copyright (C) 2010 Frank Zoll
4 ;
5 ; This file is part of avrcpm.
6 ;
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.
11 ;
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.
16 ;
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/>.
19 ;
20 ; $Id$
21 ;
22
23 #if CPMDSK_SUPPORT
24
25
26 .cseg
27
28 cpm_lba_to_phys:
29 ldd temp ,z+PTAB_START+0 ; get startsector of partition
30 ldd temp2,z+PTAB_START+1
31 ldd yl,z+PTAB_START+2
32 ldd yh,z+PTAB_START+3
33
34 add xl,temp ; add offset to startsector
35 adc xh,temp2
36 adc yl,_0
37 adc yh,_0
38
39 ret
40
41 ; ====================================================================
42 ; Function: Add's a CP/M Partition to the Partition table
43 ; ====================================================================
44 ; Parameters
45 ; --------------------------------------------------------------------
46 ; Registers : none
47 ; Variables : [r] seekdsk Number of Disk to Read
48 ; [r] seeksec Sector to read
49 ; [r] seektrk Track to read
50 ; --------------------------------------------------------------------
51 ; Description:
52 ; ====================================================================
53 cpm_add_partition:
54
55 ldi temp,dskType_CPM
56 std y+0,temp
57
58 ldd temp,z+PART_START
59 std y+1,temp
60 ldd temp,z+PART_START+1
61 std y+2,temp
62 ldd temp,z+PART_START+2
63 std y+3,temp
64 ldd temp,z+PART_START+3
65 std y+4,temp
66
67 ldd temp,z+PART_SIZE+2
68 ldd temp2,z+PART_SIZE+3
69 or temp,temp2 ;part size larger than 65535 sectors?
70 brne cpm_add_prune
71
72 ldd temp,z+PART_SIZE
73 std y+5,temp
74 ldd temp,z+PART_SIZE+1
75 std y+6,temp
76 rjmp cpm_add_e
77
78 cpm_add_prune:
79 std y+5,_255
80 std y+6,_255
81
82 cpm_add_e:
83 ret
84
85 #endif /* CPMDSK_SUPPORT */
86
87 ; vim:set ts=8 noet nowrap
88