Old fashion design for PC-104
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

157 lines
5.0 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. $NOMOD51
  2. ;------------------------------------------------------------------------------
  3. ; This file is part of the C51 Compiler package
  4. ; Copyright (c) 1988-2002 Keil Elektronik GmbH and Keil Software, Inc.
  5. ;------------------------------------------------------------------------------
  6. ; STARTUP.A51: This code is executed after processor reset.
  7. ;
  8. ; To translate this file use A51 with the following invocation:
  9. ;
  10. ; A51 STARTUP.A51
  11. ;
  12. ; To link the modified STARTUP.OBJ file to your application use the following
  13. ; BL51 invocation:
  14. ;
  15. ; BL51 <your object file list>, STARTUP.OBJ <controls>
  16. ;
  17. ;------------------------------------------------------------------------------
  18. ;
  19. ; User-defined Power-On Initialization of Memory
  20. ;
  21. ; With the following EQU statements the initialization of memory
  22. ; at processor reset can be defined:
  23. ;
  24. ; ; the absolute start-address of IDATA memory is always 0
  25. IDATALEN EQU 80H ; the length of IDATA memory in bytes.
  26. ;
  27. XDATASTART EQU 0H ; the absolute start-address of XDATA memory
  28. XDATALEN EQU 0H ; the length of XDATA memory in bytes.
  29. ;
  30. PDATASTART EQU 0H ; the absolute start-address of PDATA memory
  31. PDATALEN EQU 0H ; the length of PDATA memory in bytes.
  32. ;
  33. ; Notes: The IDATA space overlaps physically the DATA and BIT areas of the
  34. ; 8051 CPU. At minimum the memory space occupied from the C51
  35. ; run-time routines must be set to zero.
  36. ;------------------------------------------------------------------------------
  37. ;
  38. ; Reentrant Stack Initilization
  39. ;
  40. ; The following EQU statements define the stack pointer for reentrant
  41. ; functions and initialized it:
  42. ;
  43. ; Stack Space for reentrant functions in the SMALL model.
  44. IBPSTACK EQU 0 ; set to 1 if small reentrant is used.
  45. IBPSTACKTOP EQU 0FFH+1 ; set top of stack to highest location+1.
  46. ;
  47. ; Stack Space for reentrant functions in the LARGE model.
  48. XBPSTACK EQU 0 ; set to 1 if large reentrant is used.
  49. XBPSTACKTOP EQU 0FFFFH+1; set top of stack to highest location+1.
  50. ;
  51. ; Stack Space for reentrant functions in the COMPACT model.
  52. PBPSTACK EQU 0 ; set to 1 if compact reentrant is used.
  53. PBPSTACKTOP EQU 0FFFFH+1; set top of stack to highest location+1.
  54. ;
  55. ;------------------------------------------------------------------------------
  56. ;
  57. ; Page Definition for Using the Compact Model with 64 KByte xdata RAM
  58. ;
  59. ; The following EQU statements define the xdata page used for pdata
  60. ; variables. The EQU PPAGE must conform with the PPAGE control used
  61. ; in the linker invocation.
  62. ;
  63. PPAGEENABLE EQU 0 ; set to 1 if pdata object are used.
  64. ;
  65. PPAGE EQU 0 ; define PPAGE number.
  66. ;
  67. PPAGE_SFR DATA 0A0H ; SFR that supplies uppermost address byte
  68. ; (most 8051 variants use P2 as uppermost address byte)
  69. ;
  70. ;------------------------------------------------------------------------------
  71. ; Standard SFR Symbols
  72. ACC DATA 0E0H
  73. B DATA 0F0H
  74. SP DATA 81H
  75. DPL DATA 82H
  76. DPH DATA 83H
  77. NAME ?C_STARTUP
  78. ?C_C51STARTUP SEGMENT CODE
  79. ?STACK SEGMENT IDATA
  80. RSEG ?STACK
  81. DS 1
  82. EXTRN CODE (?C_START)
  83. PUBLIC ?C_STARTUP
  84. CSEG AT 0
  85. ?C_STARTUP: LJMP STARTUP1
  86. RSEG ?C_C51STARTUP
  87. STARTUP1:
  88. IF IDATALEN <> 0
  89. MOV R0,#IDATALEN - 1
  90. CLR A
  91. IDATALOOP: MOV @R0,A
  92. DJNZ R0,IDATALOOP
  93. ENDIF
  94. IF XDATALEN <> 0
  95. MOV DPTR,#XDATASTART
  96. MOV R7,#LOW (XDATALEN)
  97. IF (LOW (XDATALEN)) <> 0
  98. MOV R6,#(HIGH (XDATALEN)) +1
  99. ELSE
  100. MOV R6,#HIGH (XDATALEN)
  101. ENDIF
  102. CLR A
  103. XDATALOOP: MOVX @DPTR,A
  104. INC DPTR
  105. DJNZ R7,XDATALOOP
  106. DJNZ R6,XDATALOOP
  107. ENDIF
  108. IF PPAGEENABLE <> 0
  109. MOV PPAGE_SFR,#PPAGE
  110. ENDIF
  111. IF PDATALEN <> 0
  112. MOV R0,#LOW (PDATASTART)
  113. MOV R7,#LOW (PDATALEN)
  114. CLR A
  115. PDATALOOP: MOVX @R0,A
  116. INC R0
  117. DJNZ R7,PDATALOOP
  118. ENDIF
  119. IF IBPSTACK <> 0
  120. EXTRN DATA (?C_IBP)
  121. MOV ?C_IBP,#LOW IBPSTACKTOP
  122. ENDIF
  123. IF XBPSTACK <> 0
  124. EXTRN DATA (?C_XBP)
  125. MOV ?C_XBP,#HIGH XBPSTACKTOP
  126. MOV ?C_XBP+1,#LOW XBPSTACKTOP
  127. ENDIF
  128. IF PBPSTACK <> 0
  129. EXTRN DATA (?C_PBP)
  130. MOV ?C_PBP,#LOW PBPSTACKTOP
  131. ENDIF
  132. MOV SP,#?STACK-1
  133. ; This code is required if you use L51_BANK.A51 with Banking Mode 4
  134. ; EXTRN CODE (?B_SWITCH0)
  135. ; CALL ?B_SWITCH0 ; init bank mechanism to code bank 0
  136. LJMP ?C_START
  137. END