📄 l51_bank.lst
字号:
A51 MACRO ASSEMBLER L51_BANK 02/21/2005 09:48:31 PAGE 1
MACRO ASSEMBLER A51 V7.07
OBJECT MODULE PLACED IN L51_bank.OBJ
ASSEMBLER INVOKED BY: D:\PROGRAM FILES\KEIL\C51\BIN\A51.EXE L51_bank.a51 SET(SMALL) DEBUG 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.21 (Code and Variable Banking for Classic 8051 Derivatives)
7 ;------------------------------------------------------------------------------
8 ;************************ Configuration Section *******************************
0002 9 ?B_NBANKS EQU 2 ; 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 ; *
00FF 31 ?B_RST_BANK EQU 0xFF ; 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 ; *
0090 44 P1 DATA 90H ; I/O Port Address *
45 ; *
0090 46 ?B_PORT EQU P1 ; default is P1 *
0000 47 ?B_FIRSTBIT EQU 0 ; default is Bit 2 *
48 ;-----------------------------------------------------------------------------*
49 ENDIF; *
50 ; *
ENDIF; *
59 ; *
ENDIF; *
108 ; *
ENDIF; *
129 ; *
130 ;******************************************************************************
131 ; *
A51 MACRO ASSEMBLER L51_BANK 02/21/2005 09:48:31 PAGE 2
132 ; THEORY OF OPERATION *
133 ; ------------------- *
134 ; The section below describes the code generated by BL51 or LX51 and the *
135 ; operation of the L51_BANK.A51 module. BL51/LX51 generates for each *
136 ; function that is located in a code memory bank and called from the common *
137 ; area or a different code bank and entry into the INTRABANK CALL TABLE. The *
138 ; INTRABANK CALL TABLE is located in the SEGMENT ?BANK?SELECT and listed in *
139 ; the Linker MAP file. The entries in that TABLE have the following format: *
140 ; *
141 ; ?FCT?1: MOV DPTR,#FCT ; Load Address of target FCT *
142 ; JMP ?B_BANKn ; Switch to Bank and Jump to Target Code *
143 ; *
144 ; Instead of directly calling the function FCT, the Linker changes the entry *
145 ; to ?FCT?1. This entry selects the bank where the function FCT is located *
146 ; and calls that function via the routines defined in this L51_BANK.A51 file. *
147 ; The L51_BANK.A51 file contains two sets of functions for each bank: *
148 ; *
149 ; ?B_BANKn is a routine which saves the entry of the ?B_SWITCHn function *
150 ; for the current active bank on the STACK and switches to the *
151 ; bank 'n'. Then it jumps to the address specified by the DPTR *
152 ; register. It is allowed to modify the following registers in *
153 ; the ?B_BANKn routine: A, B, R0, DPTR, PSW *
154 ; *
155 ; ?B_SWITCHn is a function which selects the bank 'n'. This function is *
156 ; used at the end of a user function to return to the calling *
157 ; code bank. Only the following registers may be altered in the *
158 ; ?B_SWITCHn function: R0, DPTR *
159 ; *
160 ; The current active bank is stored in ?B_CURRENTBANK. RTX-51 uses this *
161 ; variable to restore the code bank after a task switch. To get correct *
162 ; results, ?B_CURRENTBANK must be set to the code bank before the hardware *
163 ; switch is done, or the code banking sequences must be interrupt protected. *
164 ;******************************************************************************
165
166 NAME ?BANK?SWITCHING
167
168 PUBLIC ?B_NBANKS, ?B_MODE, ?B_CURRENTBANK, ?B_MASK
169 PUBLIC ?B_FACTOR, ?B_RST_BANK
ENDIF
173
174 ; Standard SFR Symbols required in L51_BANK.A51
00E0 175 ACC DATA 0E0H
00F0 176 B DATA 0F0H
0082 177 DPL DATA 82H
0083 178 DPH DATA 83H
00A8 179 IE DATA 0A8H
00AF 180 EA BIT IE.7
181
182
183 ; generate Mask and Bank Number Information
184 IF ?B_NBANKS <= 2
0001 185 MASK EQU 00000001B
ENDIF
197
198 IF ?B_MODE = 0 ;**************************************************************
199
0001 200 ?B_FACTOR EQU 1 SHL ?B_FIRSTBIT
201
0001 202 ?B_MASK EQU MASK SHL ?B_FIRSTBIT
203
204 BANKN MACRO N
205 BANK&N EQU N SHL ?B_FIRSTBIT
206 ENDM
207
0000 208 CNT SET 0
209
A51 MACRO ASSEMBLER L51_BANK 02/21/2005 09:48:31 PAGE 3
210 REPT ?B_NBANKS
211 BANKN %CNT
212 CNT SET CNT+1
213 ENDM
214+1 BANKN %CNT
217+1 BANKN %CNT
220
221
0090 222 ?B_CURRENTBANK EQU ?B_PORT
223
ENDIF
302
303
304 IF ?B_RTX = 0 AND ?B_NBANKS <= 32
305 ; Convert Bank No in Accu to Address * 8
306
307 IF ?B_FIRSTBIT = 0
308 CONVBANKNO MACRO
309 SWAP A
310 RR A
311 ENDM
312 ENDIF
313
ENDIF
320
ENDIF
326
ENDIF
331
ENDIF
337
ENDIF
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -