📄 boot49k.asm
字号:
#define USR_STACK 0x2700 ; Top address of User stack (Don't change)
_STEXT SECTION CODE,PUBLIC,0
_CONST SECTION CODE,PUBLIC,1
_GCONST SECTION CODE,PUBLIC,1
_DATA SECTION DATA,PUBLIC,1
_GDATA SECTION DATA,PUBLIC,1
_ROMDATA SECTION CODE,PUBLIC,1
_GROMDATA SECTION CODE,PUBLIC,1
_ROMDATAEND SECTION CODE,PUBLIC,1
_ENTRY SECTION CODE,PUBLIC,0
_TEXT SECTION CODE,PUBLIC,0
_BSS SECTION DATA,PUBLIC,1
_GBSS SECTION DATA,PUBLIC,1
_BSSEND SECTION DATA,PUBLIC,1
GLOBAL _main
GLOBAL _nmi
GLOBAL _int_irq0
GLOBAL _int_irq1
GLOBAL _int_irq2
GLOBAL _int_irq3
GLOBAL _int_irq4
GLOBAL _int_irq5
GLOBAL _int_tm0
GLOBAL _int_tm1
GLOBAL _int_tm2
GLOBAL _int_tm3
GLOBAL _int_tm4
GLOBAL _int_tm6
GLOBAL _int_tb
GLOBAL _int_tm7
GLOBAL _int_tm7oc2
GLOBAL _int_sc0r
GLOBAL _int_sc0t
GLOBAL _int_sc1
GLOBAL _int_sc3
GLOBAL _int_ad
GLOBAL _int_atc1
_STEXT SECTION ; Specifies -T_STEXT=5808 by linker
jmp Reset ; Sets reset vector
org 0x04
jmp _nmi ; #01:NMI
org 0x08
jmp _int_irq0 ; #02:IRQ0
org 0x0c
jmp _int_irq1 ; #03:IRQ1
org 0x10
jmp _int_irq2 ; #04:IRQ2
org 0x14
jmp _int_irq3 ; #05:IRQ3
org 0x18
jmp _int_irq4 ; #06:IRQ4
org 0x1c
jmp _int_irq5 ; #07:IRQ5
org 0x20
jmp NoIRQ ; #08:Reserved
org 0x24
jmp _int_tm0 ; #09:TM0IRQ
org 0x28
jmp _int_tm1 ; #10:TM1IRQ
org 0x2c
jmp _int_tm2 ; #11:TM2IRQ
org 0x30
jmp _int_tm3 ; #12:TM3IRQ
org 0x34
jmp _int_tm4 ; #13:TM4IRQ
org 0x38
jmp NoIRQ ; #14:Reserved
org 0x3c
jmp _int_tm6 ; #15:TM6IRQ
org 0x40
jmp _int_tb ; #16:TBIRQ
org 0x44
jmp _int_tm7 ; #17:TM7IRQ
org 0x48
jmp _int_tm7oc2 ; #18:TM7OC2IRQ
org 0x4c
jmp NoIRQ ; #19:Reserved
org 0x50
jmp NoIRQ ; #20:Reserved
org 0x54
jmp _int_sc0r ; #21:SC0RIRQ
org 0x58
jmp _int_sc0t ; #22:SC0TIRQ
org 0x5c
jmp _int_sc1 ; #23:SC1IRQ
org 0x60
jmp NoIRQ ; #24:Reserved (monitor SC2IRQ)
org 0x64
jmp _int_sc3 ; #25:SC3IRQ
org 0x68
jmp _int_ad ; #26:ADIRQ
org 0x6c
jmp NoIRQ ; #27:Reserved
org 0x70
jmp _int_atc1 ; #28:ATC1IRQ
org 0x74
jmp NoIRQ ; #29:Reserved
org 0x78
jmp NoIRQ ; #30:Reserved
org 0x80 ; To location _STEXT + 0x80 (0x5888)
_TEXT SECTION
NoIRQ:
rti ; Function that does nothing other than return
Reset:
movw USR_STACK,A0 ; Initializes the stack pointer
movw A0,SP
; Initializes the static parameter
movw _BSS,A0 ; Set start address of _BSS area to A0
sub D0,D0 ; D0 = 0
clear1:
mov D0,(A0)
addw 0x1,A0
cmpw _BSSEND,A0 ; Is the end of the RAM area?
blt clear1 ; To clear1 if _BSSEND > A0
; Initializes the static parameter with
; default value
raminit:
movw _ROMDATA,A0
movw _DATA,A1
cmpw _GROMDATA,A0
beq next1
init1: ; ROMDATA(A0) -> DATA(A1)
mov (A0),D0
mov D0,(A1)
addw 0x1,A0
addw 0x1,A1
cmpw _GROMDATA,A0
bne init1
next1:
movw _GROMDATA,A0
movw _GDATA,A1
cmpw _ROMDATAEND,A0
beq next2
init2: ; GROMDATA(A0) -> GDATA(A1)
mov (A0),D0
mov D0,(A1)
addw 0x1,A0
addw 0x1,A1
cmpw _ROMDATAEND,A0
bne init2
next2: ; Initializes the register
subw DW0,DW0
movw DW0,DW1
movw DW0,A0
movw DW0,A1
; Calls the function main
_loop1:
jsr _main
bra _loop1
END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -