⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 l51_bank.lst

📁 A rtx51 tiny example program
💻 LST
📖 第 1 页 / 共 2 页
字号:
A51 MACRO ASSEMBLER  L51_BANK                                                             03/23/2009 13:06:23 PAGE     1


MACRO ASSEMBLER A51 V8.00d
OBJECT MODULE PLACED IN l51_bank.OBJ
ASSEMBLER INVOKED BY: d:\Keil\C51\BIN\A51.EXE l51_bank.a51 SET(SMALL) DEBUG XREF EP

LOC  OBJ            LINE     SOURCE

                       1     $nomod51  NOLINES
                       2     $nocond 
                       3     ;
                       4     ;  *** <<< Use Configuration Wizard in Context Menu >>> ***
                       5     ;------------------------------------------------------------------------------
                       6     ;  This file is part of the BL51 / LX51 Banked Linker/Locater package
                       7     ;  Copyright (c) 1988 - 2001 Keil Elektronik GmbH and Keil Software, Inc.
                       8     ;  Version 2.22 (Code and Variable Banking for Classic 8051 Derivatives)
                       9     ;------------------------------------------------------------------------------
                      10     ;************************ Configuration Section *******************************
                      11     ;<h> Bank Configuration
                      12     ;
                      13     ;     <i> Program Code in expanded memory is supported via the code banking mechanism
                      14     ;     <i> known from the classic 8051 architecture.  You need to specify the number
                      15     ;     <i> of code banks that are required for your application.
                      16     ;
                      17     ; <o> ?B_NBANKS: Number of Banks
                      18     ;                    <2=> 2
                      19     ;                    <4=> 4
                      20     ;                    <8=> 8
                      21     ;                    <16=> 16
                      22     ;                    <32=> 32
                      23     ;                    <64=> 64
                      24     ;                         <i> For BL51 the maximum value for ?B_NBANKS is 32
                      25     ;                         <i> For LX51 the maximum value for ?B_NBANKS is 64
  0004                26     ?B_NBANKS       EQU  4    ; Define maximum Number of Banks
                      27     ;                         ; following values are allowed: 2, 4, 8, 16, 32, 64
                      28     ;                         ; for BL51 the maximum value for ?B_NBANKS is 32
                      29     ;                         ; for LX51 the maximum value for ?B_NBANKS is 64
                      30     ;
                      31     ; <o> ?B_MODE: Bank Switching via
                      32     ;                    <0=> 8051 Port
                      33     ;                    <1=> XDATA Port
                      34     ;                    <4=> User-provided bank switch code
  0000                35     ?B_MODE         EQU  0    ; 0 for Bank-Switching via 8051 Port
                      36     ;                         ; 1 for Bank-Switching via XDATA Port
                      37     ;                         ; 4 for user-provided bank switch code
                      38     ;
                      39     ; <q> ?B_RTX: The application uses RTX-51 Real-time OS
  0001                40     ?B_RTX          EQU  1    ; 0 for applications without real-time OS
                      41     ;                         ; 1 for applications using the RTX-51 real-time OS
                      42     ;
                      43     ; <q> ?B_VAR_BANKING: Variable banking uses this L51_BANK module
                      44     ;     <i> Notes: ?B_VAR_BANKING uses the 'far' and 'far const' C51 memory types to
                      45     ;     <i>         extent the space for variables in RAM and/or ROM of classic 8051
                      46     ;     <i>         device.  The same hardware as for code banking is used.  Program
                      47     ;     <i>         code banking and variable banking share the same hardware I/O pins.
                      48     ;     <i>         The C51 Compiler must be used with the VARBANKING directive.
                      49     ;     <i>         Variable Banking is only supported with the LX51 linker/locater.
  0000                50     ?B_VAR_BANKING  EQU  0    ; Variable Banking via L51_BANK (far memory support)
                      51     ;                         ; 0 Variable Banking does not use L51_BANK.A51
                      52     ;                         ; 1 Variable Banking uses this L51_BANK.A51 module
                      53     ; Notes: ?B_VAR_BANKING uses the 'far' and 'far const' C51 memory types to
                      54     ;        extent the space for variables in RAM and/or ROM of classic 8051
                      55     ;        device.  The same hardware as for code banking is used.  Program
                      56     ;        code banking and variable banking share the same hardware I/O pins.
                      57     ;        The C51 Compiler must be used with the VARBANKING directive.
                      58     ;        Variable Banking is only supported with the LX51 linker/locater.
A51 MACRO ASSEMBLER  L51_BANK                                                             03/23/2009 13:06:23 PAGE     2

                      59     ;
                      60     ; <o> ?B_RST_BANK: Active code bank number after a Reset <0x0-0xFF>
                      61     ;     <i> Notes:
                      62     ;     <i> 1. This specifies the active code bank number after CPU reset.
                      63     ;     <i>    It is used to reduce the entries in the INTERBANK CALL TABLE.
                      64     ;     <i> 2. The value 0xFF disables LX51 linker/locater optimization.
                      65     ;     <i> 3. Interbank Call Table optimization is only possible with LX51.
  00FF                66     ?B_RST_BANK     EQU  0xFF ; specifies the active code bank number after CPU
                      67     ;                         ; Reset.  Used to reduce the entries in the
                      68     ;                         ; INTERBANK CALL TABLE.  The value 0xFF disables
                      69     ;                         ; this LX51 linker/locater optimization.
                      70     ; Note:  Interbank Call Table optimization is only possible with LX51.
                      71     ;
                      72     ;</h>
                      73     ;-----------------------------------------------------------------------------
                      74     ;
                      75     IF  ?B_MODE = 0;
                      76     ;-----------------------------------------------------------------------------
                      77     ; if ?BANK?MODE is 0 define the following values
                      78     ; For Bank-Switching via 8051 Port define Port Address / Bits
                      79     ;
                      80     ;<h> Bank Switching via 8051 Port
                      81     ;    <i> This is only used if ?B_MODE is 0
                      82     ; <o> P1: 8051 Port address <0x0-0xFF>
  0090                83     P1              DATA    90H      ; I/O Port Address
                      84     ;
  0090                85     ?B_PORT         EQU     P1       ; default is P1
                      86     ; <o> ?B_FIRSTBIT: Starting with Bit <0-7>
                      87     ;     <i> Default is Bit 2
  0002                88     ?B_FIRSTBIT     EQU     2        ; default is Bit 2
                      89     ;</h>
                      90     ;-----------------------------------------------------------------------------
                      91     ENDIF;
                      92     ;
                             ENDIF;
                     108     ;
                             ENDIF;
                     173     ;
                             ENDIF;
                     200     ;
                     201     ;******************************************************************************
                     202     ;                                                                             *
                     203     ; THEORY OF OPERATION                                                         *
                     204     ; -------------------                                                         *
                     205     ; The section below describes the code generated by BL51 or LX51 and the      *
                     206     ; operation of the L51_BANK.A51 module.  BL51/LX51 generates for each         *
                     207     ; function that is located in a code memory bank and called from the common   *
                     208     ; area or a different code bank and entry into the INTRABANK CALL TABLE.  The *
                     209     ; INTRABANK CALL TABLE is located in the SEGMENT ?BANK?SELECT and listed in   *
                     210     ; the Linker MAP file. The entries in that TABLE have the following format:   *
                     211     ;                                                                             *
                     212     ;   ?FCT?1:  MOV  DPTR,#FCT     ; Load Address of target FCT                  *
                     213     ;            JMP  ?B_BANKn      ; Switch to Bank and Jump to Target Code      *
                     214     ;                                                                             *
                     215     ; Instead of directly calling the function FCT, the Linker changes the entry  *
                     216     ; to ?FCT?1.  This entry selects the bank where the function FCT is located   *
                     217     ; and calls that function via the routines defined in this L51_BANK.A51 file. *
                     218     ; The L51_BANK.A51 file contains two sets of functions for each bank:         *
                     219     ;                                                                             *
                     220     ; ?B_BANKn    is a routine which saves the entry of the ?B_SWITCHn function   *
                     221     ;             for the current active bank on the STACK and switches to the    *
                     222     ;             bank 'n'.  Then it jumps to the address specified by the DPTR   *
                     223     ;             register.  It is allowed to modify the following registers in   *
                     224     ;             the ?B_BANKn routine:  A, B, R0, DPTR, PSW                      *
                     225     ;                                                                             *
                     226     ; ?B_SWITCHn  is a function which selects the bank 'n'.  This function is     *
A51 MACRO ASSEMBLER  L51_BANK                                                             03/23/2009 13:06:23 PAGE     3

                     227     ;             used at the end of a user function to return to the calling     *
                     228     ;             code bank.  Only the following registers may be altered in the  *
                     229     ;             ?B_SWITCHn function:  R0, DPTR                                  *
                     230     ;                                                                             *
                     231     ; The current active bank is stored in ?B_CURRENTBANK.  RTX-51 uses this      *
                     232     ; variable to restore the code bank after a task switch.  To get correct      *
                     233     ; results, ?B_CURRENTBANK must be set to the code bank before the hardware    *
                     234     ; switch is done, or the code banking sequences must be interrupt protected.  *
                     235     ;******************************************************************************
                     236     
                     237                     NAME    ?BANK?SWITCHING
                     238     
                     239                     PUBLIC  ?B_NBANKS, ?B_MODE, ?B_CURRENTBANK, ?B_MASK
                     240                     PUBLIC  ?B_FACTOR, ?B_RST_BANK
                     241     IF (?B_RTX = 1)
                     242                     PUBLIC  ?B_RESTORE_BANK
                     243     ENDIF
                     244     
                     245     ; Standard SFR Symbols required in L51_BANK.A51
  00E0               246     ACC     DATA    0E0H
  00F0               247     B       DATA    0F0H
  0082               248     DPL     DATA    82H
  0083               249     DPH     DATA    83H
  00A8               250     IE      DATA    0A8H
  00AF               251     EA      BIT     IE.7
                     252     
                     253     
                     254     ; generate Mask and Bank Number Information
                             ELSEIF  ?B_NBANKS <= 4
  0003               258       MASK          EQU     00000011B
                             ENDIF     
                     268     
                     269     IF  ?B_MODE = 0 ;**************************************************************
                     270     
  0004               271     ?B_FACTOR       EQU     1 SHL ?B_FIRSTBIT
                     272     
  000C               273     ?B_MASK         EQU     MASK SHL ?B_FIRSTBIT
                     274     
                     275     BANKN           MACRO   N
                     276     BANK&N           EQU     N SHL ?B_FIRSTBIT
                     277                     ENDM
                     278     
  0000               279     CNT             SET     0
                     280     
                     281                     REPT    ?B_NBANKS
                     282                     BANKN   %CNT
                     283     CNT             SET     CNT+1
                     284                     ENDM
                     285+1                   BANKN   %CNT
                     288+1                   BANKN   %CNT
                     291+1                   BANKN   %CNT
                     294+1                   BANKN   %CNT
                     297     
                     298     
  0090               299     ?B_CURRENTBANK  EQU     ?B_PORT
                     300     
                     301       IF ?B_RTX = 1 OR ?B_NBANKS > 32
                     302       ; Convert Bank No in Accu to Address * 4
                     303     
                               ENDIF
                     310     
                               ENDIF
                     316     
                     317       IF  ?B_FIRSTBIT = 2
                     318       CONVBANKNO    MACRO
                     319                     ENDM
A51 MACRO ASSEMBLER  L51_BANK                                                             03/23/2009 13:06:23 PAGE     4

                     320       ENDIF
                     321     
                               ENDIF
                     327     
                               ENDIF
                     334     
                               ENDIF
                     341     
                               ENDIF
                     347     

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -