📄 start.src
字号:
#line 1 "start.asm"
;;
;; C166/ST10 startup code generated by EDE for project pg320240
;;
;; If modifications are needed, disable generation of the startup code in EDE:
;; In the EDE Project Options dialog select Application, and then Startup. Make
;; sure the checkbox 'Generate system startup code and add it to project' is not
;; checked. Note that changes in EDE will now no longer be reflected in the
;; startup code. Also be aware that the modifications will be overwritten when
;; the checkbox is enabled again.
;;
$EXTEND
$CASE
$GENONLY
$DEBUG
$NOLOCALS
$CHECKCPU16
$CHECKBUS18
$NOMOD166 ; disable the internal set of SFRs
$STDNAMES(reg276.def) ; define SFRs
$INCLUDE(head.asm) ; Generic definitions (see product include dir)
#line 1 "c:\program files\tasking\c166 v8.0\include\head.asm"
;@" @(#)head.asm 1.43 02/10/15
;*****************************************************************************
;*
;* MODULE : head.asm
;*
;* APPLICATION : Run time library / Floating point library 80166
;*
;* DESCRIPTION : This floating point header file is included at the begin
;* of each floating point source module. And it contains
;* several settings and declarations, which are:
;* - Memory mode selection, to translate the floating
;* point library for segmented or non-segmented memory mode.
;* - Floating point error trap selection, to translate
;* floating point library as fast or as accurate.
;* - Declaration of floating point accumulators is done by the
;* linker/locator.
;* - Floating point register bank definition.
;* - Declaration of floating constants.
;*
;* ANNALIST : Guus Jansman
;*
;* Copyright 1992-2003 Altium BV
;*
;*****************************************************************************
#line 31 "c:\program files\tasking\c166 v8.0\include\head.asm"
; _EXT = 0, extended instruction set disabled
; _EXT = 1, extended instruction set support enabled
#line 36 "c:\program files\tasking\c166 v8.0\include\head.asm"
; _EXTMAC = 0, MAC instruction support disabled
; _EXTMAC = 1, MAC instruction support enabled
#line 42 "c:\program files\tasking\c166 v8.0\include\head.asm"
; _EXT2 = 0, C166Sv2.0/Super10 support disabled
; _EXT2 != 1, C166Sv2.0/Super10 support enabled, this implies _EXT
#line 48 "c:\program files\tasking\c166 v8.0\include\head.asm"
; _EXTMAC = 0, MAC support disabled
; _EXTMAC != 0, MAC support enabled, this implies _EXT
; _USRSTACK = 0, user stack model disabled
; _USRSTACK = 1, user stack model enabled
#line 60 "c:\program files\tasking\c166 v8.0\include\head.asm"
; Set default memory model
#line 65 "c:\program files\tasking\c166 v8.0\include\head.asm"
; _SINGLE_FP = 0, doubles are double precision
; _SINGLE_FP = 1, doubles are single precision (non-ANSI)
#line 71 "c:\program files\tasking\c166 v8.0\include\head.asm"
; FPCHKSPC = 0, invalid floating point results are undefined (non-ANSI)
; FPCHKSPC = 1, invalid floating point results give proper values
; FP_TRAP = 0, floating point error trap handling disabled
; FP_TRAP = 1, floating point error trap handling enabled (only if FPCHKSPC)
; FCMPTRAP = 0, floating point comparison will never cause a trap
; FCMPTRAP = 1, floating point comparison can cause trap (only if FP_TRAP)
; FPEXC_OP = 0, don't return floating point exception operation type
; FPEXC_OP = 1, return floating point exception operation type (only if FP_TRAP)
; _P166 = 0, don't protect multiplication/division (can be overruled by e.g. FIXMUL28)
; _P166 = 1, protect multiplication/division
; FIXMUL28 = 0, don't protect multiplication (can be overruled by e.g. _P166)
; FIXMUL28 = 1, protect multiplication
; FIXDIV18 = 0, don't protect division (can be overruled by e.g. _P166)
; FIXDIV18 = 1, protect division
; FIXCPU21 = 0, don't fix BFLDH/BFLDL problem CPU.21
; FIXCPU21 = 1, fix BFLDH/BFLDL problem CPU.21
; FIX_BFWD = 0, no fix for 166 problem S1
; FIX_BFWD = 1, fix 166 problem S1
; FIX_CPU1R006 = 0, no fix for 163 problem 01.006
; FIX_CPU1R006 = 1, fix problem 01.006
; FIX_STBUS1 = 0, no fix for ST problem ST_BUS1
; FIX_STBUS1 = 1, fix problem ST_BUS1
; FIX_EXTSEQ = 0, no fix for problem CR107092
; FIX_EXTSEQ = 1, fix problem CR107092
; FIX_LONDON1 = 0, don't fix London1&London1751
; FIX_LONDON1 = 1, fix London1&London1751 (overrules _P166/FIXDIV18)
; FPEXCEPT = OLD, old floating point exception method
; FPEXCEPT = IEEE, IEEE floating point exception method
; FIX_JMPRACACHE = 0, no fix for Egold problem CR108400:
; Program flow after not taken JMPR/JMPA can be broken
; FIX_JMPRACACHE = 1, fix problem CR108400
; FIX_EXT1DIV = 0, no fix for Egold problem CR105893:
; Interrupted division corrupted by division in ISR
; FIX_EXT1DIV = 1, fix problem CR 105893
; FIX_EXT1MDL = 0, no fix for Egold proble CR108309:
; MDL access immediately after a DIV causes wrong PSW values
; FIX_EXT1MDL = 1, fix problem CR 108309
; FIX_EXT1MDLMULDIV = 0, no fix for Egold proble CR108904:
; DIV/MUL interrupted by PEC causes invalid read/write
; FIX_EXT1MDLMULDIV = 1, fix problem CR 108904
#line 191 "c:\program files\tasking\c166 v8.0\include\head.asm"
$EXTEND ; enable all architecture extensions
$EXTMAC ; enable MAC architecture extensions
#line 199 "c:\program files\tasking\c166 v8.0\include\head.asm"
#line 203 "c:\program files\tasking\c166 v8.0\include\head.asm"
$MODEL( MEDIUM)
$SEGMENTED
ASSUME DPP3:SYSTEM
#line 241 "c:\program files\tasking\c166 v8.0\include\head.asm"
#line 248 "c:\program files\tasking\c166 v8.0\include\head.asm"
fbias EQU 127 ; EXCESS-127 float bias
dbias EQU 1023 ; EXCESS-1023 double bias
f_dbias EQU fbias - dbias ; bias adjustment for double to single
; conversion.
d_fbias EQU dbias - fbias ; bias adjustment for single to double
; conversion.
fprecb EQU 24 ; # of significant bits (single)
dprecb EQU 53 ; # of significant bits (double)
ffuzz EQU 24 ;
dfuzz EQU 55 ;
facint_2 LIT 'R5' ; Integer accumulator MSW (long).
facint_0 LIT 'R4' ; Integer accumulator LSW.
facint LIT 'R4' ; Integer accumulator (int).
fptrap LIT 'R1' ; Floating trap code accumulator.
fpexcop LIT 'R3' ; Floating exception operation accu
FOS1_MAN0 LIT 'R4' ; Float operand 1 mantissa MSB's
FOS1_MAN0H LIT 'RH4' ;
FOS1_MAN0L LIT 'RL4' ;
FOS1_MAN2 LIT 'R5' ; Float operand 1 mantissa LSB's
FOS1_MAN2H LIT 'RH5' ;
FOS1_MAN2L LIT 'RL5' ;
FOS1_MAN4 LIT 'R3' ; Float operand 1 mantissa round (RH3)
FOS1_MAN4H LIT 'RH3' ;
FOS1_MAN4L LIT 'RL3' ;
FOS1_EXP LIT 'R1' ; Float operand 1 exponent
FOS1_EXPH LIT 'RH1' ;
FOS1_EXPL LIT 'RL1' ;
FOS1_SGN LIT 'R3' ; Float operand 1 sign (R3.0)
FOS1_SGNH LIT 'RH3' ;
FOS1_SGNL LIT 'RL3' ;
FOS2_MAN0 LIT 'R10' ; Float operand 2 mantissa MSB's
FOS2_MAN2 LIT 'R11' ; Float operand 2 mantissa LSB's
FOS2_EXP LIT 'R2' ; Float operand 2 exponent
FOS2_EXPH LIT 'RH2' ;
FOS2_EXPL LIT 'RL2' ;
#line 288 "c:\program files\tasking\c166 v8.0\include\head.asm"
FOS2_EXPT LIT 'R2' ; Float operand 1 temporary exponent
FOS2_EXPTH LIT 'RH2' ;
FOS2_EXPTL LIT 'RL2' ;
FOS2_SGN LIT 'R3' ; Float operand 2 sign (R3.1)
FOS2_SGNH LIT 'RH3' ;
FOS2_SGNL LIT 'RL3' ;
FOD1_MAN0 LIT 'R7' ; Double operand 1 mantissa
FOD1_MAN0H LIT 'RH7' ;
FOD1_MAN0L LIT 'RL7' ;
FOD1_MAN2 LIT 'R8' ;
FOD1_MAN4 LIT 'R9' ;
FOD1_MAN6 LIT 'R5' ;
FOD1_MAN8 LIT 'R3' ; Double operand 1 mantissa round (RH3)
FOD1_MAN8H LIT 'RH3' ;
FOD1_MAN8L LIT 'RL3' ;
FOD1_EXP LIT 'R1' ; Double operand 1 exponent
FOD1_EXPH LIT 'RH1' ;
FOD1_EXPL LIT 'RL1' ;
FOD1_SGN LIT 'R4' ; Double operand 1 sign (R4.0)
FOD2_MAN0 LIT 'R6' ; Double operand 2 mantissa
FOD2_MAN0H LIT 'RH6' ;
FOD2_MAN0L LIT 'RL6' ;
FOD2_MAN2 LIT 'R12' ;
FOD2_MAN4 LIT 'R13' ;
FOD2_MAN6 LIT 'R14' ;
FOD2_EXP LIT 'R2' ; Double operand 2 exponent
FOD2_EXPH LIT 'RH2' ;
FOD2_EXPL LIT 'RL2' ;
#line 320 "c:\program files\tasking\c166 v8.0\include\head.asm"
FOD2_EXPT LIT 'R2' ; Double operand 2 temporary exponent
FOD2_SGN LIT 'R4' ; Double operand 2 sign (R4.1)
#line 330 "c:\program files\tasking\c166 v8.0\include\head.asm"
; Watchdog timer support
;
; The macro SERVWDT will service the watchdog timer if support has
; been enabled
#line 338 "c:\program files\tasking\c166 v8.0\include\head.asm"
#line 340 "c:\program files\tasking\c166 v8.0\include\head.asm"
#line 346 "c:\program files\tasking\c166 v8.0\include\head.asm"
; _BFWDNOP() can be used to solve 166 problem S1
; Erroneous Byte Forwarding for Internal RAM locations (only needed for old uC's).
; Place 0, 1 or 2 _BFWD_NOP's after byte write instructions.
#line 355 "c:\program files\tasking\c166 v8.0\include\head.asm"
#line 357 "c:\program files\tasking\c166 v8.0\include\head.asm"
; FIX_MULDIV = IEN, multiplication/division protected by "BCLR IEN"
; FIX_MULDIV = ILVL, multiplication/division protected by "OR PSW, #0F000h"
; FIX_MULDIV does not seem to be used!
; _CPU1R006() can be used to solve 163-24D problem CPU 01.006
; (CPU hangs with execution mov Rn, [Rm+#data16]).
; Replace "MOV Rd, [Ri+#data16]" with "_CPU1R006( Rd, Ri, data16 )".
#line 376 "c:\program files\tasking\c166 v8.0\include\head.asm"
#line 379 "c:\program files\tasking\c166 v8.0\include\head.asm"
; _STBUS1() can be used to solve ST10 problem ST_BUS1
; (PEC transfers and JMPS).
; Replace "JMPS SEG func, SOF func" with "_STBUS1( func )".
; Of course this macro only influences segmented memory models.
#line 394 "c:\program files\tasking\c166 v8.0\include\head.asm"
#line 397 "c:\program files\tasking\c166 v8.0\include\head.asm"
; The macro _LONDON1 expands to an ATOMIC #2 instruction when FIX_LONDON1 is set.
; otherwise _LONDON1 expands to an empty macro. This fix only applies to extended
; architectures.
#line 407 "c:\program files\tasking\c166 v8.0\include\head.asm"
#line 409 "c:\program files\tasking\c166 v8.0\include\head.asm"
; the macro FIX_JMPRACACHE can be used to solve Egold problem CR108400
; (Program flow after not taken JMPR/JMPA can be broken).
; After each unconditional JMPR or JMPA, insert an unconditional JMPR
; to the instruction following it.
#line 420 "c:\program files\tasking\c166 v8.0\include\head.asm"
#line 422 "c:\program files\tasking\c166 v8.0\include\head.asm"
; In the floating point code is the instruction "mulu Rx, Ry" replaced by the
; macro MUI( Rx, Ry ).
; Depending of the flags this can bypass many CPU errors, like:
; problem7 Incorrect multiply or divide results during hold states
; problem17 Interrupted multiplication in combination with higher priority
; interrupt after RETI
; problem28 See CPU.11
; CPU.2 MUL/DIV last instruction in ATOMIC or EXTEND sequence
; CPU.11 Stack underflow trap during restart of interrupted multiply
; CPU.18 Interrupted multiply/divide instructions in internal Flash
#line 477 "c:\program files\tasking\c166 v8.0\include\head.asm"
; In the floating point code is the instruction "divlu Rx" replaced by the
; macro DIL( Rx, PREMDLHACCESS, POSTMDLACCESS ).
; Depending of the flags this can bypass many CPU errors, like:
; problem7 Incorrect multiply or divide results during hold states
; CPU.2 MUL/DIV last instruction in ATOMIC or EXTEND sequence
; CPU.18 Interrupted multiply/divide instructions in internal Flash
; LONDON1751 DIV result in MDH/MDL can be distorted by explicit CSFR write
; Remember there's a nasty CPU error (CPU.17/problem30) making the overflow
; flag suspicious.
#line 549 "c:\program files\tasking\c166 v8.0\include\head.asm"
; In the floating point code is the instruction "divX Rx" replaced by the
; macro DIV( INSTRUCTION, Rx, PREMDLHACCESS, POSTMDLACCESS ).
; Depending of the flags this can bypass CPU errors, like:
; CR105893 FIX_EXT1DIV div corrupted if interrupted by div
; CR108309 FIX_EXT1MDLDIV mdl access corrupts if after div
; CR108904 FIX_EXT1MDLHMULDIV PEC interrupt corrupts if div after MDL/H access
#line 598 "c:\program files\tasking\c166 v8.0\include\head.asm"
; Macro _CALL() creates the right code for a direct/indirect function call
; Macro _RET() creates the right code for function return.
; These macro's are added to support _USRSTACK function call and return.
; _USRSTACK code is generated if variable _USRSTACK is set, else a normal
; function call and return (CALL/RET) will be generated.
; Rx is a temporary register. R10 or R11 could be used for Rx without saving
; and restoring the contents in it for the most cases. (R10 now best choice.)
; Register R2 is used in the return stub function and in the return macro
; for tiny and medium model, so operands may not be passed via register R2 !
#line 615 "c:\program files\tasking\c166 v8.0\include\head.asm"
#line 620 "c:\program files\tasking\c166 v8.0\include\head.asm"
#line 623 "c:\program files\tasking\c166 v8.0\include\head.asm"
#line 725 "c:\program files\tasking\c166 v8.0\include\head.asm"
; Unpack one single precision floating point operand
#line 730 "c:\program files\tasking\c166 v8.0\include\head.asm"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -