553
|
1 ********************************************************************
|
|
2 * Boot - CoCo Emulator Virtual Hard Disk Booter
|
|
3 *
|
|
4 * $Id$
|
|
5 *
|
1354
|
6 * Edt/Rev YYYY/MM/DD Modified by
|
|
7 * Comment
|
553
|
8 * ------------------------------------------------------------------
|
1354
|
9 * 1 2002/10/10 Boisy G. Pitre
|
|
10 * Acquired from Robert Gault.
|
553
|
11
|
|
12 nam Boot
|
|
13 ttl CoCo Emulator Virtual Hard Disk Booter
|
|
14
|
|
15 ifp1
|
|
16 use defsfile
|
|
17 endc
|
|
18
|
|
19 tylg set Systm+Objct
|
|
20 atrv set ReEnt+rev
|
|
21 rev set 2
|
|
22
|
|
23 * This boot module is intended for either MESS or Jeff's emulator
|
|
24 * Written by Robert Gault based on a personal boot for an RGBDOS hard drive
|
|
25 * Hard Disk Interface registers for the VHD emulator drives
|
|
26
|
|
27 dataport equ $FF80
|
|
28 status equ dataport+3
|
|
29 commnd equ dataport+3
|
|
30 buffer equ dataport+4
|
|
31 lsn equ dataport
|
|
32
|
|
33
|
|
34 mod eom,name,tylg,atrv,start,size
|
|
35
|
|
36 blockloc rmb 2 pointer to memory requested
|
|
37 blockimg rmb 2 duplicate of the above
|
|
38 bootloc rmb 3 sector pointer; not byte pointer
|
|
39 bootsize rmb 2 size in bytes
|
|
40 size equ .
|
|
41
|
|
42 name fcs /Boot/
|
|
43 fcb 1
|
|
44 start clra
|
|
45 ldb #size
|
|
46 clean pshs a
|
|
47 decb
|
|
48 bne clean
|
|
49 tfr s,u get pointer to data area
|
|
50 pshs u save pointer to data area
|
|
51
|
|
52 lda #$d0 forced interrupt; kill floppy activity
|
|
53 sta $FF48 command register
|
|
54 clrb
|
|
55 pause decb
|
|
56 bne pause
|
|
57 lda $FF48 clear controller
|
|
58 clr $FF40 make sure motors are turned off
|
|
59 sta $FFD9 fast clock
|
|
60
|
|
61 * Request memory for LSN0
|
|
62 ldd #1
|
|
63 os9 F$SRqMem request one page of RAM
|
|
64 bcs error
|
|
65 bsr getpntr
|
|
66
|
|
67 * Get LSN0 into memory
|
|
68
|
|
69 clrb MSB sector
|
|
70 ldx #0 LSW sector
|
|
71 bsr mread
|
|
72 bcs error
|
|
73 ldd bootsize,u
|
|
74 beq error
|
|
75 pshs d
|
|
76
|
|
77 * Return memory
|
|
78
|
|
79 ldd #$100
|
|
80 ldu blockloc,u
|
|
81 os9 F$SRtMem
|
|
82 puls d
|
|
83 os9 F$BtMem
|
|
84 bcs error
|
|
85 bsr getpntr
|
|
86 std blockimg,u
|
|
87
|
|
88 * Get os9boot into memory
|
|
89
|
|
90 ldd bootsize,u
|
|
91 leas -2,s same as a PSHS D
|
|
92 getboot std ,s
|
|
93 ldb bootloc,u MSB sector location
|
|
94 ldx bootloc+1,u LSW sector location
|
|
95 bsr mread
|
|
96 ldd bootloc+1,u update sector location by one to 24bit word
|
|
97 addd #1
|
|
98 std bootloc+1,u
|
|
99 ldb bootloc,u
|
|
100 adcb #0
|
|
101 stb bootloc,u
|
|
102 inc blockloc,u update memory pointer for upload
|
|
103 ldd ,s update size of file left to read
|
|
104 subd #$100 file read one sector at a time
|
|
105 bhi getboot
|
|
106
|
|
107 leas 4+size,s reset the stack same as PULS U,D
|
|
108 ldd bootsize,u
|
|
109 ldx blockimg,u pointer to start of os9boot in memory
|
|
110 andcc #%11111110 clear carry
|
|
111 rts back to os9p1
|
|
112
|
|
113 error leas 2+size,s
|
|
114 ldb #E$NotRdy drive not ready
|
|
115 rts
|
|
116
|
|
117 getpntr tfr u,d save pointer to requested memory
|
|
118 ldu 2,s recover pointer to data stack
|
|
119 std blockloc,u
|
|
120 rts
|
|
121
|
|
122 mread tstb LSN0 high byte
|
|
123 bne read10
|
|
124 cmpx #0 LSN0 low word
|
|
125 bne read10
|
|
126 bsr read10
|
|
127 bcc readlsn0
|
|
128 rts
|
|
129
|
|
130 readlsn0 pshs a,x,y find location of boot track
|
|
131 ldy blockloc,u
|
|
132 lda DD.Bt,y os9boot pointer
|
|
133 ldx DD.Bt+1,y LSW of 24 bit address
|
|
134 sta bootloc,u
|
|
135 stx bootloc+1,u
|
|
136 ldx DD.BSZ,y os9boot size in bytes
|
|
137 stx bootsize,u
|
|
138 clra
|
|
139 puls a,x,y,pc
|
|
140
|
|
141 * Generic read
|
|
142
|
|
143 read10 clra
|
|
144 bsr setup
|
|
145 bra command
|
|
146
|
|
147 setup pshs x
|
|
148 stb lsn
|
|
149 stx lsn+1
|
|
150 ldx blockloc,u
|
|
151 stx buffer
|
|
152 puls x,pc
|
|
153
|
|
154 command
|
|
155 sta commnd
|
|
156 lda commnd
|
|
157 rts
|
|
158
|
|
159 * Fillers to get to $1D0
|
|
160
|
|
161 fill $39,$1D0-*-3
|
|
162
|
|
163 emod
|
|
164 eom equ *
|
|
165 end
|