annotate level1/modules/boot_dw3.asm @ 2224:22b75f9788a5

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