annotate level1/modules/boot_dw.asm @ 3130:e0614e08fa5e

l1 boot modules: Expand documentation and clean up code Tidy up white-space and indentation. Expand documentation to show C flag is important on return from HWRead. Expand documentation to show how/why/when filler is needed at end of file. Delete dead code in some places. No functional changes.
author Neal Crook <foofoobedoo@gmail.com>
date Sun, 04 Dec 2016 21:01:42 +0000
parents ce3dba57003b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2180
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
1 ********************************************************************
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
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
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
5 *
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
6 * $Id$
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
7 *
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
8 * Edt/Rev YYYY/MM/DD Modified by
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
9 * Comment
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
10 * ------------------------------------------------------------------
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
11 * 1 2008/02/09 Boisy G. Pitre
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
12 * Created.
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
13
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
14 NAM Boot
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
15 TTL DriveWire Boot Module
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
16
3130
e0614e08fa5e l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents: 2773
diff changeset
17 IFP1
2180
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
18 USE defsfile
2624
b8c7b7fbf3c9 Major changes:
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2231
diff changeset
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
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
21
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
22 tylg SET Systm+Objct
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
23 atrv SET ReEnt+rev
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
24 rev SET 0
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
25 edition SET 1
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
26
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
27 MOD eom,name,tylg,atrv,start,size
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
28
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
29 * on-stack buffer to use
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
30 ORG 0
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
31 seglist RMB 2 pointer to segment list
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
32 blockloc RMB 2 pointer to memory requested
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
33 blockimg RMB 2 duplicate of the above
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
34 bootloc RMB 3 sector pointer; not byte pointer
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
35 bootsize RMB 2 size in bytes
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
36 LSN0Ptr RMB 2 LSN0 pointer
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
37 size EQU .
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
38
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
39 name EQU *
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
40 FCS /Boot/
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
41 FCB edition
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
42
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
43
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
44 * Common booter-required defines
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
45 LSN24BIT EQU 1
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
46 FLOPPY EQU 0
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
47
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
48
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
49 USE boot_common.asm
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
50
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
51
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
52 ************************************************************
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
53 ************************************************************
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
54 * Hardware-Specific Booter Area *
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
55 ************************************************************
3130
e0614e08fa5e l1 boot modules: Expand documentation and clean up code
Neal Crook <foofoobedoo@gmail.com>
parents: 2773
diff changeset
56 ************************************************************
2180
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
57
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
58 * HWInit - Initialize the device
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
59 * Entry: Y = hardware address
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
60 * Exit: Carry Clear = OK, Set = Error
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
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
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
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
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
67
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
68
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
69 * HWRead - Read a 256 byte sector from the device
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
70 * Entry: Y = hardware address
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
71 * B = bits 23-16 of LSN
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
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
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
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
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
77 pshs cc,d,x
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
78 * Send out op code and 3 byte LSN
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
79 lda #OP_READEX load A with READ opcode
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
80 Read2 ldb WhichDrv,pcr
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
81 std ,s
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
82 leax ,s
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
83 ldy #5
2182
b1b374ada668 Added 38.4kbps routines from Darren Atkinson
boisy
parents: 2180
diff changeset
84 lbsr DWWrite send it to server
2180
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
85 * Get 256 bytes of sector data
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
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
b1b374ada668 Added 38.4kbps routines from Darren Atkinson
boisy
parents: 2180
diff changeset
88 bsr DWRead read bytes from server
2180
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
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
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
92 * Send two byte checksum
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
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
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
106 lda #OP_REREADEX
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
107 bra Read2
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
108 ReadEx EQU *
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
109 leas 5,s eat stack
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
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
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
112 rts
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
113 ReadEr2 ldb #E$Read
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
114 ReadEr
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
115 leas 5,s eat stack
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
116 orcc #Carry
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
117 rts
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
118
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
119 USE dwread.asm
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
120 USE dwwrite.asm
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
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
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
134
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
135 Address FDB $0000
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
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
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
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