📄 startlt.s
字号:
;**********************************************************************
; Copyright 1993 Software Development Systems, Inc.
; All rights reserved
; lian tiao yong
; Example startup code for the 68000 family to initialize RAM
; and call the user function main().
;**********************************************************************
XDEF _START,USER,__brkp,__brksz
XREF _STKTOP,DATA,_main
; XREF _rotaryProcess,_enterPress
;***********************************************************************
; If C++ style startup code is not desired, then
; define CPLUSPLUS to 0
;***********************************************************************
CPLUSPLUS = 0
;**********************************************************************
; Define variables to track memory allocations for mbrk().
;**********************************************************************
SECTION ram
__brkp DS.L 1 ; point to available memory
__brksz DS.L 1 ; number of available bytes
;***************************************************************
; The reset vector will point to this code (START).
; By the time we get here, A7 will have been initialized.
;***************************************************************
SECTION code
.STK "none" ; terminate call chain for -OG
_START MOVE.L #_STKTOP,A7 ; set the stack pointer
MOVE.L #0,A6 ; terminate call chain for -Og
; move.w #$0400,($fffb04).l ;rem by wzm
;**********added by wzm ******************
move #$0410,($fffb04).l ;use 4k sram and tpu ram
move #$0100,($fffb00).l ;enable
move #$0004,($fffb44).l ;4k SRAM startaddress addr23-addr16
move #$0000,($fffb46).l ;addr15-addr12
move #$0200,($fffb40).l ;enable
;**********added by xyp*******************
; MOVE.W #0xFF,0xFFFA44 ;*SIM_CSPAR0 = 0x00FF;Init portC as general output function
; MOVE.W #0x300,0xFFFA46 ;*SIM_CSPAR1 = 0x0300
; MOVE.L #_ServZouQi,0x100 ;added by xyp
; MOVE.L #0x000000,0x154
; MOVE.L #0x000000,0x15C
;***********************************************************
; Zero out uninitialized RAM.
;***********************************************************
MOVE.L #`BASE(ram),A1 ; A1 = base of region ram
MOVE.L #`SIZE(ram),D0 ; D0 = size of region ram
LSR.L #2,D0 ; compute size in longs
BRA ZDBF ; enter a fast loop
ZLP: CLR.L (A1)+ ; clear four bytes at a time
ZDBF: DBF D0,ZLP ; up to 256K in inner loop
SUB.L #$10000,D0 ; rest in outer loop
BHS ZLP
;***********************************************************
; Initialize other RAM from ROM.
;***********************************************************
MOVE.L #DATA,A0 ; A0 = ROM base of region data
MOVE.L #`BASE(data),A1 ; A1 = RAM base of region data
MOVE.L #`SIZE(data),D0 ; D0 = size of region data
LSR.L #2,D0 ; compute size in longs
BRA IDBF ; enter a fast loop
ILP: MOVE.L (A0)+,(A1)+ ; move four bytes at a time
IDBF: DBF D0,ILP ; up to 256K in inner loop
SUB.L #$10000,D0 ; rest in outer loop
BHS ILP
;***********************************************************
; Initialize memory allocator.
;***********************************************************
MOVE.L #`BASE(malloc),D0 ; address of malloc region
MOVE.L #`SIZE(malloc),D1 ; size of malloc region
.IF "ptrd"?"2"
SWAP D0 ; handle 2-byte C "pointers"
.ENDIF
.IF "long"?"2"
SWAP D1 ; handle 2-byte C "longs"
.ENDIF
MOVE.L D0,__brkp ; vars referenced by mbrk()
MOVE.L D1,__brksz
;***********************************************************
; Invoke main() with no arguments.
;***********************************************************
JSR _main ; "int" return value in D0
DONE BRA DONE ; loop if main ever returns
USER BRA _START
;**********************************************************************
; RESET VECTOR: to supervisor program space at address 0.
;**********************************************************************
SECTION reset
DC.L _STKTOP ; initial stack pointer
DC.L _START ; initial execution address
;**********************************************************************
; OTHER EXCEPTION VECTORS: to supervisor data space at address 8,
; or 8 bytes beyond where the vector base register will point.
; This table is commented out because no actual interrupt rou-
; tines are provided.
;**********************************************************************
SECTION vects
; DC.L BUSERROR,ADRERROR ; 0x08
; DC.L ILLEGAL,ZERODIV,CHK,TRAPV ; 0x10
; DC.L PRIVILEGE,TRACE,EMULA,EMULF ; 0x20
; DC.L RESVD,PROTO,FORMAT,UNINIT ; 0x30
; DCB.L 8,RESVD ; 0x40
; DC.L SPURIOUS,AUTO1,AUTO2,AUTO3 ; 0x60
; DC.L AUTO4,AUTO5,AUTO6,AUTO7 ; 0x70
; DC.L TRAP0,TRAP1,TRAP2,TRAP3 ; 0x80
; DC.L TRAP4,TRAP5,TRAP6,TRAP7 ; 0x90
; DC.L TRAP8,TRAP9,TRAPA,TRAPB ; 0xa0
; DC.L TRAPC,TRAPD,TRAPE,TRAPF ; 0xb0
; DC.L FUNORD,FNEXACT,FZERODIV,FUNFLOW ; 0xc0
; DC.L FOPND,FOVFLOW,FSNAN,RESVD ; 0xd0
; DCB.L 8,RESVD ; 0xe0
; DCB.L 62,USER ; 0x100
; DC.L _ServZouQi ; 0x100
; DCB.L 191,USER ; 0x100
DCB.L 254,USER
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -