📄 xbanking.lst
字号:
A51 MACRO ASSEMBLER XBANKING 04/14/2007 09:47:57 PAGE 1
MACRO ASSEMBLER A51 V8.00c
OBJECT MODULE PLACED IN XBANKING.OBJ
ASSEMBLER INVOKED BY: C:\Keil\C51\BIN\A51.EXE XBANKING.A51 SET(SMALL) DEBUG EP
LOC OBJ LINE SOURCE
1 $nomod51 NOLINES
2 ;------------------------------------------------------------------------------
3 ; This file is part of the LX51 Extended Linker/Locater package
4 ; Copyright (c) 2000 - 2003 Keil Elektronik GmbH and Keil Software, Inc.
5 ; Version 1.04a, Variable Banking: 'far' & 'far const' C51 memory type support
6 ; Version 1.04a: added register usage description
7 ;------------------------------------------------------------------------------
8 ;
9 ;************************ Configuration Section *******************************
10 ; *
11 ; If the CPU provides an extended DPTR register for addressing HDATA, the *
12 ; following settings must be defined: *
0093 13 ?C?XPAGE1SFR DATA 093H ; SFR Address of XPAGE1 register *
0000 14 ?C?XPAGE1RST EQU 0 ; XPAGE1 register value to address X:0 region *
15 ; *
16 ; The C51 Compiler must be used with the VARBANKING directive. If your *
17 ; application accesses XDATA memory in interrupts, VARBANKING(1) must be *
18 ; applied. With VARBANING(1) the C51 compiler saves the ?C?XPAGE1SFR and *
19 ; sets this register to the ?C?XPAGE1RST value. *
20 ; *
21 ;-----------------------------------------------------------------------------*
22 ;
0000 23 XMEM EQU 0x02000000 ; LX51 xdata symbol offset: do not change!
0000 24 CMEM EQU 0x01000000 ; LX51 code symbol offset: do not change!
25 ;
26 ;******* Configuration Section for uVision2 Memory Simulation Support *********
27 ; *
28 ; The following settings allow you to map the physical memory areas S:, T: *
29 ; U: and V: of the uVision2 Simulator into the logical XDATA or CODE address *
30 ; space of the LX51 linker/locater. *
31 ; *
0000 32 ?B?SMEM EQU 0 ; No mapping for S: Memory *
0000 33 ?B?TMEM EQU 0 ; No mapping for T: Memory *
0000 34 ?B?UMEM EQU 0 ; No mapping for U: Memory *
0000 35 ?B?VMEM EQU XMEM+0x20000 ; Simulated V: Memory mapped to LX51 X:0x20000 area *
36 ; *
37 ; The above setting redirects the symbols in the area X:0x20000 .. X:0x2FFFF *
38 ; into the uVision2 simulation memory area for the EEPROM V:0 .. V:0xFFFF *
39 ; *
40 ;-----------------------------------------------------------------------------*
41 ;
42 ;******************************************************************************
43 ; *
44 ; THEORY OF OPERATION *
45 ; ------------------- *
46 ; This section describes how the extended LX51 linker/locater manages the *
47 ; extended address spaces that are addressed with the new C51 memory types *
48 ; 'far' and 'far const'. The C51 Compiler uses 3 byte pointer generic *
49 ; pointer to access these memory areas. 'far' variables are placed in the *
50 ; memory class HDATA and 'far const' variables get the memory class 'HCONST'. *
51 ; The LX51 linker/locater allows you to locate these memory classes in the *
52 ; logical 16 MBYTE CODE or 16 MBYTE XDATA spaces. *
53 ; *
54 ; The memory access itself is performed via eight different subroutines that *
55 ; can be configured in this assembler module. These routines are: *
56 ; ?C?CLDXPTR, ?C?CSTXPTR ; load/store BYTE (char) in extended memory *
57 ; ?C?ILDXPTR, ?C?ISTXPTR ; load/store WORD (int) in extended memory *
58 ; ?C?PLDXPTR, ?C?PSTXPTR ; load/store 3-BYTE PTR in extended memory *
A51 MACRO ASSEMBLER XBANKING 04/14/2007 09:47:57 PAGE 2
59 ; ?C?LLDXPTR, ?C?LSTXPTR ; load/store DWORD (long) in extended memory *
60 ; *
61 ; Each function gets as a parameter the memory address with 3 BYTE POINTER *
62 ; representation in the CPU registers R1/R2/R3. The register R3 holds the *
63 ; memory type. The C51 compiler uses the following memory types: *
64 ; *
65 ; R3 Value | Memory Type | Memory Class | Address Range *
66 ; -----------------------+--------------+-------------------------- *
67 ; 00 | data/idata | DATA/IDATA | I:0x00 .. I:0xFF *
68 ; 01 | xdata | XDATA | X:0x0000 .. X:0xFFFF *
69 ; 02..7F | far | HDATA | X:0x010000 .. X:0x7E0000 *
70 ; 81..FD | far const | HCONST | C:0x800000 .. C:0xFC0000 (see note) *
71 ; FE | pdata | XDATA | one 256-byte page in XDATA memory *
72 ; FF | code | CODE | C:0x0000 .. C:0xFFFF *
73 ; *
74 ; Note: the far const memory area is mapped into the banked memory areas. *
75 ; *
76 ; The R3 values 00, 01, FE and FF are already handled within the C51 run-time *
77 ; library. Only the values 02..FE are passed to the XPTR access functions *
78 ; described below. The AX51 macro assembler provides the MBYTE operator *
79 ; that calculates the R3 value that needs to be passed to the XPTR access *
80 ; function. AX51 Assembler example for using XPTR access functions: *
81 ; MOV R1,#LOW (variable) ; gives LSB address byte of variable *
82 ; MOV R2,#HIGH (variable) ; gives MSB address byte of variable *
83 ; MOV R3,#MBYTE (variable) ; gives memory type byte of variable *
84 ; CALL ?C?CLDXPTR ; load BYTE variable into A *
85 ;******************************************************************************
86
87
88 NAME ?C?XBANKING ; 'far' Memory Access Support
89
90 PUBLIC ?C?XPAGE1SFR, ?C?XPAGE1RST
91 PUBLIC ?C?CLDXPTR, ?C?CSTXPTR, ?C?ILDXPTR, ?C?ISTXPTR
92 PUBLIC ?C?PLDXPTR, ?C?PSTXPTR, ?C?LLDXPTR, ?C?LSTXPTR
93
94 ?C?LIB_CODE SEGMENT CODE
---- 95 RSEG ?C?LIB_CODE
96
97 LOAD_BANK MACRO
98 LOCAL lab
99 MOV DPL,R1
100 MOV DPH,R2
101 MOV ?C?XPAGE1SFR,R3
102 DEC ?C?XPAGE1SFR
103 ANL ?C?XPAGE1SFR,#07FH
104 CJNE R3,#80H,lab
105 lab:
106 ENDM
107
108 ; Standard SFR Symbols required in XBANKING.A51
00E0 109 ACC DATA 0E0H
00F0 110 B DATA 0F0H
0082 111 DPL DATA 82H
0083 112 DPH DATA 83H
113
114
115
116 ;-----------------------------------------------------------------------------
117 ; CLDXPTR: Load BYTE in A via Address given in R1/R2/R3
118 ; Registers which can be used without saving: DPTR, CY, A
119 ;
0000 120 ?C?CLDXPTR: LOAD_BANK
000E 5005 128 JNC CLDCODE
0010 E0 129 MOVX A,@DPTR
0011 759300 130 MOV ?C?XPAGE1SFR,#?C?XPAGE1RST ; Reset Page Register
0014 22 131 RET
A51 MACRO ASSEMBLER XBANKING 04/14/2007 09:47:57 PAGE 3
0015 E4 132 CLDCODE: CLR A
0016 93 133 MOVC A,@A+DPTR
0017 759300 134 MOV ?C?XPAGE1SFR,#?C?XPAGE1RST ; Reset Page Register
001A 22 135 RET
136
137 ;-----------------------------------------------------------------------------
138 ; CSTXPTR: Store BYTE in A via Address given in R1/R2/R3
139 ; Registers which can be used without saving: DPTR, CY
140 ;
001B 141 ?C?CSTXPTR: LOAD_BANK
0029 5001 149 JNC CSTCODE
002B F0 150 MOVX @DPTR,A
002C 759300 151 CSTCODE: MOV ?C?XPAGE1SFR,#?C?XPAGE1RST ; Reset Page Register
002F 22 152 RET
153
154
155 ;-----------------------------------------------------------------------------
156 ; ILDXPTR: Load WORD in A(LSB)/B(HSB) via Address given in R1/R2/R3
157 ; Registers which can be used without saving: DPTR, CY, A, B
158 ;
0030 159 ?C?ILDXPTR: LOAD_BANK
003E 5009 167 JNC ILDCODE
0040 E0 168 MOVX A,@DPTR
0041 F5F0 169 MOV B,A
0043 A3 170 INC DPTR
0044 E0 171 MOVX A,@DPTR
0045 759300 172 MOV ?C?XPAGE1SFR,#?C?XPAGE1RST ; Reset Page Register
0048 22 173 RET
0049 E4 174 ILDCODE: CLR A
004A 93 175 MOVC A,@A+DPTR
004B F5F0 176 MOV B,A
004D 7401 177 MOV A,#1
004F 93 178 MOVC A,@A+DPTR
0050 759300 179 MOV ?C?XPAGE1SFR,#?C?XPAGE1RST ; Reset Page Register
0053 22 180 RET
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -