A51 MACRO ASSEMBLER STARTUP 05/27/2024 11:13:53 PAGE 1 MACRO ASSEMBLER A51 V8.2.7.0 OBJECT MODULE PLACED IN .\Objects\STARTUP.obj ASSEMBLER INVOKED BY: D:\Keil_v5\C51\BIN\A51.EXE ..\Src\startup\STARTUP.A51 SET(SMALL) DEBUG PRINT(.\Listings\STARTUP.ls t) OBJECT(.\Objects\STARTUP.obj) EP LOC OBJ LINE SOURCE 1 $nomod51 2 ;------------------------------------------------------------------------------ 3 ; This file is part of the C51 Compiler package 4 ; Copyright (c) 1988-2005 Keil Elektronik GmbH and Keil Software, Inc. 5 ; Version 8.01 6 ; 7 ; *** <<< Use Configuration Wizard in Context Menu >>> *** 8 ;------------------------------------------------------------------------------ 9 ; STARTUP.A51: This code is executed after processor reset. 10 ; 11 ; To translate this file use A51 with the following invocation: 12 ; 13 ; A51 STARTUP.A51 14 ; 15 ; To link the modified STARTUP.OBJ file to your application use the following 16 ; Lx51 invocation: 17 ; 18 ; Lx51 your object file list, STARTUP.OBJ controls 19 ; 20 ;------------------------------------------------------------------------------ 21 ; 22 ; User-defined Power-On Initialization of Memory 23 ; 24 ; With the following EQU statements the initialization of memory 25 ; at processor reset can be defined: 26 ; 27 ; IDATALEN: IDATA memory size <0x0-0x100> 28 ; Note: The absolute start-address of IDATA memory is always 0 29 ; The IDATA space overlaps physically the DATA and BIT areas. 0100 30 IDATALEN EQU 100H 31 ; 32 ; XDATASTART: XDATA memory start address <0x0-0xFFFF> 33 ; The absolute start address of XDATA memory 0000 34 XDATASTART EQU 0 35 ; 36 ; XDATALEN: XDATA memory size <0x0-0xFFFF> 37 ; The length of XDATA memory in bytes. 0000 38 XDATALEN EQU 0H 39 ; 40 ; PDATASTART: PDATA memory start address <0x0-0xFFFF> 41 ; The absolute start address of PDATA memory 0000 42 PDATASTART EQU 0H 43 ; 44 ; PDATALEN: PDATA memory size <0x0-0xFF> 45 ; The length of PDATA memory in bytes. 0000 46 PDATALEN EQU 0H 47 ; 48 ; 49 ;------------------------------------------------------------------------------ 50 ; 51 ; Reentrant Stack Initialization 52 ; 53 ; The following EQU statements define the stack pointer for reentrant 54 ; functions and initialized it: 55 ; 56 ; Stack Space for reentrant functions in the SMALL model. 57 ; IBPSTACK: Enable SMALL model reentrant stack A51 MACRO ASSEMBLER STARTUP 05/27/2024 11:13:53 PAGE 2 58 ; Stack space for reentrant functions in the SMALL model. 0000 59 IBPSTACK EQU 0 ; set to 1 if small reentrant is used. 60 ; IBPSTACKTOP: End address of SMALL model stack <0x0-0xFF> 61 ; Set the top of the stack to the highest location. 0100 62 IBPSTACKTOP EQU 0xFF +1 ; default 0FFH+1 63 ; 64 ; 65 ; Stack Space for reentrant functions in the LARGE model. 66 ; XBPSTACK: Enable LARGE model reentrant stack 67 ; Stack space for reentrant functions in the LARGE model. 0000 68 XBPSTACK EQU 0 ; set to 1 if large reentrant is used. 69 ; XBPSTACKTOP: End address of LARGE model stack <0x0-0xFFFF> 70 ; Set the top of the stack to the highest location. 0000 71 XBPSTACKTOP EQU 0xFFFF +1 ; default 0FFFFH+1 72 ; 73 ; 74 ; Stack Space for reentrant functions in the COMPACT model. 75 ; PBPSTACK: Enable COMPACT model reentrant stack 76 ; Stack space for reentrant functions in the COMPACT model. 0000 77 PBPSTACK EQU 0 ; set to 1 if compact reentrant is used. 78 ; 79 ; PBPSTACKTOP: End address of COMPACT model stack <0x0-0xFFFF> 80 ; Set the top of the stack to the highest location. 0100 81 PBPSTACKTOP EQU 0xFF +1 ; default 0FFH+1 82 ; 83 ; 84 ;------------------------------------------------------------------------------ 85 ; 86 ; Memory Page for Using the Compact Model with 64 KByte xdata RAM 87 ; Compact Model Page Definition 88 ; 89 ; Define the XDATA page used for PDATA variables. 90 ; PPAGE must conform with the PPAGE set in the linker invocation. 91 ; 92 ; Enable pdata memory page initalization 0000 93 PPAGEENABLE EQU 0 ; set to 1 if pdata object are used. 94 ; 95 ; PPAGE number <0x0-0xFF> 96 ; uppermost 256-byte address of the page used for PDATA variables. 0000 97 PPAGE EQU 0 98 ; 99 ; SFR address which supplies uppermost address byte <0x0-0xFF> 100 ; most 8051 variants use P2 as uppermost address byte 00A0 101 PPAGE_SFR DATA 0A0H 102 ; 103 ; 104 ;------------------------------------------------------------------------------ 105 106 ; Standard SFR Symbols 00E0 107 ACC DATA 0E0H 00F0 108 B DATA 0F0H 0081 109 SP DATA 81H 0082 110 DPL DATA 82H 0083 111 DPH DATA 83H 008E 112 CKCON DATA 8EH 00D2 113 CLKPRE DATA 0D2H 0087 114 PCON DATA 87H 115 116 NAME ?C_STARTUP 117 118 119 ?C_C51STARTUP SEGMENT CODE 120 ?STACK SEGMENT IDATA 121 ---- 122 RSEG ?STACK 0000 123 DS 1 A51 MACRO ASSEMBLER STARTUP 05/27/2024 11:13:53 PAGE 3 124 125 EXTRN CODE (?C_START) 126 PUBLIC ?C_STARTUP 127 ---- 128 CSEG AT 0 0000 020000 F 129 ?C_STARTUP: LJMP STARTUP1 130 ---- 131 RSEG ?C_C51STARTUP 132 0000 133 STARTUP1: 134 ;Set Wait State to 0x30 and CPU CLK Prescaler to 1 to Accelerate Startup 135 ;MOV PCON, #02H ;Enter Standby 0000 758E30 136 MOV CKCON, #30H ;Wait State = 0x30 0003 75D200 137 MOV CLKPRE, #0 ;CLK Prescaler = 1 138 139 IF IDATALEN <> 0 0006 78FF 140 MOV R0,#IDATALEN - 1 0008 E4 141 CLR A 0009 F6 142 IDATALOOP: MOV @R0,A 000A D8FD 143 DJNZ R0,IDATALOOP 144 ENDIF 145 146 IF XDATALEN <> 0 MOV DPTR,#XDATASTART MOV R7,#LOW (XDATALEN) IF (LOW (XDATALEN)) <> 0 MOV R6,#(HIGH (XDATALEN)) +1 ELSE MOV R6,#HIGH (XDATALEN) ENDIF CLR A XDATALOOP: MOVX @DPTR,A INC DPTR DJNZ R7,XDATALOOP DJNZ R6,XDATALOOP ENDIF 160 161 IF PPAGEENABLE <> 0 MOV PPAGE_SFR,#PPAGE ENDIF 164 165 IF PDATALEN <> 0 MOV R0,#LOW (PDATASTART) MOV R7,#LOW (PDATALEN) CLR A PDATALOOP: MOVX @R0,A INC R0 DJNZ R7,PDATALOOP ENDIF 173 174 IF IBPSTACK <> 0 EXTRN DATA (?C_IBP) MOV ?C_IBP,#LOW IBPSTACKTOP ENDIF 179 180 IF XBPSTACK <> 0 EXTRN DATA (?C_XBP) MOV ?C_XBP,#HIGH XBPSTACKTOP MOV ?C_XBP+1,#LOW XBPSTACKTOP ENDIF 186 187 IF PBPSTACK <> 0 EXTRN DATA (?C_PBP) MOV ?C_PBP,#LOW PBPSTACKTOP A51 MACRO ASSEMBLER STARTUP 05/27/2024 11:13:53 PAGE 4 ENDIF 191 000C 758100 F 192 MOV SP,#?STACK-1 193 194 ; This code is required if you use L51_BANK.A51 with Banking Mode 4 195 ; Code Banking 196 ; Select Bank 0 for L51_BANK.A51 Mode 4 197 202 ; 000F 020000 F 203 LJMP ?C_START 204 205 END A51 MACRO ASSEMBLER STARTUP 05/27/2024 11:13:53 PAGE 5 SYMBOL TABLE LISTING ------ ----- ------- N A M E T Y P E V A L U E ATTRIBUTES ?C_C51STARTUP. . . C SEG 0012H REL=UNIT ?C_START . . . . . C ADDR ----- EXT ?C_STARTUP . . . . C ADDR 0000H A ?STACK . . . . . . I SEG 0001H REL=UNIT ACC. . . . . . . . D ADDR 00E0H A B. . . . . . . . . D ADDR 00F0H A CKCON. . . . . . . D ADDR 008EH A CLKPRE . . . . . . D ADDR 00D2H A DPH. . . . . . . . D ADDR 0083H A DPL. . . . . . . . D ADDR 0082H A IBPSTACK . . . . . N NUMB 0000H A IBPSTACKTOP. . . . N NUMB 0100H A IDATALEN . . . . . N NUMB 0100H A IDATALOOP. . . . . C ADDR 0009H R SEG=?C_C51STARTUP PBPSTACK . . . . . N NUMB 0000H A PBPSTACKTOP. . . . N NUMB 0100H A PCON . . . . . . . D ADDR 0087H A PDATALEN . . . . . N NUMB 0000H A PDATASTART . . . . N NUMB 0000H A PPAGE. . . . . . . N NUMB 0000H A PPAGEENABLE. . . . N NUMB 0000H A PPAGE_SFR. . . . . D ADDR 00A0H A SP . . . . . . . . D ADDR 0081H A STARTUP1 . . . . . C ADDR 0000H R SEG=?C_C51STARTUP XBPSTACK . . . . . N NUMB 0000H A XBPSTACKTOP. . . . N NUMB 0000H A XDATALEN . . . . . N NUMB 0000H A XDATASTART . . . . N NUMB 0000H A REGISTER BANK(S) USED: 0 ASSEMBLY COMPLETE. 0 WARNING(S), 0 ERROR(S)