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