?? l51_bank.lst
字號:
A51 MACRO ASSEMBLER L51_BANK 06/12/2006 17:23:05 PAGE 1
MACRO ASSEMBLER A51 V7.10
OBJECT MODULE PLACED IN .\obj\L51_BANK.obj
ASSEMBLER INVOKED BY: C:\Keil\C51\BIN\A51.EXE L51_BANK.A51 SET(LARGE) DEBUG PRINT(.\lst\L51_BANK.lst) OBJECT(.\obj\L51_B
ANK.obj) EP
LOC OBJ LINE SOURCE
1 $nomod51 NOLINES
2 $nocond
3 ;------------------------------------------------------------------------------
4 ; This file is part of the BL51 / L251 Banked Linker/Locater package
5 ; Copyright (c) 1988-1999 Keil Elektronik GmbH and Keil Software, Inc.
6 ; Version 2.0 (Code and Variable Banking for 8051 based Derivatives)
7 ;------------------------------------------------------------------------------
8 ;************************ Configuration Section *******************************
0010 9 ?B_NBANKS EQU 16 ; Define max. Number of Banks *
10 ; ; The following values are allowed: 2, 4, 8, 16, 32 *
11 ; ; the max. value for ?B_BANKS is 32 *
12 ; *
0000 13 ?B_MODE EQU 0 ; 0 for Bank-Switching via 8051 Port *
14 ; ; 1 for Bank-Switching via XDATA Port *
15 ; ; 4 for user-provided bank switch code *
16 ; *
0000 17 ?B_RTX EQU 0 ; 0 for applications without RTX-51 FULL *
18 ; ; 1 for applications using RTX-51 FULL *
19 ; *
0000 20 ?B_VAR_BANKING EQU 0 ; Enable Variable Banking in XDATA and CODE memory *
21 ; ; 0 Variable Banking is disabled *
22 ; ; 1 XDATA and CODE banking with same address lines *
23 ; ; 2 XDATA uses a different banking port *
24 ; *
ENDIF; *
39 ; *
40 IF ?B_MODE = 0; *
41 ;-----------------------------------------------------------------------------*
42 ; if ?BANK?MODE is 0 define the following values *
43 ; For Bank-Switching via 8051 Port define Port Address / Bits *
44 ; *
009A 45 ROMPAGE DATA 9AH ; I/O Port Address *
46 ; *
009A 47 ?B_PORT EQU ROMPAGE ; default is P1 *
0000 48 ?B_FIRSTBIT EQU 0 ; default is Bit 0 *
49 ;-----------------------------------------------------------------------------*
50 ENDIF; *
51 ; *
ENDIF; *
60 ; *
ENDIF; *
99 ; *
100 ;******************************************************************************
101 ; *
102 ; THEORY OF OPERATION *
103 ; ------------------- *
104 ; The section below describes the code generated by BL51 or L251 and the *
105 ; operation of the L51_BANK.A51 module. BL51/L251 generates for each *
106 ; function that is located in a code memory bank and called from the common *
107 ; area or a different code bank and entry into the INTRABANK CALL TABLE. The *
108 ; INTRABANK CALL TABLE is located in the SEGMENT ?BANK?SELECT and listed in *
109 ; the Linker MAP file. The entries in that TABLE have the following format: *
110 ; *
111 ; ?FCT?1: MOV DPTR,#FCT ; Load Address of target FCT *
112 ; JMP ?B_BANKn ; Switch to Bank and Jump to Target Code *
113 ; *
114 ; Instead of directly calling the function FCT, the Linker changes the entry *
A51 MACRO ASSEMBLER L51_BANK 06/12/2006 17:23:05 PAGE 2
115 ; to ?FCT?1. This entry selects the bank where the function FCT is located *
116 ; and calls that function via the routines defined in this L51_BANK.A51 file. *
117 ; The L51_BANK.A51 file contains two sets of functions for each bank: *
118 ; *
119 ; ?B_BANKn is a routine which saves the entry of the ?B_SWITCHn function *
120 ; for the current active bank on the STACK and switches to the *
121 ; bank 'n'. Then it jumps to the address specified by the DPTR *
122 ; register. It is allowed to modify the following registers in *
123 ; the ?B_BANKn routine: A, B, R0, DPTR, PSW *
124 ; *
125 ; ?B_SWITCHn is a function which selects the bank 'n'. This function is *
126 ; used at the end of a user function to return to the calling *
127 ; code bank. Only the following registers may be altered in the *
128 ; ?B_SWITCHn function: R0, DPTR *
129 ; *
130 ; The current active bank is stored in ?B_CURRENTBANK. RTX-51 uses this *
131 ; variable to restore the code bank after a task switch. To get correct *
132 ; results, ?B_CURRENTBANK must be set to the code bank before the hardware *
133 ; switch is done, or the code banking sequences must be interrupt protected. *
134 ;******************************************************************************
135
136 NAME ?BANK?SWITCHING
137
138 PUBLIC ?B_NBANKS, ?B_MODE, ?B_CURRENTBANK, ?B_MASK
139 PUBLIC ?B_FACTOR
140
141 ; Standard SFR Symbols required in L51_BANK.A51
00E0 142 ACC DATA 0E0H
00F0 143 B DATA 0F0H
0082 144 DPL DATA 82H
0083 145 DPH DATA 83H
146
147
148 ; generate Mask and Bank Number Information
ELSEIF ?B_NBANKS <= 16
000F 156 MASK EQU 00001111B
ENDIF
160
161 IF ?B_MODE = 0 ;**************************************************************
162
0001 163 ?B_FACTOR EQU 1 SHL ?B_FIRSTBIT
164
000F 165 ?B_MASK EQU MASK SHL ?B_FIRSTBIT
166
167 BANKN MACRO N
168 BANK&N EQU N SHL ?B_FIRSTBIT
169 ENDM
170
0000 171 CNT SET 0
172
173 REPT ?B_NBANKS
174 BANKN %CNT
175 CNT SET CNT+1
176 ENDM
177+1 BANKN %CNT
180+1 BANKN %CNT
183+1 BANKN %CNT
186+1 BANKN %CNT
189+1 BANKN %CNT
192+1 BANKN %CNT
195+1 BANKN %CNT
198+1 BANKN %CNT
201+1 BANKN %CNT
204+1 BANKN %CNT
207+1 BANKN %CNT
210+1 BANKN %CNT
A51 MACRO ASSEMBLER L51_BANK 06/12/2006 17:23:05 PAGE 3
213+1 BANKN %CNT
216+1 BANKN %CNT
219+1 BANKN %CNT
222+1 BANKN %CNT
225
226
009A 227 ?B_CURRENTBANK EQU ?B_PORT
228
229 ; Convert Bank No in Accu to Address * 8
230
231 IF ?B_FIRSTBIT = 0
232 CONVBANKNO MACRO
233 SWAP A
234 RR A
235 ENDM
236 ENDIF
237
ENDIF
244
ENDIF
250
ENDIF
255
ENDIF
261
ENDIF
268
ENDIF
275
ENDIF
281
282
283 SELECT MACRO N
284 LOCAL XLABEL, YLABEL
285
286 PUBLIC ?B_BANK&N
287 ?B_BANK&N:
288 MOV A,?B_CURRENTBANK
289 ANL A,#?B_MASK
290 ;; CJNE A,#BANK&N,XLABEL
291 ;; CLR A
292 ;; JMP @A+DPTR
293 ;;
294 ;;XLABEL:
295 CONVBANKNO ; Convert Bank Number to Address
296 PUSH ACC
297 MOV A,#HIGH ?BANK?SWITCH
298 PUSH ACC
299 ;;YLABEL:
300 PUSH DPL
301 PUSH DPH
302 LJMP ?B_SWITCH&N
303 ENDM
304
305
306 ?BANK?SELECT SEGMENT CODE
307
---- 308 RSEG ?BANK?SELECT
0000 309 CNT SET 0
310
311 REPT ?B_NBANKS
312 SELECT %CNT
313 CNT SET CNT+1
314
315 ENDM
316+1 SELECT %CNT
A51 MACRO ASSEMBLER L51_BANK 06/12/2006 17:23:05 PAGE 4
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -