]> cloudbase.mooo.com Git - avrcpm.git/blob - avrcpm/cpm/ipl.mac
* ipl.mac added
[avrcpm.git] / avrcpm / cpm / ipl.mac
1 ; CP/M IPL for avrcpm
2 ;
3 ; Copyright (C) 2010 Sprite_tm
4 ;
5 ; This program is free software: you can redistribute it and/or modify
6 ; it under the terms of the GNU General Public License as published by
7 ; the Free Software Foundation, either version 3 of the License, or
8 ; (at your option) any later version.
9 ;
10 ; This program is distributed in the hope that it will be useful,
11 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ; GNU General Public License for more details.
14 ;
15 ; You should have received a copy of the GNU General Public License
16 ; along with this program. If not, see <http://www.gnu.org/licenses/>.
17 ;
18 ; $Id$
19 ;
20
21 ; IPL for the CP/M-emu in an AVR. Loads CPM from the 'disk' from
22 ; track 0 sector 2 to track 1 sector 26.
23
24 maclib CFGACPM.LIB
25
26 nsects equ 26*2 - 1 ;cold start sector count
27
28 .z80
29 aseg
30 org 100h
31 .phase 2000h
32
33 ld sp,2000h
34 ld hl,msgipl
35 call prmsg
36
37 ld b,nsects
38 ld de,0001h ;track 0, sector 1
39 ld hl,ccp
40 loadloop:
41 ld a,d ;track
42 out (16),a
43 ld a,e ;sector (base-0)
44 out (18),a
45 ld a,l ;dma L
46 out (20),a
47 ld a,h ;dma H
48 out (21),a
49 ld a,1 shl READ_FUNC
50 out (22),a
51
52 push bc
53 ld bc,128
54 add hl,bc
55 pop bc
56
57 inc e
58 ld a,e
59 cp 26
60 jp nz,noNextTrack
61
62 inc d
63 ld e,0
64
65 noNextTrack:
66 dec b
67 jp nz,loadloop
68
69 jp bios
70
71 prmsg:
72 ld a,(hl)
73 or a
74 ret z
75 out (2),a
76 inc hl
77 jp prmsg
78
79 msgipl: db cr,lf
80 db "ipl"
81 db 0
82
83 end
84