📄 l51_bank.lst
字号:
A51 MACRO ASSEMBLER L51_BANK 03/28/2006 09:48:44 PAGE 1
MACRO ASSEMBLER A51 V8.00
OBJECT MODULE PLACED IN L51_BANK.OBJ
ASSEMBLER INVOKED BY: C:\Keil\C51\BIN\A51.EXE L51_BANK.A51 SET(LARGE) 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 *******************************
0008 9 ?B_NBANKS EQU 8 ; 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 ; *
0001 14 ?B_MODE EQU 1 ; 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 ; *
ENDIF; *
50 ; *
51 IF ?B_MODE = 1; *
52 ;-----------------------------------------------------------------------------*
53 ; if ?BANK?MODE is 1 define the following values *
54 ; For Bank-Switching via XDATA Port define XDATA Port Address / Bits *
02E0 55 ?B_XDATAPORT EQU 2E0H ; default is XDATA Port Address 0FFFFH *
0000 56 ?B_FIRSTBIT EQU 0 ; default is Bit 0 *
57 ;-----------------------------------------------------------------------------*
58 ENDIF; *
59 ; *
ENDIF; *
118 ; *
ENDIF; *
139 ; *
140 ;******************************************************************************
141 ; *
142 ; THEORY OF OPERATION *
143 ; ------------------- *
144 ; The section below describes the code generated by BL51 or LX51 and the *
A51 MACRO ASSEMBLER L51_BANK 03/28/2006 09:48:44 PAGE 2
145 ; operation of the L51_BANK.A51 module. BL51/LX51 generates for each *
146 ; function that is located in a code memory bank and called from the common *
147 ; area or a different code bank and entry into the INTRABANK CALL TABLE. The *
148 ; INTRABANK CALL TABLE is located in the SEGMENT ?BANK?SELECT and listed in *
149 ; the Linker MAP file. The entries in that TABLE have the following format: *
150 ; *
151 ; ?FCT?1: MOV DPTR,#FCT ; Load Address of target FCT *
152 ; JMP ?B_BANKn ; Switch to Bank and Jump to Target Code *
153 ; *
154 ; Instead of directly calling the function FCT, the Linker changes the entry *
155 ; to ?FCT?1. This entry selects the bank where the function FCT is located *
156 ; and calls that function via the routines defined in this L51_BANK.A51 file. *
157 ; The L51_BANK.A51 file contains two sets of functions for each bank: *
158 ; *
159 ; ?B_BANKn is a routine which saves the entry of the ?B_SWITCHn function *
160 ; for the current active bank on the STACK and switches to the *
161 ; bank 'n'. Then it jumps to the address specified by the DPTR *
162 ; register. It is allowed to modify the following registers in *
163 ; the ?B_BANKn routine: A, B, R0, DPTR, PSW *
164 ; *
165 ; ?B_SWITCHn is a function which selects the bank 'n'. This function is *
166 ; used at the end of a user function to return to the calling *
167 ; code bank. Only the following registers may be altered in the *
168 ; ?B_SWITCHn function: R0, DPTR *
169 ; *
170 ; The current active bank is stored in ?B_CURRENTBANK. RTX-51 uses this *
171 ; variable to restore the code bank after a task switch. To get correct *
172 ; results, ?B_CURRENTBANK must be set to the code bank before the hardware *
173 ; switch is done, or the code banking sequences must be interrupt protected. *
174 ;******************************************************************************
175
176 NAME ?BANK?SWITCHING
177
178 PUBLIC ?B_NBANKS, ?B_MODE, ?B_CURRENTBANK, ?B_MASK
179 PUBLIC ?B_FACTOR, ?B_RST_BANK
ENDIF
183
184 ; Standard SFR Symbols required in L51_BANK.A51
00E0 185 ACC DATA 0E0H
00F0 186 B DATA 0F0H
0082 187 DPL DATA 82H
0083 188 DPH DATA 83H
00A8 189 IE DATA 0A8H
00AF 190 EA BIT IE.7
191
192
193 ; generate Mask and Bank Number Information
ELSEIF ?B_NBANKS <= 8
0007 199 MASK EQU 00000111B
ENDIF
207
ENDIF ; close block IF ?B_MODE = 0 *******************************************
455
456
457 IF ?B_MODE = 1 ;***************************************************************
458
0001 459 ?B_FACTOR EQU 1 SHL ?B_FIRSTBIT
460
0007 461 ?B_MASK EQU MASK SHL ?B_FIRSTBIT
462
463 BANKN MACRO N
464 BANK&N EQU N SHL ?B_FIRSTBIT
465 ENDM
466
0000 467 CNT SET 0
468
A51 MACRO ASSEMBLER L51_BANK 03/28/2006 09:48:44 PAGE 3
469 REPT ?B_NBANKS
470 BANKN %CNT
471 CNT SET CNT+1
472 ENDM
473+1 BANKN %CNT
476+1 BANKN %CNT
479+1 BANKN %CNT
482+1 BANKN %CNT
485+1 BANKN %CNT
488+1 BANKN %CNT
491+1 BANKN %CNT
494+1 BANKN %CNT
497
498
499 ?C_INITSEG SEGMENT CODE ; Segment for Variable Initialization
---- 500 RSEG ?C_INITSEG
0000 01 501 DB 01H ; IData
0001 00 F 502 DB ?B_CURRENTBANK ; Init Current Bank
0002 00 503 DB 0 ; Set to Zero
0003 41 504 DB 41H ; XData
0004 02E0 505 DW ?B_XDATAPORT ; Init XDATA Port
0006 00 506 DB 0 ; Set to Zero
507
508 PUBLIC ?B_XDATAPORT
509
510 ?BANK?DATA SEGMENT DATA
---- 511 RSEG ?BANK?DATA
0000 512 ?B_CURRENTBANK: DS 1
513
514
ENDIF
591
592
593 IF ?B_NBANKS <= 16
594 ; Convert Bank No in Accu to Address * 16
595 IF ?B_FIRSTBIT = 0
596 CONVBANKNO MACRO
597 SWAP A
598 ENDM
599 ENDIF
600
ENDIF
607
ENDIF
614
ENDIF
620
ENDIF
625
ENDIF
631
ENDIF
638
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -