📄 crtsi.s
字号:
; C STARTUP FOR MC68HC08
; WITH AUTOMATIC DATA INITIALISATION
; Copyright (c) 1995 by COSMIC Software
;
xref _main, __memory, __idesc__, __stack
xdef _exit, __stext
;
switch .bss
__sbss:
switch .text
__stext:
ldhx #__stack ; initialize stack pointer
txs
ldhx #__idesc__ ; descriptor address
lda 1,x ; save start
psha ; address of
lda 0,x ; prom data
psha
aix #2 ; skip address
ibcl:
lda 0,x ; test flag byte
beq zbss ; no more segment
lda 4,x ; compute length
sub 2,sp ; of segment
psha
lda 3,x
sbc 2,sp
tst 1,sp ; if LSB nul,
beq ok ; keep it
inca ; else increment MSB
ok:
psha
lda 2,x ; destination address
psha ; on the stack
lda 1,x
psha
pshx ; and save
pshh ; pointer
dbcl:
ldx 7,sp ; load source pointer
pshx
ldx 9,sp
inc 9,sp ; increment pointer
bne oks
inc 8,sp
oks:
pulh
lda 0,x ; load byte
ldx 3,sp ; load source pointer
pshx
ldx 5,sp
inc 5,sp ; increment pointer
bne okd
inc 4,sp
okd:
pulh
sta 0,x ; store byte
dbnz 6,sp,dbcl ; count LSB
dbnz 5,sp,dbcl ; count MSB
pulh ; reload pointer
pulx
aix #5 ; next descriptor
ais #4 ; cleanup stack
bra ibcl ; and loop
zbss:
ais #2 ; remove pointer
ldhx #__sbss ; start of bss
bra loop ; start loop
zbcl:
clr 0,x ; clear byte
aix #1 ; next byte
loop:
cphx #__memory ; up to the end
bne zbcl ; and loop
prog:
jsr _main ; execute main
_exit:
bra _exit ; and stay here
;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -