+ Proper startup code for Amiga/m68k (for the first time in history)

git-svn-id: trunk@1951 -
This commit is contained in:
Károly Balogh 2005-12-14 23:36:33 +00:00
parent 24d972c012
commit d5aa345bb3
3 changed files with 96 additions and 57 deletions

2
.gitattributes vendored
View File

@ -3551,9 +3551,9 @@ rtl/amiga/Makefile.fpc svneol=native#text/plain
rtl/amiga/crt.pp svneol=native#text/plain
rtl/amiga/dos.pp svneol=native#text/plain
rtl/amiga/graph.pp svneol=native#text/plain
rtl/amiga/m68k/prt0.as -text
rtl/amiga/os.inc svneol=native#text/plain
rtl/amiga/printer.pp svneol=native#text/plain
rtl/amiga/prt0.as -text
rtl/amiga/readme -text
rtl/arm/arm.inc svneol=native#text/plain
rtl/arm/int64p.inc svneol=native#text/plain

95
rtl/amiga/m68k/prt0.as Normal file
View File

@ -0,0 +1,95 @@
|
| This file is part of the Free Pascal run time library.
| Copyright (c) 2005 by Karoly Balogh
|
| Startup code for Amiga/m68k RTL
|
| See the file COPYING.FPC, included in this distribution,
| for details about the copyright.
|
| This program is distributed in the hope that it will be useful,
| but WITHOUT ANY WARRANTY; without even the implied warranty of
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
.text
.align 4
| This symbol is required for lineinfo support!
.globl __EXESTART
__EXESTART:
.globl _start
.globl start
_start:
start:
movem.l d0-d7/a0-a6,-(sp)
| Get ExecBase
move.l 0x4,a6
move.l a6,_ExecBase
| Allocating new stack
move.l __stklen,d0
moveq.l #0,d1 | MEMF_ANY
jsr -684(a6) | AllocVec()
tst.l d0
beq __exit
move.l d0,stackArea
| Setting up StackSwap structure, and do the StackSwap
lea.l stackSwap,a0
move.l d0,(a0) | Bottom of the stack
add.l __stklen,d0
move.l d0,4(a0) | Top of the stack
move.l d0,8(a0) | Initial stackpointer
jsr -732(a6) | StackSwap()
jsr PASCALMAIN
.globl _haltproc
_haltproc:
move.l d0,returnValue
| Swapping the stack back
move.l _ExecBase,a6
lea.l stackSwap,a0
jsr -732(a6) | StackSwap()
| Freeing up stack area
move.l stackArea,a1
jsr -690(a6) | FreeVec()
__exit:
movem.l (sp)+,d0-d7/a0-a6
move.l returnValue,d0
rts
.data
.align 4
__stklen:
.long 262144
.globl _ExecBase
.globl SysBase
.align 4
SysBase:
_ExecBase:
.long 0
.globl returnValue
.align 4
returnValue:
.long 0
.globl stackArea
.align 4
stackArea:
.long 0
.globl stackSwap
.align 4
stackSwap:
.long 0
.long 0
.long 0

View File

@ -1,56 +0,0 @@
.text
.align 4
.globl _start
.globl start
_start:
start:
| Save stack pointer for exit() routine
movel sp,STKPTR | save stack pointer
| This was wrong compared to PCQ
| addl #4,STKPTR | account for this jsr to get to original
| Save the command line pointer to CommandLine
movel a0,__ARGS
beq .Ldont_nullit
| Remove $0a character from end of string
movew d0,d1
subqw #1,d1
cmpb #0x0a,a0@(0,d1:w)
bne .Lcontt
| Decrement count by one to remove the $0a character
movew d1,d0
.Lcontt:
moveb #0,a0@(0,d0:w) | null terminate it
movew d0,__ARGC
.Ldont_nullit:
jsr PASCALMAIN
movel STKPTR,sp
rts
.data
.align 4
.globl __ARGS
__ARGS: | pointer to the arguments
.long 0
.globl __ARGC
__ARGC: | number of arguments
.word 0
.globl STKPTR | Used to terminate the program, initial SP
STKPTR:
.long 0