Mercurial > hg > Members > kono > nitros9-code
annotate level1/modules/boot_dw3.asm @ 2624:b8c7b7fbf3c9
Major changes:
o os9defs, rbfdefs, scfdefs now os9.d, rbf.d, and scf.d
o vtiodefs now broken into cocovtio.d (for coco and dragon) and atarivtio.d
o systype now broken into coco.d, dragon.d and atari.d
o all references to the above in other files have changed
author | Boisy Pitre <boisy.pitre@nuance.com> |
---|---|
date | Fri, 24 Feb 2012 08:51:08 -0600 |
parents | 27f07aa0bca0 |
children |
rev | line source |
---|---|
2180 | 1 ******************************************************************** |
2 * Boot - DriveWire 3 Boot Module | |
3 * | |
4 * $Id$ | |
5 * | |
6 * Edt/Rev YYYY/MM/DD Modified by | |
7 * Comment | |
8 * ------------------------------------------------------------------ | |
9 * 1 2008/02/09 Boisy G. Pitre | |
10 * Created. | |
11 | |
12 NAM Boot | |
13 TTL DriveWire Boot Module | |
14 | |
15 IFP1 | |
16 USE defsfile | |
2624 | 17 USE drivewire.d |
2180 | 18 ENDC |
19 | |
20 tylg SET Systm+Objct | |
21 atrv SET ReEnt+rev | |
22 rev SET 0 | |
23 edition SET 1 | |
24 | |
25 MOD eom,name,tylg,atrv,start,size | |
26 | |
27 * on-stack buffer to use | |
28 ORG 0 | |
29 seglist RMB 2 pointer to segment list | |
30 blockloc RMB 2 pointer to memory requested | |
31 blockimg RMB 2 duplicate of the above | |
32 bootloc RMB 3 sector pointer; not byte pointer | |
33 bootsize RMB 2 size in bytes | |
34 LSN0Ptr RMB 2 LSN0 pointer | |
35 size EQU . | |
36 | |
37 name EQU * | |
38 FCS /Boot/ | |
39 FCB edition | |
40 | |
41 | |
42 * Common booter-required defines | |
43 LSN24BIT EQU 1 | |
44 FLOPPY EQU 0 | |
45 | |
46 | |
47 USE boot_common.asm | |
48 | |
49 | |
50 ************************************************************ | |
51 ************************************************************ | |
52 * Hardware-Specific Booter Area * | |
53 ************************************************************ | |
54 ************************************************************ | |
55 | |
56 * HWInit - Initialize the device | |
57 * Entry: Y = hardware address | |
58 * Exit: Carry Clear = OK, Set = Error | |
59 * B = error (Carry Set) | |
60 HWInit | |
61 * Set up DDR for side B | |
62 * ldx #PIA1Base get base address of PIA | |
63 * ldb 3,x | |
64 * andb #%11111011 | |
65 * stb 3,x | |
66 * lda #%11111010 | |
67 * sta 2,x | |
68 * orb #%00000100 | |
69 * stb 3,x | |
70 | |
71 * Set up DDR for side A | |
72 * ldb 1,x | |
73 * andb #%11111011 | |
74 * stb 1,x $FF20 is now Data Direction Register | |
75 * lda #%11111110 data direction bits (1=out, 0=in) | |
76 * sta ,x tell HW | |
77 * orb #%00000100 reset $FF20 to I/O register | |
78 * stb 1,x $FF20 is now Data Direction Register | |
79 HWTerm clrb | |
80 rts | |
81 | |
82 | |
83 * HWRead - Read a 256 byte sector from the device | |
84 * Entry: Y = hardware address | |
85 * B = bits 23-16 of LSN | |
86 * X = bits 15-0 of LSN | |
87 * blockloc,u = ptr to 256 byte sector | |
88 * Exit: X = ptr to data (i.e. ptr in blockloc,u) | |
89 HWRead | |
90 pshs cc,d,x | |
91 * Send out op code and 3 byte LSN | |
92 lda #OP_READEX load A with READ opcode | |
93 Read2 ldb WhichDrv,pcr | |
94 std ,s | |
95 leax ,s | |
96 ldy #5 | |
2182 | 97 lbsr DWWrite send it to server |
2180 | 98 * Get 256 bytes of sector data |
99 ldx blockloc,u | |
2231
27f07aa0bca0
Updated modules to use Darren Atkinson's latest changes to low level read/write routines
boisy
parents:
2182
diff
changeset
|
100 ldy #256 |
2182 | 101 bsr DWRead read bytes from server |
2180 | 102 bcs ReadEr branch if framing error |
2231
27f07aa0bca0
Updated modules to use Darren Atkinson's latest changes to low level read/write routines
boisy
parents:
2182
diff
changeset
|
103 bne ReadEr2 |
2180 | 104 |
105 * Send two byte checksum | |
106 pshs y | |
107 leax ,s | |
108 ldy #2 | |
2182 | 109 lbsr DWWrite |
2231
27f07aa0bca0
Updated modules to use Darren Atkinson's latest changes to low level read/write routines
boisy
parents:
2182
diff
changeset
|
110 ldy #1 |
2182 | 111 bsr DWRead |
2180 | 112 leas 2,s |
113 bcs ReadEx | |
114 bne ReadEr2 | |
115 ldb ,s | |
116 beq ReadEx | |
117 cmpb #E_CRC | |
118 bne ReadEr | |
119 lda #OP_REREADEX | |
120 bra Read2 | |
121 ReadEx EQU * | |
122 leas 5,s eat stack | |
123 ldx blockloc,u | |
124 clrb | |
125 rts | |
126 ReadEr2 ldb #E$Read | |
127 ReadEr | |
128 leas 5,s eat stack | |
129 orcc #Carry | |
130 rts | |
131 | |
132 USE dwread.asm | |
133 USE dwwrite.asm | |
134 | |
135 IFGT Level-1 | |
136 Pad FILL $39,$1D0-3-2-1-* | |
137 ENDC | |
138 | |
139 Address FDB $0000 | |
140 WhichDrv FCB $00 | |
141 EMOD | |
142 eom EQU * | |
143 END |