]> 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 ; $Id$
18 ;
19
20 org $2000
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 READ_FUNC: equ 7
25 WRITE_FUNC: equ 6
26 BOOT_FUNC: equ 5
27 HOME_FUNC: equ 4
28
29 ld sp,$1000
30 ld hl,msgipl
31 call prmsg
32
33 ld b,51
34 ld de,$0001
35 ld hl,$3400+$A800
36 loadloop:
37 ld a,d ;track
38 out (16),a
39 ld a,e ; sector (base-0)
40 out (18),a
41 ld a,l ;dma L
42 out (20),a
43 ld a,h ;dma H
44 out (21),a
45 ld a,1<<READ_FUNC
46 out (22),a
47
48 push bc
49 ld bc,$80
50 add hl,bc
51 pop bc
52
53 inc e
54 ld a,e
55 cp 26
56 jp nz,noNextTrack
57
58 inc d
59 ld e,0
60
61 noNextTrack:
62
63 dec b
64 jp nz,loadloop
65
66 jp $4A00+$A800
67
68 prmsg:
69 ld a,(hl)
70 or a
71 ret z
72 out (2),a
73 inc hl
74 jp prmsg
75
76 msgipl: db cr,lf
77 db "ipl"
78 db 0
79
80 end