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