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

📄 banksm59128.lst

📁 台湾新茂SM59128单片机开发与C语言编程-例子
💻 LST
📖 第 1 页 / 共 3 页
字号:
A51 MACRO ASSEMBLER  BANKSM59128                                                          12/11/2006 09:13:36 PAGE     1


MACRO ASSEMBLER A51 V7.07
OBJECT MODULE PLACED IN .\output\BankSM59128.obj
ASSEMBLER INVOKED BY: C:\Keil\C51\BIN\A51.EXE BankSM59128.a51 SET(SMALL) DEBUG PRINT(.\listing\BankSM59128.lst) OBJECT(.
                      \output\BankSM59128.obj) EP

LOC  OBJ            LINE     SOURCE

                       1     ; BankSM59128.a51
                       2     ;               modified from L51_bank.a51
                       3     ;
                       4     $nomod51  NOLINES
                       5     $nocond 
                       6     ;------------------------------------------------------------------------------
                       7     ;  This file is part of the BL51 / LX51 Banked Linker/Locater package
                       8     ;  Copyright (c) 1988 - 2001 Keil Elektronik GmbH and Keil Software, Inc.
                       9     ;  Version 2.21 (Code and Variable Banking for Classic 8051 Derivatives)
                      10     ;------------------------------------------------------------------------------
                      11     ;************************ Configuration Section *******************************
  0002                12     ?B_NBANKS       EQU  2    ; Define maximum Number of Banks                    *
                      13     ;                         ; following values are allowed: 2, 4, 8, 16, 32, 64 *
                      14     ;                         ; for BL51 the maximum value for ?B_BANKS is 32     *
                      15     ;                         ; for LX51 the maximum value for ?B_BANKS is 64     *
                      16     ;                                                                             *
  0004                17     ?B_MODE         EQU  4    ; 0 for Bank-Switching via 8051 Port                *
                      18     ;                         ; 1 for Bank-Switching via XDATA Port               *
                      19     ;                         ; 4 for user-provided bank switch code              *
                      20     ;                                                                             *
  0000                21     ?B_RTX          EQU  0    ; 0 for applications without real-time OS           *
                      22     ;                         ; 1 for applications using the RTX-51 real-time OS  *
                      23     ;                                                                             *
  0001                24     ?B_VAR_BANKING  EQU  1    ; Variable Banking via L51_BANK (far memory support)*
                      25     ;                         ; 0 Variable Banking does not use L51_BANK.A51      *
                      26     ;                         ; 1 Variable Banking uses this L51_BANK.A51 module  *
                      27     ; Notes: ?B_VAR_BANKING uses the 'far' and 'far const' C51 memory types to    *
                      28     ;        extent the space for variables in RAM and/or ROM of classic 8051     *
                      29     ;        device.  The same hardware as for code banking is used.  Program     *
                      30     ;        code banking and variable banking share the same hardware I/O pins.  *
                      31     ;        The C51 Compiler must be used with the VARBANKING directive.         *
                      32     ;        Variable Banking is only supported with the LX51 linker/locater.     *
                      33     ;                                                                             *
  00FF                34     ?B_RST_BANK     EQU  0xFF ; specifies the active code bank number after CPU   *
                      35     ;                         ; Reset.  Used to reduce the entries in the         *
                      36     ;                         ; INTERBANK CALL TABLE.  The value 0xFF disables    *
                      37     ;                         ; this LX51 linker/locater optimization.            *
                      38     ; Note:  Interbank Call Table optimization is only possible with LX51.        *
                      39     ;                                                                             *
                      40     ;-----------------------------------------------------------------------------*
                      41     ;                                                                             *
                             ENDIF;                                                                        *
                      53     ;                                                                             *
                             ENDIF;                                                                        *
                      62     ;                                                                             *
                      63     IF  ?B_MODE = 4;                                                              *
                      64     ;-----------------------------------------------------------------------------*
                      65     ; if ?BANK?MODE is 4 define the following switch macros                       *
                      66     ; For bank switching via user-provided bank switch code you must define for   *
                      67     ; each memory bank a own macro which contains the bank switch code.  The      *
                      68     ; following example shows how to use the I/O lines P1.4 and P1.7 for bank     *
                      69     ; switching.  Since you can select just 4 banks with two address lines, just  *
                      70     ; four macros are defined.  The number of macros must conform with the number *
                      71     ; ?B_NBANKS number, i.e. for an application with 16 memory banks you must     *
                      72     ; define 16 macros.                                                           *
                      73     ;                                                                             *
                      74     ; IMPORTANT NOTES:                                                            *
A51 MACRO ASSEMBLER  BANKSM59128                                                          12/11/2006 09:13:36 PAGE     2

                      75     ; 1. The bank switch logic must be initialized before using it.  Therefore    *
                      76     ;    add the following lines of code at the end of the STARTUP.A51 file:      *
                      77     ;                :                                                            *
                      78     ;      EXTRN CODE (?B_SWITCH0)                                                *
                      79     ;               CALL    ?B_SWITCH0    ; init bank mechanism to code bank 0    *
                      80     ;               LJMP    ?C_START      ; line already exits at the end of file *
                      81     ;                :                                                            *
                      82     ;                                                                             *
                      83     ; 2. If the bank switch macros and the additional control code generate more  *
                      84     ;    than 256 bytes, you need to set the LONG_MACRO flag below.  The error    *
                      85     ;    message "BANK SWITCH CODE BIGGER THAN 256 BYTES, SET LONG_MACRO TO 1"    *
                      86     ;    is generated in case that this is required.                              *
                      87     ;                                                                             *
                      88     ; 3. The only registers that can be modified in this routines without prior   *
                      89     ;    saving are:  DPTR and ACC.                                               *
                      90     ;                                                                             *
                      91     ;                                                                             *
  0000                92     LONG_MACRO      EQU  0    ; 0 default, for normal macros and up to 8 banks    *
                      93     ;                         ; 1 big macro code or many banks                    *
                      94     ;                                                                             *
                      95     ;                                                                             *
                      96     
                      97     
                      98     
                      99     
                     100     
                     101     
                     102     
                     103     
                     104     
                     105     
                     106     
                     107     
                     108     
                     109     
                     110     
                     111     
                     112     
                     113     
                     114     
                     115     
                     116     
                     117     
                     118     
  00BF               119     sconf           DATA    0BfH     ;   
                     120     SWITCH0         MACRO            ; Switch to Memory Bank #0                   *
                     121                     ANL     SCONF,#0F7H    ; Clear SCONF Bit 3 
                     122                     ENDM                                                          *
                     123     ;                                                                             *
                     124     SWITCH1         MACRO            ; Switch to Memory Bank #1                   *
                     125                     ORL      sconf,#08h     ; SETB  SCONF Bit 3                   *
                     126                     ENDM 
                     127     ENDIF;                                                                        *
                     128     ;                                                                             *
                     129     IF ?B_VAR_BANKING = 1;                                                        *            
                                                                          
                     130     ;                                                                             * 
  0000               131     XMEM EQU 0x02000000       ; LX51 xdata symbol offset: do not change!          *
                     132     ;                                                                             *
                     133     ;******* Configuration Section for uVision2 Memory Simulation Support *********
                     134     ;                                                                             *
                     135     ; The following settings allow you to map the physical xdata and code memory  *
                     136     ; banks into simulation memory of the uVision2 Simulator.                     *
                     137     ;                                                                             *
  B800               138     ?B?XSTART EQU 0xB800      ; Start of xdata bank area                          *
  FFFF               139     ?B?XEND   EQU 0xFFFF      ; Stop of xdata bank area                           *
A51 MACRO ASSEMBLER  BANKSM59128                                                          12/11/2006 09:13:36 PAGE     3

  0000               140     ?B?XMEM   EQU XMEM+0x010000  ; First HDATA memory bank in xdata space         *
                     141     ;                                                                             *
                     142     ; The above setting redirects the symbols in the area X:0x20000 .. X:0x2FFFF  *
                     143     ; into the uVision2 simulation memory area for the EEPROM  V:0 .. V:0xFFFF    *
                     144     ;                                                                             *
                     145     ;-----------------------------------------------------------------------------*
                     146     ;                                                                             *
                     147                     PUBLIC ?B?XSTART, ?B?XEND, ?B?XMEM;                           *
                     148     ENDIF;                                                                        *
                     149     ;                                                                             *
                     150     ;******************************************************************************
                     151     ;                                                                             *
                     152     ; THEORY OF OPERATION                                                         *
                     153     ; -------------------                                                         *
                     154     ; The section below describes the code generated by BL51 or LX51 and the      *
                     155     ; operation of the L51_BANK.A51 module.  BL51/LX51 generates for each         *
                     156     ; function that is located in a code memory bank and called from the common   *
                     157     ; area or a different code bank and entry into the INTRABANK CALL TABLE.  The *
                     158     ; INTRABANK CALL TABLE is located in the SEGMENT ?BANK?SELECT and listed in   *
                     159     ; the Linker MAP file. The entries in that TABLE have the following format:   *
                     160     ;                                                                             *
                     161     ;   ?FCT?1:  MOV  DPTR,#FCT     ; Load Address of target FCT                  *
                     162     ;            JMP  ?B_BANKn      ; Switch to Bank and Jump to Target Code      *
                     163     ;                                                                             *
                     164     ; Instead of directly calling the function FCT, the Linker changes the entry  *
                     165     ; to ?FCT?1.  This entry selects the bank where the function FCT is located   *
                     166     ; and calls that function via the routines defined in this L51_BANK.A51 file. *
                     167     ; The L51_BANK.A51 file contains two sets of functions for each bank:         *
                     168     ;                                                                             *
                     169     ; ?B_BANKn    is a routine which saves the entry of the ?B_SWITCHn function   *
                     170     ;             for the current active bank on the STACK and switches to the    *
                     171     ;             bank 'n'.  Then it jumps to the address specified by the DPTR   *
                     172     ;             register.  It is allowed to modify the following registers in   *
                     173     ;             the ?B_BANKn routine:  A, B, R0, DPTR, PSW                      *
                     174     ;                                                                             *
                     175     ; ?B_SWITCHn  is a function which selects the bank 'n'.  This function is     *
                     176     ;             used at the end of a user function to return to the calling     *
                     177     ;             code bank.  Only the following registers may be altered in the  *
                     178     ;             ?B_SWITCHn function:  R0, DPTR                                  *
                     179     ;                                                                             *
                     180     ; The current active bank is stored in ?B_CURRENTBANK.  RTX-51 uses this      *
                     181     ; variable to restore the code bank after a task switch.  To get correct      *
                     182     ; results, ?B_CURRENTBANK must be set to the code bank before the hardware    *
                     183     ; switch is done, or the code banking sequences must be interrupt protected.  *
                     184     ;******************************************************************************
                     185     
                     186                     NAME    ?BANK?SWITCHING
                     187     
                     188                     PUBLIC  ?B_NBANKS, ?B_MODE, ?B_CURRENTBANK, ?B_MASK
                     189                     PUBLIC  ?B_FACTOR, ?B_RST_BANK
                             ENDIF
                     193     
                     194     ; Standard SFR Symbols required in L51_BANK.A51
  00E0               195     ACC     DATA    0E0H
  00F0               196     B       DATA    0F0H
  0082               197     DPL     DATA    82H
  0083               198     DPH     DATA    83H
  00A8               199     IE      DATA    0A8H
  00AF               200     EA      BIT     IE.7
                     201     
                     202     
                     203     ; generate Mask and Bank Number Information
                     204     IF      ?B_NBANKS <= 2
  0001               205       MASK          EQU     00000001B
                             ENDIF     
                     217     
A51 MACRO ASSEMBLER  BANKSM59128                                                          12/11/2006 09:13:36 PAGE     4

                             ENDIF  ; close block IF ?B_MODE = 0 *******************************************
                     465     
                     466     
                             ENDIF  ; close block IF ?B_MODE = 1 *******************************************
                     708     
                     709     
                     710     IF  ?B_MODE = 4 ;**************************************************************
                     711     
  0000               712     ?B_FACTOR       EQU     0               ; Dummy Declarations
  0000               713     ?B_FIRSTBIT     EQU     0
  0001               714     ?B_MASK         EQU     MASK
                     715     

⌨️ 快捷键说明

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