]> cloudbase.mooo.com Git - avrcpm.git/blame - avr/dsk_cpm.asm
* cpm/BIOS.MAC
[avrcpm.git] / avr / dsk_cpm.asm
CommitLineData
7300c5e4
FZ
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$
29ce189c
L
21;
22
29ce189c
L
23#if CPMDSK_SUPPORT
24
29ce189c 25
29ce189c 26 .cseg
7300c5e4 27
ce520bff
L
28cpm_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
7300c5e4 33
637689de
L
34 add xl,temp ; add offset to startsector
35 adc xh,temp2
637689de
L
36 adc yl,_0
37 adc yh,_0
7300c5e4 38
7300c5e4
FZ
39 ret
40
29ce189c 41; ====================================================================
7300c5e4 42; Function: Add's a CP/M Partition to the Partition table
29ce189c
L
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:
7300c5e4
FZ
52; ====================================================================
53cpm_add_partition:
29ce189c 54
637689de
L
55 ldi temp,dskType_CPM
56 std y+0,temp
7300c5e4
FZ
57
58 ldd temp,z+PART_START
637689de 59 std y+1,temp
7300c5e4 60 ldd temp,z+PART_START+1
637689de 61 std y+2,temp
7300c5e4 62 ldd temp,z+PART_START+2
637689de 63 std y+3,temp
7300c5e4 64 ldd temp,z+PART_START+3
637689de 65 std y+4,temp
7300c5e4 66
637689de
L
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
7300c5e4 72 ldd temp,z+PART_SIZE
637689de 73 std y+5,temp
7300c5e4 74 ldd temp,z+PART_SIZE+1
637689de
L
75 std y+6,temp
76 rjmp cpm_add_e
77
78cpm_add_prune:
79 std y+5,_255
80 std y+6,_255
81
82cpm_add_e:
29ce189c
L
83 ret
84
ce520bff 85#endif /* CPMDSK_SUPPORT */
5482d75f
L
86
87; vim:set ts=8 noet nowrap
88