📄 start167.166
字号:
AND R5,[R3]
MOV [R3],R5
ADD R4,#1
SUB R2,#1
JMPR cc_NZ,ClearBit
JMPR cc_UC,RepeatClear
ClearFar: EXTS R9,#1
MOV R3,[R8+]
RepClearFar:
$IF (WATCHDOG = 1)
SRVWDT ; SERVICE WATCHDOG
$ENDIF
EXTP R4,#1
MOVB [R3],RL5
ADD R3,#1
ADDC R4,#0
OR R3,#0C000H
SUB R2,#1
JMPR cc_NN,RepClearFar
JMPR cc_UC,RepeatClear
ClearNear:
$IF (WATCHDOG = 1)
SRVWDT ; SERVICE WATCHDOG
$ENDIF
MOVB [R4],RL5
ADD R4,#1
SUB R2,#1
JMPR cc_NN,ClearNear
JMPR cc_UC,RepeatClear
$ENDIF
EndClear:
$ENDIF
;------------------------------------------------------------------------------
;
; The following code is necessary, if the application program contains
; initialized variables at file level.
;
$IF (INIT_VARS = 1) ; *********************************************************
EXTRN ?C_INITSECSTART : WORD
Init_Vars:
$IF TINY ; ********************************************************************
MOV R8,#?C_INITSECSTART
RepeatInit:
$IF (WATCHDOG = 1)
SRVWDT ; SERVICE WATCHDOG
$ENDIF
MOV R2,[R8+]
JMPR cc_Z,EndInit
JBC R2.15,InitBit
MOV R4,R2
AND R2,#3FFFH
JMPR cc_NZ,LenLoad
MOV R4,#0
MOV R2,[R8+]
LenLoad: MOV R3,[R8+]
CopyInitVal: MOVB [R3],[R8+]
$IF (WATCHDOG = 1)
SRVWDT ; SERVICE WATCHDOG
$ENDIF
ADD R3,#1
SUB R2,#1
JMPR cc_NZ,CopyInitVal
JNB R8.0,RepeatInit
ADD R8,#1
ADDC R9,#0 ; potential overflow
JMPR cc_UC,RepeatInit
InitBit: MOVBZ R3,RL2
SHL R3,#1
OR R3,#0FD00H ; START OF BIT SPACE
MOV R4,#1
MOVB RL5,RH2
SHL R4,R5 ; CALCULATE BIT MASK
JB R2.7,SetBit
CPL R4 ; CLEAR BIT
AND R4,[R3]
JMPR cc_UC,StoreBit
SetBit: OR R4,[R3] ; SET BIT
StoreBit: MOV [R3],R4
JMPR cc_UC,RepeatInit
EndInit:
$ELSE ; $IF TINY **************************************************************
MOV R9,#SEG (?C_INITSECSTART)
MOV R8,#SOF (?C_INITSECSTART)
$IF (DPP3USE = 1) ; ***********************************************************
RepeatInit:
$IF (WATCHDOG = 1)
SRVWDT ; SERVICE WATCHDOG
$ENDIF
MOV DPP3,#3
EXTS R9,#1
MOV R2,[R8]
JMPR cc_Z,EndInit
ADD R8,#2
ADDC R9,#0
JBC R2.15,InitBit
MOV R4,R2
AND R2,#3FFFH
JMPR cc_NZ,LenLoad
MOV R4,#0
EXTS R9,#1
MOV R2,[R8]
ADD R8,#2
ADDC R9,#0
LenLoad: EXTS R9,#1
MOV R3,[R8]
ADD R8,#2
ADDC R9,#0
JB R4.14,CopyInitVal
MOV DPP3,R3
EXTS R9,#1
MOV R3,[R8]
ADD R8,#2
ADDC R9,#0
CopyInitVal: EXTS R9,#1
MOVB RL5,[R8]
ADD R8,#1
ADDC R9,#0
MOVB [R3],RL5
ADD R3,#1
JB R4.14,NoDPP3Adj
JB R3.14,NoDPP3Adj
ADD DPP3,#1
OR R3,#0C000H ; SET DPP3 Bits
NoDPP3Adj:
$IF (WATCHDOG = 1)
SRVWDT ; SERVICE WATCHDOG
$ENDIF
SUB R2,#1
JMPR cc_NZ,CopyInitVal
JNB R8.0,RepeatInit
ADD R8,#1
ADDC R9,#0 ; potential overflow
JMPR cc_UC,RepeatInit
InitBit: MOVBZ R3,RL2
SHL R3,#1
OR R3,#0FD00H ; START OF BIT SPACE
MOV R4,#1
MOVB RL5,RH2
SHL R4,R5 ; CALCULATE BIT MASK
JB R2.7,SetBit
CPL R4 ; CLEAR BIT
AND R4,[R3]
JMPR cc_UC,StoreBit
SetBit: OR R4,[R3] ; SET BIT
StoreBit: MOV [R3],R4
JMPR cc_UC,RepeatInit
$ELSE ; block IF (DPP3USE = 1) ************************************************
RepeatInit:
$IF (WATCHDOG = 1)
SRVWDT ; SERVICE WATCHDOG
$ENDIF
EXTS R9,#1
MOV R2,[R8]
JMPR cc_Z,EndInit
ADD R8,#2
ADDC R9,#0
JBC R2.15,InitBit
MOV R4,R2
AND R2,#3FFFH
JMPR cc_NZ,LenLoad
MOV R4,#0
EXTS R9,#1
MOV R2,[R8]
ADD R8,#2
ADDC R9,#0
LenLoad: EXTS R9,#1
MOV R3,[R8]
ADD R8,#2
ADDC R9,#0
JB R4.14,CopyNearVal
MOV R6,R3
EXTS R9,#1
MOV R3,[R8]
ADD R8,#2
ADDC R9,#0
CopyInitVal: EXTS R9,#1
MOVB RL5,[R8]
ADD R8,#1
ADDC R9,#0
EXTP R6,#1
MOV [R3],RL5
ADD R3,#1
ADDC R6,#0
$IF (WATCHDOG = 1)
SRVWDT ; SERVICE WATCHDOG
$ENDIF
SUB R2,#1
JMPR cc_NZ,CopyInitVal
JMPR cc_UC,CopyInitDone
CopyNearVal: EXTS R9,#1
MOVB RL5,[R8]
ADD R8,#1
ADDC R9,#0
MOVB [R3],RL5
ADD R3,#1
$IF (WATCHDOG = 1)
SRVWDT ; SERVICE WATCHDOG
$ENDIF
SUB R2,#1
JMPR cc_NZ,CopyNearVal
CopyInitDone: JNB R8.0,RepeatInit
ADD R8,#1
ADDC R9,#0 ; potential overflow
JMPR cc_UC,RepeatInit
InitBit: MOVBZ R3,RL2
SHL R3,#1
OR R3,#0FD00H ; START OF BIT SPACE
MOV R4,#1
MOVB RL5,RH2
SHL R4,R5 ; CALCULATE BIT MASK
JB R2.7,SetBit
CPL R4 ; CLEAR BIT
AND R4,[R3]
JMPR cc_UC,StoreBit
SetBit: OR R4,[R3] ; SET BIT
StoreBit: MOV [R3],R4
JMPR cc_UC,RepeatInit
$ENDIF ; close block IF (DPP3USE = 1) ****************************************
EndInit:
$ENDIF ; close block $IF TINY ************************************************
$ENDIF ; close $IF (INIT_VARS = 1) *******************************************
;------------------------------------------------------------------------------
$IF TINY
JMP main
$ELSE
JMP FAR main
$ENDIF
?C_RESET ENDP
?C_STARTUP_CODE ENDS
$IF (INIT_VARS = 1)
EXTERN ?C_ENDINIT:WORD
$ENDIF
;******************************************************************************
; *
; STRUCTURE OF THE INITIALIZATION INFORMATION *
; ------------------------------------------- *
; This section describes the initialization data generated by: *
; - C166 for explicit variable initializations (in ?C_INITSEC) *
; - L166 to clear memory regions (in ?C_CLRMEMSEC) *
; *
; Explicit variable initilizations at C source level are stored by C166 in *
; the section ?C_INITSEC. All partial sections are combined at linker level *
; to one section. The section end value DW 0 taken from the library module *
; ?C_ENDINIT. This module is included with the ?C_ENDINIT symbol definition. *
; *
; Structure of the ?C_INITSEC information: *
; ?C_INITSECSTART: [start address label] *
; <typ> + <length> [WORD] ----+ repeated *
; <address> [WORD or DWORD] ----+ repeated *
; <init_data> [BYTES according to length] ----+ repeated *
; 0x0000 [WORD] <end of list mark> *
; Whereby: *
; <typ> := 0x4000: WORD near address field, *
; 0x0000: DWORD PAG/POF address field (POF part set to DPP3) *
; 0x8080: set bit *
; 0x8000: clear bit *
; <init_data> := bytes to copy into memory specified by <address> *
; For bit initilizations (<typ> = 0x80x0) the address is encoded in the *
; <length> field and no further address information is generated. MSB of *
; <length> is the bit pos. LSB of <length> is the bit address. *
; *
; *
; Sections that start with ?xx0? are set to zero in the startup code. The *
; address information about these sections are stored by L166 in the section *
; ?C_CLRMEMSEC. *
; *
; Structure of the ?C_CLRMERSEC information: *
; ?C_CLRMEMSECSTART: [start address label] *
; <typ> + <length> [WORD] ----+ repeated *
; <address> [WORD or DWORD] ----+ repeated *
; 0x0000 [WORD] <end of list mark> *
; Whereby: *
; <typ> := 0x4000: WORD near address field, *
; 0x8000: DWORD PAG/POF address field (POF part set to DPP3) *
; 0x0000: bit area *
; For bit areas (<typ> = 0x0000) the address is encoded as WORD with LSB *
; as byte offset to 0xFD00 and MSB as bit number in the addressed byte. *
; *
;******************************************************************************
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -