]> cloudbase.mooo.com Git - avrcpm.git/blob - avrcpm/cpm/ipl.asm
* cpm/bios.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 cr: equ 13
21 lf: equ 10
22
23 READ_FUNC: equ 7
24 WRITE_FUNC: equ 6
25 BOOT_FUNC: equ 5
26 HOME_FUNC: equ 4
27
28 org $2000
29 ; IPL for the CP/M-emu in an AVR. Loads CPM from the 'disk' from
30 ; track 0 sector 2 to track 1 sector 26.
31
32 ld sp,$1000
33 ld hl,msgipl
34 call prmsg
35
36 ld b,51
37 ld de,$0001
38 ld hl,$3400+$A800
39 loadloop:
40 ld a,d ;track
41 out (16),a
42 ld a,e ; sector (base-0)
43 out (18),a
44 ld a,l ;dma L
45 out (20),a
46 ld a,h ;dma H
47 out (21),a
48 ld a,1<<READ_FUNC
49 out (22),a
50
51 push bc
52 ld bc,$80
53 add hl,bc
54 pop bc
55
56 inc e
57 ld a,e
58 cp 26
59 jp nz,noNextTrack
60
61 inc d
62 ld e,0
63
64 noNextTrack:
65
66 dec b
67 jp nz,loadloop
68
69 jp $4A00+$A800
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