annotate 3rdparty/booters/boot_vhd.asm @ 553:b93501797906

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