三:
@far @interrupt void NonHandledInterrupt (void)
{
/* in order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction
*/
return;
}
就是啥也不干,因为不是希望发生的中断.
调试的时候也可以在里面设个断点,侦测非预期的中断(注释说的)
#pragma space () @near
#pragma space [] @tiny
#pragma space auto [] @near
#pragma space * @near
#pragma space * () @near
#pragma space const @near
#define __MODS0__ 1
demo.lkf文件内容。
# LINK COMMAND FILE AUTOMATICALLY GENERATED BY STVD7
# SHOULD NOT BE MANUALLY MODIFIED
#
# Put you segment configuration here
# define the .share segment when using compact or memory models only
#<BEGIN SEGMENT_CONF>
# Segment Code,Constants:
+seg .const -b 0x8080 -m 0x1ff80 -n .const -it
+seg .text -a .const -n .text
# Segment Eeprom:
+seg .eeprom -b 0x4000 -m 0x800 -n .eeprom
# Segment Zero Page:
+seg .bsct -b 0x0 -m 0x100 -n .bsct
+seg .ubsct -a .bsct -n .ubsct
+seg .bit -a .ubsct -n .bit -id
+seg .share -a .bit -n .share -is
# Segment Ram:
+seg .data -b 0x100 -m 0x1300 -n .data
+seg .bss -a .data -n .bss
#<END SEGMENT_CONF>
# Put you startup file here (it depends on the model used)
#<BEGIN STARTUP_FILE>
crtsi0.sm8
#<END STARTUP_FILE>
# Put your object files here (they depend on you application)
#<BEGIN OBJECT_FILES>
Debug\main.o
#<END OBJECT_FILES>
# Put your library name here (it depends on the model used)
#<BEGIN LIBRARY_FILES>
libis0.sm8
libm0.sm8
#<END LIBRARY_FILES>
# Put your interrupt vectors file here if needed
#<BEGIN VECTOR_FILE>
+seg .const -b 0x8000 -k
Debug\stm8_interrupt_vector.o
#<END VECTOR_FILE>
#<BEGIN DEFINED_VARIABLES>
+def [email=__endzp=@.ubsct]__endzp=@.ubsct[/email] # end of uninitialized zpage
+def [email=__memory=@.bss]__memory=@.bss[/email] # end of bss segment
+def __stack=0x17ff
#<END DEFINED_VARIABLES>
2、Stack Short (mods0) global variables are defaulted to short range.
Any global object in long range will have to be accessed explicitly
with the @near modifier unless accessed through a pointer.
3、
CALLF - Extended Direct addressing mode (only for CALLF and JPF)
The address is an extended word, thus allowing 000000 to FFFFFF addressing space, but
requires 3 bytes after the op-code.
Example:CALLF $123456
Op: PC← PC + 4
M(SP--) ← PCL
M(SP--) ← PCH
PCH← M(longmem)
PCL← M(longmem + 1)
CALL - Call to Subroutine with address in same section
Example:CALL [$1234.w]
Op PC = PC+lgth
(SP--) = PCL
(SP--) = PCH
PC = dst
CALLR - Call Subroutine relative
The current PC register value is pushed onto the stack, then PC is loaded
with the relative destination addresss. This instruction is used, once a
program is debugged, to shrink the overall program size. The CALLR
destination and the corresponding RET instruction address must be in the
same section, as PCE is not stacked.
老兄要仔细看看PM0044 - STM8 CPU programming manual.pdf 关于汇编指令集的解释啊。