Mercurial > hg > Members > kono > nitros9-code
annotate level1/modules/boot_dw.asm @ 3132:9bb0c42d9fc6
Rename remaining Makefiles to makefile for consistency
author | Neal Crook <foofoobedoo@gmail.com> |
---|---|
date | Fri, 13 Jan 2017 19:52:26 +0000 |
parents | e0614e08fa5e |
children |
rev | line source |
---|---|
2180 | 1 ******************************************************************** |
2 * Boot - DriveWire 3 Boot Module | |
3130
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
3 * Provides HWInit, HWTerm, HWRead which are called by code in |
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
4 * "use"d boot_common.asm |
2180 | 5 * |
6 * $Id$ | |
7 * | |
8 * Edt/Rev YYYY/MM/DD Modified by | |
9 * Comment | |
10 * ------------------------------------------------------------------ | |
11 * 1 2008/02/09 Boisy G. Pitre | |
12 * Created. | |
13 | |
14 NAM Boot | |
15 TTL DriveWire Boot Module | |
16 | |
3130
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
17 IFP1 |
2180 | 18 USE defsfile |
2624 | 19 USE drivewire.d |
3130
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
20 ENDC |
2180 | 21 |
22 tylg SET Systm+Objct | |
23 atrv SET ReEnt+rev | |
24 rev SET 0 | |
25 edition SET 1 | |
26 | |
27 MOD eom,name,tylg,atrv,start,size | |
28 | |
29 * on-stack buffer to use | |
30 ORG 0 | |
31 seglist RMB 2 pointer to segment list | |
32 blockloc RMB 2 pointer to memory requested | |
33 blockimg RMB 2 duplicate of the above | |
34 bootloc RMB 3 sector pointer; not byte pointer | |
35 bootsize RMB 2 size in bytes | |
36 LSN0Ptr RMB 2 LSN0 pointer | |
37 size EQU . | |
38 | |
39 name EQU * | |
40 FCS /Boot/ | |
41 FCB edition | |
42 | |
43 | |
44 * Common booter-required defines | |
45 LSN24BIT EQU 1 | |
46 FLOPPY EQU 0 | |
47 | |
48 | |
49 USE boot_common.asm | |
50 | |
51 | |
52 ************************************************************ | |
53 ************************************************************ | |
54 * Hardware-Specific Booter Area * | |
55 ************************************************************ | |
3130
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
56 ************************************************************ |
2180 | 57 |
58 * HWInit - Initialize the device | |
59 * Entry: Y = hardware address | |
60 * Exit: Carry Clear = OK, Set = Error | |
61 * B = error (Carry Set) | |
3130
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
62 HWInit |
2773
ce3dba57003b
boot_dw now uses dwinit.asm.
Boisy Pitre <boisy.pitre@nuance.com>
parents:
2724
diff
changeset
|
63 use dwinit.asm |
2180 | 64 |
3130
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
65 HWTerm clrb |
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
66 rts |
2180 | 67 |
68 | |
69 * HWRead - Read a 256 byte sector from the device | |
70 * Entry: Y = hardware address | |
71 * B = bits 23-16 of LSN | |
72 * X = bits 15-0 of LSN | |
3130
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
73 * blockloc,u = ptr to 256 byte sector |
2180 | 74 * Exit: X = ptr to data (i.e. ptr in blockloc,u) |
3130
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
75 * Carry Clear = OK, Set = Error |
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
76 HWRead |
2180 | 77 pshs cc,d,x |
78 * Send out op code and 3 byte LSN | |
79 lda #OP_READEX load A with READ opcode | |
80 Read2 ldb WhichDrv,pcr | |
81 std ,s | |
82 leax ,s | |
83 ldy #5 | |
2182 | 84 lbsr DWWrite send it to server |
2180 | 85 * Get 256 bytes of sector data |
86 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
|
87 ldy #256 |
2182 | 88 bsr DWRead read bytes from server |
2180 | 89 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
|
90 bne ReadEr2 |
3130
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
91 |
2180 | 92 * Send two byte checksum |
93 pshs y | |
3130
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
94 leax ,s |
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
95 ldy #2 |
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
96 lbsr DWWrite |
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
97 ldy #1 |
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
98 bsr DWRead |
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
99 leas 2,s |
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
100 bcs ReadEx |
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
101 bne ReadEr2 |
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
102 ldb ,s |
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
103 beq ReadEx |
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
104 cmpb #E_CRC |
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
105 bne ReadEr |
2180 | 106 lda #OP_REREADEX |
107 bra Read2 | |
108 ReadEx EQU * | |
109 leas 5,s eat stack | |
110 ldx blockloc,u | |
3130
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
111 clrb |
2180 | 112 rts |
113 ReadEr2 ldb #E$Read | |
114 ReadEr | |
115 leas 5,s eat stack | |
116 orcc #Carry | |
117 rts | |
118 | |
119 USE dwread.asm | |
120 USE dwwrite.asm | |
121 | |
3130
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
122 IFGT Level-1 |
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
123 * L2 kernel file is composed of rel, boot, krn. The size of each of these |
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
124 * is controlled with filler, so that (after relocation): |
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
125 * rel starts at $ED00 and is $130 bytes in size |
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
126 * boot starts at $EE30 and is $1D0 bytes in size |
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
127 * krn starts at $F000 and ends at $FEFF (there is no 'emod' at the end |
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
128 * of krn and so there are no module-end boilerplate bytes) |
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
129 * |
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
130 * Filler to get to a total size of $1D0. 3, 2, 1 represent bytes after |
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
131 * the filler: the end boilerplate for the module, fdb and fcb respectively. |
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
132 Filler FILL $39,$1D0-3-2-1-* |
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
133 ENDC |
2180 | 134 |
135 Address FDB $0000 | |
136 WhichDrv FCB $00 | |
3130
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
137 |
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
138 EMOD |
2180 | 139 eom EQU * |
3130
e0614e08fa5e
l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents:
2773
diff
changeset
|
140 END |