📄 l51_bank.lst
字号:
A51 MACRO ASSEMBLER L51_BANK 03/31/2006 10:32:12 PAGE 1
MACRO ASSEMBLER A51 V6.23
OBJECT MODULE PLACED IN .\Release\L51_BANK.obj
ASSEMBLER INVOKED BY: C:\Keil\C51\BIN\A51.EXE 09ctest\L51_BANK.A51 SET(SMALL) PRINT(.\L51_BANK.lst) OBJECT(.\Release\L51
_BANK.obj) EP
LOC OBJ LINE SOURCE
1 $nomod51 NOLINES
2 $nocond
3 ;------------------------------------------------------------------------------
4 ; This file is part of the BL51 / LX51 Banked Linker/Locater package
5 ; Copyright (c) 1988 - 2001 Keil Elektronik GmbH and Keil Software, Inc.
6 ; Version 2.12 (Code and Variable Banking for Classic 8051 Derivatives)
7 ;------------------------------------------------------------------------------
8 ;************************ Configuration Section *******************************
0004 9 ?B_NBANKS EQU 4 ; Define maximum Number of Banks *
10 ; ; following values are allowed: 2, 4, 8, 16, 32, 64 *
11 ; ; for BL51 the maximum value for ?B_BANKS is 32 *
12 ; ; for LX51 the maximum value for ?B_BANKS is 64 *
13 ; *
0000 14 ?B_MODE EQU 0 ; 0 for Bank-Switching via 8051 Port *
15 ; ; 1 for Bank-Switching via XDATA Port *
16 ; ; 4 for user-provided bank switch code *
17 ; *
0000 18 ?B_RTX EQU 0 ; 0 for applications without real-time OS *
19 ; ; 1 for applications using the RTX-51 real-time OS *
20 ; *
0000 21 ?B_VAR_BANKING EQU 0 ; Variable Banking via L51_BANK (far memory support)*
22 ; ; 0 Variable Banking does not use L51_BANK.A51 *
23 ; ; 1 Variable Banking uses this L51_BANK.A51 module *
24 ; Notes: ?B_VAR_BANKING uses the 'far' and 'far const' C51 memory types to *
25 ; extent the space for variables in RAM and/or ROM of classic 8051 *
26 ; device. The same hardware as for code banking is used. Program *
27 ; code banking and variable banking share the same hardware I/O pins. *
28 ; The C51 Compiler must be used with the VARBANKING directive. *
29 ; Variable Banking is only supported with the LX51 linker/locater. *
30 ; *
0000 31 ?B_RST_BANK EQU 0 ; specifies the active code bank number after CPU *
32 ; ; Reset. Used to reduce the entries in the *
33 ; ; INTERBANK CALL TABLE. The value 0xFF disables *
34 ; ; this LX51 linker/locater optimization. *
35 ; Note: Interbank Call Table optimization is only possible with LX51. *
36 ; *
37 ;-----------------------------------------------------------------------------*
38 ; *
39 IF ?B_MODE = 0; *
40 ;-----------------------------------------------------------------------------*
41 ; if ?BANK?MODE is 0 define the following values *
42 ; For Bank-Switching via 8051 Port define Port Address / Bits *
43 ; *
00B0 44 P3 DATA 0B0H ; I/O Port Address *
45 ; *
00B0 46 ?B_PORT EQU P3 ; default is P1 *
0004 47 ?B_FIRSTBIT EQU 4 ; default is Bit 4 *
48 ;-----------------------------------------------------------------------------*
49 ENDIF; *
50 ; *
ENDIF; *
59 ; *
ENDIF; *
114 ; *
ENDIF; *
135 ; *
136 ;******************************************************************************
A51 MACRO ASSEMBLER L51_BANK 03/31/2006 10:32:12 PAGE 2
137 ; *
138 ; THEORY OF OPERATION *
139 ; ------------------- *
140 ; The section below describes the code generated by BL51 or LX51 and the *
141 ; operation of the L51_BANK.A51 module. BL51/LX51 generates for each *
142 ; function that is located in a code memory bank and called from the common *
143 ; area or a different code bank and entry into the INTRABANK CALL TABLE. The *
144 ; INTRABANK CALL TABLE is located in the SEGMENT ?BANK?SELECT and listed in *
145 ; the Linker MAP file. The entries in that TABLE have the following format: *
146 ; *
147 ; ?FCT?1: MOV DPTR,#FCT ; Load Address of target FCT *
148 ; JMP ?B_BANKn ; Switch to Bank and Jump to Target Code *
149 ; *
150 ; Instead of directly calling the function FCT, the Linker changes the entry *
151 ; to ?FCT?1. This entry selects the bank where the function FCT is located *
152 ; and calls that function via the routines defined in this L51_BANK.A51 file. *
153 ; The L51_BANK.A51 file contains two sets of functions for each bank: *
154 ; *
155 ; ?B_BANKn is a routine which saves the entry of the ?B_SWITCHn function *
156 ; for the current active bank on the STACK and switches to the *
157 ; bank 'n'. Then it jumps to the address specified by the DPTR *
158 ; register. It is allowed to modify the following registers in *
159 ; the ?B_BANKn routine: A, B, R0, DPTR, PSW *
160 ; *
161 ; ?B_SWITCHn is a function which selects the bank 'n'. This function is *
162 ; used at the end of a user function to return to the calling *
163 ; code bank. Only the following registers may be altered in the *
164 ; ?B_SWITCHn function: R0, DPTR *
165 ; *
166 ; The current active bank is stored in ?B_CURRENTBANK. RTX-51 uses this *
167 ; variable to restore the code bank after a task switch. To get correct *
168 ; results, ?B_CURRENTBANK must be set to the code bank before the hardware *
169 ; switch is done, or the code banking sequences must be interrupt protected. *
170 ;******************************************************************************
171
172 NAME ?BANK?SWITCHING
173
174 PUBLIC ?B_NBANKS, ?B_MODE, ?B_CURRENTBANK, ?B_MASK
175 PUBLIC ?B_FACTOR, ?B_RST_BANK
ENDIF
179
180 ; Standard SFR Symbols required in L51_BANK.A51
00E0 181 ACC DATA 0E0H
00F0 182 B DATA 0F0H
0082 183 DPL DATA 82H
0083 184 DPH DATA 83H
00A8 185 IE DATA 0A8H
00AF 186 EA BIT IE.7
187
188
189 ; generate Mask and Bank Number Information
ELSEIF ?B_NBANKS <= 4
0003 193 MASK EQU 00000011B
ENDIF
203
204 IF ?B_MODE = 0 ;**************************************************************
205
0010 206 ?B_FACTOR EQU 1 SHL ?B_FIRSTBIT
207
0030 208 ?B_MASK EQU MASK SHL ?B_FIRSTBIT
209
210 BANKN MACRO N
211 BANK&N EQU N SHL ?B_FIRSTBIT
212 ENDM
213
0000 214 CNT SET 0
A51 MACRO ASSEMBLER L51_BANK 03/31/2006 10:32:12 PAGE 3
215
216 REPT ?B_NBANKS
217 BANKN %CNT
218 CNT SET CNT+1
219 ENDM
220+1 BANKN %CNT
223+1 BANKN %CNT
226+1 BANKN %CNT
229+1 BANKN %CNT
232
233
00B0 234 ?B_CURRENTBANK EQU ?B_PORT
235
ENDIF
314
315
316 IF ?B_RTX = 0 AND ?B_NBANKS <= 32
317 ; Convert Bank No in Accu to Address * 8
318
ENDIF
325
ENDIF
332
ENDIF
338
ENDIF
343
344 IF ?B_FIRSTBIT = 4
345 CONVBANKNO MACRO
346 RR A
347 ENDM
348 ENDIF
349
ENDIF
356
ENDIF
363
ENDIF
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -