annotate level1/modules/boot_dw.asm @ 2773:ce3dba57003b lwtools-port

boot_dw now uses dwinit.asm. dwinit.asm updated for Arduino
author Boisy Pitre <boisy.pitre@nuance.com>
date Wed, 23 Jan 2013 14:54:29 -0600
parents 05b648103e78
children e0614e08fa5e
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
2624
b8c7b7fbf3c9 Major changes:
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2231
diff changeset
17 USE drivewire.d
2180
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
2773
ce3dba57003b boot_dw now uses dwinit.asm.
Boisy Pitre <boisy.pitre@nuance.com>
parents: 2724
diff changeset
61 use dwinit.asm
2180
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
62
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
63 HWTerm clrb
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
64 rts
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
65
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
66
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
67 * HWRead - Read a 256 byte sector from the device
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
68 * Entry: Y = hardware address
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
69 * B = bits 23-16 of LSN
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
70 * X = bits 15-0 of LSN
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
71 * blockloc,u = ptr to 256 byte sector
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
72 * Exit: X = ptr to data (i.e. ptr in blockloc,u)
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
73 HWRead
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
74 pshs cc,d,x
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
75 * Send out op code and 3 byte LSN
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
76 lda #OP_READEX load A with READ opcode
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
77 Read2 ldb WhichDrv,pcr
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
78 std ,s
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
79 leax ,s
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
80 ldy #5
2182
b1b374ada668 Added 38.4kbps routines from Darren Atkinson
boisy
parents: 2180
diff changeset
81 lbsr DWWrite send it to server
2180
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
82 * Get 256 bytes of sector data
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
83 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
84 ldy #256
2182
b1b374ada668 Added 38.4kbps routines from Darren Atkinson
boisy
parents: 2180
diff changeset
85 bsr DWRead read bytes from server
2180
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
86 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
87 bne ReadEr2
2180
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
88
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
89 * Send two byte checksum
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
90 pshs y
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
91 leax ,s
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
92 ldy #2
2182
b1b374ada668 Added 38.4kbps routines from Darren Atkinson
boisy
parents: 2180
diff changeset
93 lbsr DWWrite
2231
27f07aa0bca0 Updated modules to use Darren Atkinson's latest changes to low level read/write routines
boisy
parents: 2182
diff changeset
94 ldy #1
2182
b1b374ada668 Added 38.4kbps routines from Darren Atkinson
boisy
parents: 2180
diff changeset
95 bsr DWRead
2180
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
96 leas 2,s
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
97 bcs ReadEx
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
98 bne ReadEr2
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
99 ldb ,s
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
100 beq ReadEx
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
101 cmpb #E_CRC
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
102 bne ReadEr
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
103 lda #OP_REREADEX
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
104 bra Read2
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
105 ReadEx EQU *
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
106 leas 5,s eat stack
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
107 ldx blockloc,u
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
108 clrb
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
109 rts
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
110 ReadEr2 ldb #E$Read
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
111 ReadEr
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
112 leas 5,s eat stack
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
113 orcc #Carry
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
114 rts
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
115
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
116 USE dwread.asm
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
117 USE dwwrite.asm
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
118
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
119 IFGT Level-1
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
120 Pad FILL $39,$1D0-3-2-1-*
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
121 ENDC
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
122
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
123 Address FDB $0000
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
124 WhichDrv FCB $00
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
125 EMOD
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
126 eom EQU *
660cc987e18d Added DriveWire 3 modules to distribution
boisy
parents:
diff changeset
127 END