📄 start.asm
字号:
;====================================================================
; MB90500/MB90600/MB90700/MB90700H/MB90200 Series C Compiler,
; (C) FUJITSU MICROELECTRONICS EUROPE 1998-99
;
; Startup file for memory and basic controller initialisation
;====================================================================
.PROGRAM STARTUP
.TITLE "STARTUP FILE FOR MEMORY INITIALISATION"
;====================================================================
; 1 Contents
;====================================================================
; 1 Contents
; 2 Disclaimer
; 3 History
;
; 4 SETTINGS (USER INTERFACE)
; 4.1 Controller Family
; 4.2 Memory model
; 4.3 Constant Data Handling
; 4.4 Stack Type and Stack Size
; 4.5 General Register Bank
; 4.6 Low-Level Library Interface
; 4.7 Clock Selection
; 4.8 External Bus Interface
; 4.9 Reset Vector
; 4.10 Enable RAMCODE Copying
;
; 5 Section and Data Declaration
; 5.1 Several fixed addresses (fixed for MB90xxx controllers)
; 5.2 Declaration of __near addressed data sections
; 5.3 Declaration of RAMCODE section and labels
; 5.4 Declaration of sections containing other sections description
; 5.5 Stack area and stack top definition
; 5.6 Direct page register dummy label definition
;
; 6 Start-Up Code
; 6.1 Import external symbols
; 6.2 "NOT RESET YET" WARNING
; 6.3 Program start (the reset vector should point here)
; 6.4 Set clock ratio
; 6.5 Set external bus configuaration
; 6.6 Copy initial values to data areas.
; 6.7 Clear uninitialised data areas to zero
; 6.8 Prepare stacks and set the default stack type
; 6.9 Set Data Bank Register (DTB) and Direct Page Register (DPR)
; 6.10 Wait for PLL to stabilise
; 6.11 Initialise Low-Level Library Interface
; 6.12 Call C-language main function
; 6.13 Shut down library
; 6.14 Program end loop
; 6.15 Debug address specification
;
;====================================================================
; 2 Disclaimer
;====================================================================
; FUJITSU MIKROELEKTRONIK GMBH
; Am Siebenstein 6-10, 63303 Dreieich
; Tel.:++49/6103/690-0,Fax - 122
;
; The following software is for demonstration purposes only.
; It is not fully tested, nor validated in order to fullfill
; its task under all circumstances. Therefore, this software
; or any part of it must only be used in an evaluation
; laboratory environment.
; This software is subject to the rules of our standard
; DISCLAIMER, that is delivered with our SW-tools on the CD
; "Micros Documentation & Software" (V3.0 see "\START.HTM") or
; see our Internet Page -
; http://www.fujitsu-ede.com/products/micro/disclaimer.html
;
;====================================================================
; 3 History
;====================================================================
;
; Version 1.00 25 Aug 98 Holger Loesche
; - original version
; Version 1.01 31 Aug 98 Holger Loesche
; - bug: conditional for reset vector was missing
; Version 1.02 16 Oct 98 Holger Loesche
; - memory model AUTO introduced (use far calls only and repair
; stack, if necessary
; - colons removed from EQU labels
; - stream_init call added
; - RAMCONST set as default (also for ROMCONST systems)
; Version 1.03 19 Oct 98 Holger Loesche
; - bug: SEGCOPY macro: used size changed from sizeof(src) to
; sizeof(dest). It was conflicting with RAMCONST, if compiler
; is set to ROMCONST.
; Version 1.04 21 Oct 98 Holger Loesche
; - ROM mirror option added
; - _exit call added
; - bug: EQU ON/OFF move to upper lines
; Version 1.05 28 Oct 98 Holger Loesche
; - CALL/CALLP _exit was not differed
; Version 1.06 18 Feb 99 Holger Loesche
; - default external bus configuration: WR signal enabled
; - ROMMIRROR macro processing simplified (less warnings>
; Version 1.07 01 April 99 Holger Loesche
; - Version string had wrong number (1.05 instead of 1.06)
; - Copyright slightly changed
; Version 1.08 16 April 99 Juergen Rohn
; - Version placed in separate section (caused problems with fixed
; reset vector)
; Version 1.09 12 May 99 Holger Loesche
; - MB90400 family added
; - several coments changed
; - INTROM_EXTBUS macro was wrong
; - BUSWIDTH macro removed, now resolved from bus signal
; - disclaimer added
; - disabling interrupts added
; Version 1.10 17 May 99 Holger Loesche
; - change in 1.09 (MODEBYTE) related to BUSWIDTH was not complete
; Version 1.11 1 June 99 Holger Loesche
; - confusing old line with comment removed, was refering to unused
; old BUSWIDTH
; Version 1.12 23 June 99 Holger Loesche
; - CLIBINIT is using ON/OFF instead of extra macro now
; Version 2.00 23 July 99 Holger Loesche
; - decriptors of __near sections now in DCLEAR/DTRANS
; - code for __near section init removed, now initialised by DCLEAR
; and DTRANS processing
; - RAMCODE option added
; - table of contents added
; - memory model AUTO renamed to AUTOMODEL
; - CONSTDATA mode AUTOCONST introduced to make it clearer
; Version 2.01 11 Oct 99 Holger Loesche
; - unused macros WIDTH_8 and WIDTH_16 removed
;
;====================================================================
.SECTION VERSIONS, CONST
.SDATA "Start 2.01\n" ; comment this line to remove
;====================================================================
; 4 Settings
;====================================================================
;
; CHECK ALL OPTIONS WHETHER THEY FIT TO THE APPLICATION;
;
; Configure this startup file in the "Settings" section. Search for
; comments with leading "; <<<". This points to the items to be set.
;====================================================================
#set OFF 0
#set ON 1
;====================================================================
; 4.1 Controller Family
;====================================================================
#set MB90700 0
#set MB90200 1
#set MB90600 2
#set MB90500 3
#set MB90400 4
#set FAMILY MB90400 ; <<< select family
; NOTE: This startup file is not suitable for MB90610 series. Use
; start610.asm instead.
;====================================================================
; 4.2 Memory model
;====================================================================
; data code
#set SMALL 0 ; 16 Bit 16 Bit
#set MEDIUM 1 ; 16 Bit 24 Bit
#set COMPACT 2 ; 24 Bit 16 Bit
#set LARGE 3 ; 24 Bit 24 Bit
#set AUTOMODEL 4 ; works always, might waste 2 bytes
#set MEMMODEL AUTOMODEL ; <<< C-memory model
; The selected memory model should be set in order to fit to the
; model selected for the compiler.
; Note, in this startup version AUTOMODEL will work for all
; C-models. However, if the compiler is configured for SMALL or
; COMPACT, two bytes on stack will be lost. If this is not
; acceptable, the above setting should be set to the correct model.
;====================================================================
; 4.3 Constant Data Handling
;====================================================================
#set ROMCONST 0 ; works only with compiler ROMCONST
#set RAMCONST 1 ; works with BOTH compiler settings
#set AUTOCONST RAMCONST ; works with BOTH compiler settings
#set CONSTDATA AUTOCONST ; <<< set RAM/ROM/AUTOCONST
; - AUTOCONST (default) is a the same as RAMCONST
; - RAMCONST/AUTOCONST should always work, even if compiler is set to
; ROMCONST. If compiler is set to ROMCONST and this startup file is
; set to RAMCONST or AUTOCONST, this startup file will only generate
; an empty section CINIT. The code, which copies from CONST to CINIT
; will not have any effect then.
; - It is highly recommended to set the compiler to ROMCONST for
; single-chip mode or internal ROM+ext bus. The start-up file
; should be set to AUTOCONST.
; - ROMCONST setting on systems with full external bus requires exter-
; nal address mapping.
; Single-chip can be emulated by the emulator debugger.
; ROM mirror can also be used with simulator.
;
; see also MIRROR options of external bus settings
;====================================================================
; 4.4 Stack Type and Stack Size
;====================================================================
#set USRSTACK 0 ; use user stack, system stack for interrupts
#set SYSSTACK 1 ; use system stack for all (program + inter)
#set STACKUSE SYSSTACK ; <<< set used stacks
; - If only system stack is used and SSB is linked to a different bank
; than USB, make sure that all C-modules (which generate far pointers
; to stack data) have "#pragma SSB". Applies only to exclusive confi-
; gurations.
; - Note, several library functions require quite a big stack (due to
; ANSI). Check the stack information files (*.stk) in the LIB\907
; directory.
SSSIZE .EQU 384 ; <<< system stack size in words
#if STACKUSE == USRSTACK
USSIZE .EQU 384 ; <<< user stack size, if used
#else
USSIZE .EQU 1 ; just a dummy
#endif
#if STACKUSE == USRSTACK
# macro RELOAD_SP ; used after function call
MOVW A, #USTACK_TOP ; repair stack, if stream_init
MOVW SP,A ; was completed by RET (not RETP)
# endm
#else
# macro RELOAD_SP ; used after function call
MOVW A, #SSTACK_TOP ; repair stack, in case stream_init
MOVW SP,A ; was completed by RET (not RETP)
# endm
#endif
;====================================================================
; 4.5 General Register Bank
;====================================================================
#set REGBANK 0 ; <<< set default register bank
; set the General Register Bank that is to be used after startup.
; Usually, this is bank 0, which applies to address H'180..H'18F. Set
; in the range from 0 to 31.
; Note: All used register banks have to be reserved (linker options).
#if REGBANK > 31 || REGBANK < 0
# error REGBANK setting out of range
#endif
;====================================================================
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -