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

📄 rstartup.asm

📁 mcs51,2051,x86系列MCU
💻 ASM
字号:
##80C386EX ALL#
;; Copyright (C) Intel Corporation 1994
;;          All Rights Reserved.
;; 
;; The Software is provided "AS IS."
;; 
;; LIMITATION OF LIABILITY:    NEITHER INTEL NOR ITS VENDORS OR AGENTS 
;;     SHALL BE LIABLE FOR ANY LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA, 
;;     INTERRUPTION OF BUSINESS, NOR FOR INDIRECT, SPECIAL, INCIDENTAL OR 
;;     CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER THIS AGREEMENT OR 
;;     OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

.186
        name StartUp

.XLIST
;;; Include 80386ex register definitions and register get/set macros
include 80386ex.inc
;;; Include EV386EX board specific definitions and macros
include EV386EX.inc
.LIST

;;******************************************************************************** 
;; It is common practice for "C" compiler to add an "_" to public symbols.  But
;; There is no standard or consistant practice on including or the placement of
;; the underscore "_" character.  Most compiler provide information on interfacing
;; to assembly language.  You may need to modify public symbols and segment
;; definitions to work with your compiler.
;;*********************************************************************************
;; When linking to libraries only those modules that are referenced actually
;; get linked in.  Depending on your "C" compiler a reference to a dummy symbol
;; may be made in order to force the inclusion of the default startup code.  
;; Since this is an embedded system we will prevent the inclusion of the
;; standard DOS/WINDOWS startup code by defining the symbol in our module

    extrn   _DataSeg:WORD
    
    public  __acrtused              ;* Required for MicroSoft C
__acrtused  equ 0

;;; Define needed segments.  This will change depending on the compiler and
;;; Model of segmentation used.  Reference compiler manuals for more information
;;; This definition is fairly generic and should work with most compilers

stack   segment para stack 'stack'
STACK_SIZE  equ 4*1024
public  stack_top                       ;Symbol marks initial top of stack.
        db STACK_SIZE dup (?)
stack_top label word
stack   ends

extrn   _main:FAR
extrn	_InitPinCfg:FAR

RESET_CODE      segment word 'code'
        assume CS:RESET_CODE

    ;; Provide public for compilers that have leading or trailing "_", or none
public  _HelloString
_HelloString    db      "Hello from the EV386EX Rev. 2.1 Evaluation Board",0Dh,0Ah,0

public START
START   LABEL FAR       ;; Provide starting label used by tools

        ;; Make sure CS:IP are initialized to the correct Segment:offset
        ;; Combination.  This allows us to avoid using the setvector command
        ;; when loading the program via flashu
        jmp FAR PTR LoadCS_IP
LoadCS_IP:

        cli                     ;; Disable interrupts.  ICU and interrupt table must be 
                                ;; initialized first
                                
        ;; Initialize stack, we are making calls out of the startup routine.
        mov             ax, seg stack
        mov             ss, ax
        mov             sp, ss:stack_top
        
;; *********************************************************************************
;; ********************** EV386EX initialization code ******************************
;; *********************************************************************************

                ;; Configure the operation of A20 address line
        _SetEXRegByte 92h, 00H  ; Bit 1: =1 A20 is unmodified, =0 A20 always 0
                                ; Bit 0: =1 causes a CPU only reset.

                ;; Enable access to peripheral register at expanded I/O addresses
        MOV     AX, 8000H
        OUT     REMAPCFGH, AL
        XCHG    AL, AH
        OUT     REMAPCFGL, AL
        OUT     REMAPCFGL, AX

	
;; If it MUST be called from assembly code, do it this way.
;; I'm not sure it MUST be called from assembly.


	;; Init pin configuration.
	_SetEXRegByte PINCFG, 0H
	

        ;;*** CAUTION ****
        ;; Care must be taken in changing the chip-selects.  The chip-selects
        ;; determine what the memory map looks like.  Change chip-selects from
        ;; within a debbuger could cause the debugger to no longer work.
        ;; NOTE: This configuration should work from within the supplied debugger.

	; I don't know what to do with this one....
        ;Initialize the Chip-select Unit
        ;  Intialize for Real-mode operation
        ;  Disable SMM operation
        ;  512KB of flash & 512KB of RAM
        ;  Only UCS and CS4 are used.
        _SetChipSelects REAL, 0, 512, 512                       

;; *********** Go to Application Code ************

        mov     ax, SEG stack           ;; Initialization may change depending on
        mov     ss, ax                  ;; compiler & model of segmentation selected
        mov     sp, OFFSET ss:stack_top
        mov     ax, SEG _DataSeg
        mov     ds, ax
        mov     es, ax
        jmp     FAR PTR _main           ;; Go To "C" code.
        jmp     $                       ;; The "C" main should never return

RESET_CODE      ends

	end	START		;; Create start address record (initial CS:IP) used for tools

⌨️ 快捷键说明

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