mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-19 23:19:24 +02:00
* rtl part of first Nintendo DS port
git-svn-id: trunk@5593 -
This commit is contained in:
parent
96e1c482bc
commit
9e6d19a494
20
.gitattributes
vendored
20
.gitattributes
vendored
@ -4835,6 +4835,26 @@ rtl/morphos/utild2.inc svneol=native#text/plain
|
||||
rtl/morphos/utilf.inc svneol=native#text/plain
|
||||
rtl/morphos/utility.pp svneol=native#text/plain
|
||||
rtl/morphos/varutils.pp svneol=native#text/plain
|
||||
rtl/nds/Makefile -text
|
||||
rtl/nds/Makefile.fpc -text
|
||||
rtl/nds/classes.pp -text
|
||||
rtl/nds/cprt07.as -text
|
||||
rtl/nds/cprt09.as -text
|
||||
rtl/nds/dos.pp -text
|
||||
rtl/nds/ndsbios.inc -text
|
||||
rtl/nds/ndsbiosh.inc -text
|
||||
rtl/nds/prt07.as -text
|
||||
rtl/nds/prt09.as -text
|
||||
rtl/nds/sysdir.inc -text
|
||||
rtl/nds/sysfile.inc -text
|
||||
rtl/nds/sysheap.inc -text
|
||||
rtl/nds/sysos.inc -text
|
||||
rtl/nds/sysosh.inc -text
|
||||
rtl/nds/system.pp -text
|
||||
rtl/nds/systhrd.inc -text
|
||||
rtl/nds/sysutils.pp -text
|
||||
rtl/nds/tthread.inc -text
|
||||
rtl/nds/varutils.pp -text
|
||||
rtl/netbsd/Makefile svneol=native#text/plain
|
||||
rtl/netbsd/Makefile.fpc svneol=native#text/plain
|
||||
rtl/netbsd/errno.inc svneol=native#text/plain
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1882,6 +1882,7 @@ rtl/morphos/*.ppu
|
||||
rtl/morphos/*.s
|
||||
rtl/morphos/fpcmade.*
|
||||
rtl/morphos/units
|
||||
rtl/nds/parcheggio
|
||||
rtl/netbsd/*.bak
|
||||
rtl/netbsd/*.exe
|
||||
rtl/netbsd/*.o
|
||||
|
@ -27,6 +27,7 @@ dirs_netwlibc=netwlibc
|
||||
dirs_palmos=palmos
|
||||
dirs_solaris=solaris
|
||||
dirs_gba=gba
|
||||
dirs_nds=nds
|
||||
|
||||
[install]
|
||||
fpcpackage=y
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
procedure fpc_cpuinit;
|
||||
begin
|
||||
{$if not(defined(wince)) and not(defined(gba))}
|
||||
{$if not(defined(wince)) and not(defined(gba)) and not(defined(nds))}
|
||||
asm
|
||||
rfs r0
|
||||
and r0,r0,#0xffe0ffff
|
||||
|
@ -1278,7 +1278,7 @@ end;
|
||||
InitHeap
|
||||
*****************************************************************************}
|
||||
|
||||
{$ifndef gba}
|
||||
{$if not(defined(gba)) and not(defined(nds))}
|
||||
{ This function will initialize the Heap manager and need to be called from
|
||||
the initialization of the system unit }
|
||||
procedure InitHeap;
|
||||
@ -1290,7 +1290,7 @@ begin
|
||||
freeoslistcount := 0;
|
||||
fillchar(internal_status,sizeof(internal_status),0);
|
||||
end;
|
||||
{$endif gba}
|
||||
{$endif}
|
||||
|
||||
procedure FinalizeHeap;
|
||||
var
|
||||
|
2091
rtl/nds/Makefile
Normal file
2091
rtl/nds/Makefile
Normal file
File diff suppressed because it is too large
Load Diff
227
rtl/nds/Makefile.fpc
Normal file
227
rtl/nds/Makefile.fpc
Normal file
@ -0,0 +1,227 @@
|
||||
#
|
||||
# Makefile.fpc for Free Pascal NDS RTL
|
||||
#
|
||||
|
||||
[package]
|
||||
main=rtl
|
||||
|
||||
[target]
|
||||
loaders=prt07 prt09 cprt07 cprt09
|
||||
units=$(SYSTEMUNIT) objpas macpas strings \
|
||||
# dos \
|
||||
sysutils \
|
||||
classes math typinfo varutils fmtbcd ctypes \
|
||||
charset ucomplex getopts matrix \
|
||||
variants types rtlconsts sysconst dateutil \
|
||||
# exec timer doslib utility hardware inputevent graphics layers \
|
||||
# these can be moved to packages later
|
||||
# clipboard datatypes asl ahi tinygl get9 muihelper \
|
||||
#rsts=math rtlconsts varutils typinfo variants classes sysconst dateutil fpmkunit
|
||||
|
||||
[require]
|
||||
nortl=y
|
||||
|
||||
[install]
|
||||
fpcpackage=y
|
||||
|
||||
[default]
|
||||
fpcdir=../..
|
||||
target=nds
|
||||
cpu=arm
|
||||
|
||||
[compiler]
|
||||
includedir=$(INC) $(PROCINC)
|
||||
sourcedir=$(INC) $(PROCINC) $(COMMON)
|
||||
|
||||
|
||||
[prerules]
|
||||
RTL=..
|
||||
INC=$(RTL)/inc
|
||||
COMMON=$(RTL)/common
|
||||
PROCINC=$(RTL)/$(CPU_TARGET)
|
||||
UNITPREFIX=rtl
|
||||
SYSTEMUNIT=system
|
||||
|
||||
# Use new feature from 1.0.5 version
|
||||
# that generates release PPU files
|
||||
# which will not be recompiled
|
||||
ifdef RELEASE
|
||||
override FPCOPT+=-Ur
|
||||
endif
|
||||
|
||||
# Paths
|
||||
OBJPASDIR=$(RTL)/objpas
|
||||
GRAPHDIR=$(INC)/graph
|
||||
|
||||
[rules]
|
||||
# Get the system independent include file names.
|
||||
# This will set the following variables :
|
||||
# SYSINCNAMES
|
||||
include $(INC)/makefile.inc
|
||||
SYSINCDEPS=$(addprefix $(INC)/,$(SYSINCNAMES))
|
||||
|
||||
# Get the processor dependent include file names.
|
||||
# This will set the following variables :
|
||||
# CPUINCNAMES
|
||||
include $(PROCINC)/makefile.cpu
|
||||
SYSCPUDEPS=$(addprefix $(PROCINC)/,$(CPUINCNAMES))
|
||||
|
||||
# Put system unit dependencies together.
|
||||
SYSDEPS=$(SYSINCDEPS) $(SYSCPUDEPS)
|
||||
|
||||
|
||||
#
|
||||
# Loaders
|
||||
#
|
||||
|
||||
prt07$(OEXT) : prt07.as
|
||||
$(AS) $(ASTARGET) -o $(UNITTARGETDIRPREFIX)prt07$(OEXT) prt07.as
|
||||
|
||||
prt09$(OEXT) : prt09.as
|
||||
$(AS) $(ASTARGET) -o $(UNITTARGETDIRPREFIX)prt09$(OEXT) prt09.as
|
||||
|
||||
cprt07$(OEXT) : cprt07.as
|
||||
$(AS) $(ASTARGET) -o $(UNITTARGETDIRPREFIX)cprt07$(OEXT) cprt07.as
|
||||
|
||||
cprt09$(OEXT) : cprt09.as
|
||||
$(AS) $(ASTARGET) -o $(UNITTARGETDIRPREFIX)cprt09$(OEXT) cprt09.as
|
||||
|
||||
#
|
||||
# Base Units (System, strings, os-dependent-base-unit)
|
||||
#
|
||||
|
||||
$(SYSTEMUNIT)$(PPUEXT) : $(SYSTEMUNIT).pp $(SYSDEPS)
|
||||
$(COMPILER) -Us -Sg $(SYSTEMUNIT).pp $(REDIR)
|
||||
|
||||
objpas$(PPUEXT): $(OBJPASDIR)/objpas.pp $(INC)/except.inc $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/objpas.pp $(REDIR)
|
||||
|
||||
strings$(PPUEXT) : $(INC)/strings.pp $(INC)/stringsi.inc \
|
||||
$(PROCINC)/strings.inc $(PROCINC)/stringss.inc \
|
||||
$(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
#
|
||||
# System Dependent Units
|
||||
#
|
||||
|
||||
#ports$(PPUEXT) : ports.pas objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
#doscalls$(PPUEXT) : doscalls.pas strings$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
#
|
||||
# TP7 Compatible RTL Units
|
||||
#
|
||||
|
||||
dos$(PPUEXT) : dos.pp $(INC)/filerec.inc $(INC)/textrec.inc strings$(PPUEXT) \
|
||||
$(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
#crt$(PPUEXT) : crt.pas $(INC)/textrec.inc $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
objects$(PPUEXT) : $(INC)/objects.pp dos$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
#printer$(PPUEXT) : printer.pas $(INC)/textrec.inc $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
#graph$(PPUEXT) : graph.pp
|
||||
|
||||
#
|
||||
# Delphi Compatible Units
|
||||
#
|
||||
|
||||
sysutils$(PPUEXT) : sysutils.pp $(wildcard $(OBJPASDIR)/sysutils/*.inc) \
|
||||
objpas$(PPUEXT) dos$(PPUEXT) sysconst$(PPUEXT)
|
||||
$(COMPILER) -Fi$(OBJPASDIR)/sysutils sysutils.pp
|
||||
|
||||
classes$(PPUEXT) : classes.pp $(wildcard $(OBJPASDIR)/classes/*.inc) \
|
||||
sysutils$(PPUEXT) typinfo$(PPUEXT) rtlconsts$(PPUEXT) types$(PPUEXT)
|
||||
$(COMPILER) -Fi$(OBJPASDIR)/classes classes.pp
|
||||
|
||||
typinfo$(PPUEXT): $(OBJPASDIR)/typinfo.pp objpas$(PPUEXT)
|
||||
$(COMPILER) -Sg $(OBJPASDIR)/typinfo.pp $(REDIR)
|
||||
|
||||
math$(PPUEXT): $(OBJPASDIR)/math.pp objpas$(PPUEXT) sysutils$(PPUEXT)
|
||||
$(COMPILER) $(OBJPASDIR)/math.pp $(REDIR)
|
||||
|
||||
varutils$(PPUEXT) : $(OBJPASDIR)/cvarutil.inc $(OBJPASDIR)/varutils.inc \
|
||||
$(OBJPASDIR)/varutilh.inc varutils.pp
|
||||
$(COMPILER) -I$(OBJPASDIR) varutils.pp $(REDIR)
|
||||
|
||||
fmtbcd$(PPUEXT) : $(OBJPASDIR)/fmtbcd.pp objpas$(PPUEXT) sysutils$(PPUEXT) variants$(PPUEXT) classes$(PPUEXT) system$(PPUEXT)
|
||||
$(COMPILER) $(OBJPASDIR)/fmtbcd.pp
|
||||
|
||||
types$(PPUEXT) : $(OBJPASDIR/types.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $(OBJPASDIR)/types.pp
|
||||
|
||||
rtlconsts$(PPUEXT) : $(OBJPASDIR)/rtlconsts.pp
|
||||
$(COMPILER) $(OBJPASDIR)/rtlconsts.pp
|
||||
|
||||
sysconst$(PPUEXT) : $(OBJPASDIR)/sysconst.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) $(OBJPASDIR)/sysconst.pp
|
||||
|
||||
dateutil$(PPUEXT) : $(OBJPASDIR)/dateutil.pp
|
||||
$(COMPILER) -I$(OBJPASDIR) $(OBJPASDIR)/dateutil.pp
|
||||
|
||||
#
|
||||
# Mac Pascal Model
|
||||
#
|
||||
|
||||
macpas$(PPUEXT) : $(INC)/macpas.pp system$(PPUEXT)
|
||||
$(COMPILER) $(INC)/macpas.pp $(REDIR)
|
||||
|
||||
#
|
||||
# Other system-independent RTL Units
|
||||
#
|
||||
|
||||
ucomplex$(PPUEXT): $(INC)/ucomplex.pp math$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
getopts$(PPUEXT) : $(INC)/getopts.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
heaptrc$(PPUEXT) : $(INC)/heaptrc.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
$(COMPILER) -Sg $(INC)/heaptrc.pp $(REDIR)
|
||||
|
||||
#lineinfo$(PPUEXT) : $(INC)/lineinfo.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
charset$(PPUEXT) : $(INC)/charset.pp $(SYSTEMUNIT)$(PPUEXT)
|
||||
|
||||
#
|
||||
# Other system-dependent RTL Units
|
||||
#
|
||||
|
||||
exec$(PPUEXT) : exec.pp execf.inc execd.inc
|
||||
|
||||
timer$(PPUEXT) : timer.pp timerd.inc timerf.inc
|
||||
|
||||
utility$(PPUEXT) : utility.pp exec$(PPUEXT) utilf.inc utild1.inc utild2.inc
|
||||
|
||||
doslib$(PPUEXT) : doslib.pp exec$(PPUEXT) timer$(PPUEXT) doslibd.inc doslibf.inc
|
||||
|
||||
hardware$(PPUEXT): hardware.pas exec$(PPUEXT)
|
||||
|
||||
inputevent$(PPUEXT): inputevent.pas exec$(PPUEXT) timer$(PPUEXT) utility$(PPUEXT)
|
||||
|
||||
graphics$(PPUEXT): graphics.pas exec$(PPUEXT) utility$(PPUEXT) hardware$(PPUEXT)
|
||||
|
||||
layers$(PPUEXT) : layers.pas exec$(PPUEXT) graphics$(PPUEXT) utility$(PPUEXT)
|
||||
|
||||
intuition$(PPUEXT): intuition.pas exec$(PPUEXT) graphics$(PPUEXT) utility$(PPUEXT) \
|
||||
inputevent$(PPUEXT) timer$(PPUEXT) layers$(PPUEXT)
|
||||
|
||||
aboxlib$(PPUEXT): aboxlib.pas
|
||||
|
||||
clipboard$(PPUEXT): clipboard.pas exec$(PPUEXT)
|
||||
|
||||
datatype$(PPUEXT): datatypes.pas exec$(PPUEXT) doslib$(PPUEXT) intuition$(PPUEXT) \
|
||||
utility$(PPUEXT) graphics$(PPUEXT)
|
||||
|
||||
asl$(PPUEXT): asl.pas exec$(PPUEXT) graphics$(PPUEXT) utility$(PPUEXT)
|
||||
|
||||
ahi$(PPUEXT): ahi.pas exec$(PPUEXT) utility$(PPUEXT)
|
||||
|
||||
mui$(PPUEXT): mui.pas exec$(PPUEXT) utility$(PPUEXT) intuition$(PPUEXT) graphics$(PPUEXT)
|
||||
|
||||
tinygl$(PPUEXT): tinygl.pp exec$(PPUEXT)
|
||||
|
||||
get9$(PPUEXT): get9.pas exec$(PPUEXT)
|
||||
|
||||
muihelper$(PPUEXT): muihelper.pas intuition$(PPUEXT) mui$(PPUEXT) doslib$(PPUEXT) utility$(PPUEXT)
|
||||
|
||||
ctypes$(PPUEXT) : $(INC)/ctypes.pp $(SYSTEMUNIT)$(PPUEXT)
|
45
rtl/nds/classes.pp
Normal file
45
rtl/nds/classes.pp
Normal file
@ -0,0 +1,45 @@
|
||||
{
|
||||
This file is part of the Free Component Library (FCL)
|
||||
Copyright (c) 1999-2002 by the Free Pascal development team
|
||||
|
||||
Classes unit for Nintendo DS
|
||||
Copyright (c) 2006 by Francesco Lombardi
|
||||
|
||||
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.
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
{$mode objfpc}
|
||||
|
||||
unit Classes;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
sysutils,
|
||||
rtlconsts,
|
||||
types,
|
||||
typinfo;
|
||||
|
||||
{$i classesh.inc}
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
{ OS - independent class implementations are in /inc directory. }
|
||||
{$i classes.inc}
|
||||
|
||||
|
||||
initialization
|
||||
CommonInit;
|
||||
|
||||
finalization
|
||||
CommonCleanup;
|
||||
|
||||
end.
|
93
rtl/nds/cprt07.as
Normal file
93
rtl/nds/cprt07.as
Normal file
@ -0,0 +1,93 @@
|
||||
@---------------------------------------------------------------------------------
|
||||
.section ".init"
|
||||
.global _start
|
||||
@---------------------------------------------------------------------------------
|
||||
.align 4
|
||||
.arm
|
||||
@---------------------------------------------------------------------------------
|
||||
_start:
|
||||
@---------------------------------------------------------------------------------
|
||||
mov r0, #0x04000000 @ IME = 0;
|
||||
str r0, [r0, #0x208]
|
||||
|
||||
mov r0, #0x12 @ Switch to IRQ Mode
|
||||
msr cpsr, r0
|
||||
ldr sp, =__sp_irq @ Set IRQ stack
|
||||
|
||||
mov r0, #0x13 @ Switch to SVC Mode
|
||||
msr cpsr, r0
|
||||
ldr sp, =__sp_svc @ Set SVC stack
|
||||
|
||||
mov r0, #0x1F @ Switch to System Mode
|
||||
msr cpsr, r0
|
||||
ldr sp, =__sp_usr @ Set user stack
|
||||
|
||||
ldr r0, =__bss_start @ Clear BSS section to 0x00
|
||||
ldr r1, =__bss_end
|
||||
sub r1, r1, r0
|
||||
bl ClearMem
|
||||
|
||||
ldr r3, =__libc_init_array @ global constructors
|
||||
bl _call_via_r3
|
||||
|
||||
mov r0, #0 @ int argc
|
||||
mov r1, #0 @ char *argv[]
|
||||
ldr r3, =main
|
||||
bl _call_via_r3 @ jump to user code
|
||||
|
||||
@ If the user ever returns, return to flash cartridge
|
||||
mov r0, #0x08000000
|
||||
bx r0
|
||||
|
||||
@---------------------------------------------------------------------------------
|
||||
@ Clear memory to 0x00 if length != 0
|
||||
@ r0 = Start Address
|
||||
@ r1 = Length
|
||||
@---------------------------------------------------------------------------------
|
||||
ClearMem:
|
||||
@---------------------------------------------------------------------------------
|
||||
mov r2, #3 @ Round down to nearest word boundary
|
||||
add r1, r1, r2 @ Shouldn't be needed
|
||||
bics r1, r1, r2 @ Clear 2 LSB (and set Z)
|
||||
bxeq lr @ Quit if copy size is 0
|
||||
|
||||
mov r2, #0
|
||||
ClrLoop:
|
||||
stmia r0!, {r2}
|
||||
subs r1, r1, #4
|
||||
bne ClrLoop
|
||||
bx lr
|
||||
|
||||
@---------------------------------------------------------------------------------
|
||||
@ Copy memory if length != 0
|
||||
@ r1 = Source Address
|
||||
@ r2 = Dest Address
|
||||
@ r4 = Dest Address + Length
|
||||
@---------------------------------------------------------------------------------
|
||||
CopyMemCheck:
|
||||
@---------------------------------------------------------------------------------
|
||||
sub r3, r4, r2 @ Is there any data to copy?
|
||||
@---------------------------------------------------------------------------------
|
||||
@ Copy memory
|
||||
@ r1 = Source Address
|
||||
@ r2 = Dest Address
|
||||
@ r3 = Length
|
||||
@---------------------------------------------------------------------------------
|
||||
CopyMem:
|
||||
@---------------------------------------------------------------------------------
|
||||
mov r0, #3 @ These commands are used in cases where
|
||||
add r3, r3, r0 @ the length is not a multiple of 4,
|
||||
bics r3, r3, r0 @ even though it should be.
|
||||
bxeq lr @ Length is zero, so exit
|
||||
CIDLoop:
|
||||
ldmia r1!, {r0}
|
||||
stmia r2!, {r0}
|
||||
subs r3, r3, #4
|
||||
bne CIDLoop
|
||||
bx lr
|
||||
|
||||
@---------------------------------------------------------------------------------
|
||||
.align
|
||||
.pool
|
||||
.end
|
||||
@---------------------------------------------------------------------------------
|
1
rtl/nds/cprt09.as
Normal file
1
rtl/nds/cprt09.as
Normal file
File diff suppressed because one or more lines are too long
263
rtl/nds/dos.pp
Normal file
263
rtl/nds/dos.pp
Normal file
@ -0,0 +1,263 @@
|
||||
{
|
||||
This file is part of the Free Pascal run time library.
|
||||
Copyright (c) 2004 by Karoly Balogh for Genesi S.a.r.l.
|
||||
|
||||
Heavily based on the Commodore Amiga/m68k RTL by Nils Sjoholm and
|
||||
Carl Eric Codere
|
||||
|
||||
MorphOS port was done on a free Pegasos II/G4 machine
|
||||
provided by Genesi S.a.r.l. <www.genesi.lu>
|
||||
|
||||
This unit is based on the MorphOS one and is adapted for Nintendo DS
|
||||
simply by stripping out all stuff inside funcs and procs.
|
||||
Copyright (c) 2006 by Francesco Lombardi
|
||||
|
||||
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.
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
unit Dos;
|
||||
|
||||
interface
|
||||
|
||||
{$MODE objfpc}
|
||||
|
||||
type
|
||||
SearchRec = Packed Record
|
||||
AnchorPtr : Pointer; { Pointer to the Anchorpath structure }
|
||||
Fill: Array[1..15] of Byte; {future use}
|
||||
{End of replacement for fill}
|
||||
Attr : BYTE; {attribute of found file}
|
||||
Time : LongInt; {last modify date of found file}
|
||||
Size : LongInt; {file size of found file}
|
||||
Name : String[255]; {name of found file}
|
||||
End;
|
||||
|
||||
{$I dosh.inc}
|
||||
|
||||
implementation
|
||||
|
||||
{$I dos.inc}
|
||||
|
||||
{******************************************************************************
|
||||
--- Internal routines ---
|
||||
******************************************************************************}
|
||||
|
||||
function dosLock(const name: String; accessmode: Longint) : LongInt;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
function IsLeapYear(Source : Word) : Boolean;
|
||||
begin
|
||||
result := false;
|
||||
end;
|
||||
|
||||
function dosSetProtection(const name: string; mask:longint): Boolean;
|
||||
begin
|
||||
result := false;
|
||||
end;
|
||||
|
||||
function dosSetFileDate(name: string): Boolean;
|
||||
begin
|
||||
result := false;
|
||||
end;
|
||||
|
||||
|
||||
{******************************************************************************
|
||||
--- Info / Date / Time ---
|
||||
******************************************************************************}
|
||||
|
||||
function DosVersion: Word;
|
||||
begin
|
||||
result := 0;
|
||||
end;
|
||||
|
||||
procedure NewList ();
|
||||
begin
|
||||
end;
|
||||
|
||||
function CreateExtIO (size: Longint): integer;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
procedure DeleteExtIO ();
|
||||
begin
|
||||
end;
|
||||
|
||||
function Createport(name : PChar; pri : longint): integer;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
procedure DeletePort ();
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
function Create_Timer(theUnit : longint) : integer;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
Procedure Delete_Timer();
|
||||
begin
|
||||
end;
|
||||
|
||||
function set_new_time(secs, micro : longint): longint;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
function get_sys_time(): longint;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
procedure GetDate(Var Year, Month, MDay, WDay: Word);
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure SetDate(Year, Month, Day: Word);
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure GetTime(Var Hour, Minute, Second, Sec100: Word);
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
Procedure SetTime(Hour, Minute, Second, Sec100: Word);
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
|
||||
{******************************************************************************
|
||||
--- Exec ---
|
||||
******************************************************************************}
|
||||
procedure Exec(const Path: PathStr; const ComLine: ComStr);
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
{******************************************************************************
|
||||
--- Disk ---
|
||||
******************************************************************************}
|
||||
|
||||
Function DiskFree(Drive: Byte): int64;
|
||||
Begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
Function DiskSize(Drive: Byte): int64;
|
||||
Begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
|
||||
procedure FindFirst(const Path: PathStr; Attr: Word; Var f: SearchRec);
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
procedure FindNext(Var f: SearchRec);
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure FindClose(Var f: SearchRec);
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
{******************************************************************************
|
||||
--- File ---
|
||||
******************************************************************************}
|
||||
|
||||
|
||||
function FSearch(path: PathStr; dirlist: String) : PathStr;
|
||||
begin
|
||||
result := '';
|
||||
end;
|
||||
|
||||
|
||||
Procedure getftime (var f; var time : longint);
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
Procedure setftime(var f; time : longint);
|
||||
Begin
|
||||
End;
|
||||
|
||||
procedure getfattr(var f; var attr : word);
|
||||
begin
|
||||
End;
|
||||
|
||||
|
||||
procedure setfattr(var f; attr : word);
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
{******************************************************************************
|
||||
--- Environment ---
|
||||
******************************************************************************}
|
||||
|
||||
function getpathstring: string;
|
||||
begin
|
||||
result := '';
|
||||
end;
|
||||
|
||||
|
||||
function EnvCount: Longint;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
|
||||
function EnvStr(Index: LongInt): String;
|
||||
begin
|
||||
result := '';
|
||||
end;
|
||||
|
||||
|
||||
|
||||
function GetEnv(envvar : String): String;
|
||||
begin
|
||||
result := '';
|
||||
end;
|
||||
|
||||
|
||||
procedure AddDevice(str : String);
|
||||
begin
|
||||
end;
|
||||
|
||||
function MakeDeviceName(str : pchar): string;
|
||||
begin
|
||||
result := '';
|
||||
end;
|
||||
|
||||
function IsInDeviceList(str : string): boolean;
|
||||
begin
|
||||
result := false;
|
||||
end;
|
||||
|
||||
procedure ReadInDevices;
|
||||
begin
|
||||
end;
|
||||
|
||||
begin
|
||||
// DosError:=0;
|
||||
// numberofdevices := 0;
|
||||
// StrOfPaths := '';
|
||||
// ReadInDevices;
|
||||
end.
|
19
rtl/nds/ndsbios.inc
Normal file
19
rtl/nds/ndsbios.inc
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
This file is part of the Free Component Library (FCL)
|
||||
Copyright (c) 1999-2002 by the Free Pascal development team
|
||||
|
||||
BIOS functions unit for Nintendo DS
|
||||
Copyright (c) 2006 by Francesco Lombardi
|
||||
|
||||
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.
|
||||
|
||||
*****************************************************************************}
|
||||
|
||||
{*****************************************************************************
|
||||
NDS Bios Functions
|
||||
*****************************************************************************}
|
21
rtl/nds/ndsbiosh.inc
Normal file
21
rtl/nds/ndsbiosh.inc
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
This file is part of the Free Component Library (FCL)
|
||||
Copyright (c) 1999-2002 by the Free Pascal development team
|
||||
|
||||
BIOS functions unit for Nintendo DS
|
||||
Copyright (c) 2006 by Francesco Lombardi
|
||||
|
||||
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.
|
||||
|
||||
*****************************************************************************}
|
||||
|
||||
{*****************************************************************************
|
||||
NDS Bios Functions
|
||||
*****************************************************************************}
|
||||
{ FPC funcs replaced by NDS BIOS ones }
|
||||
|
91
rtl/nds/prt07.as
Normal file
91
rtl/nds/prt07.as
Normal file
@ -0,0 +1,91 @@
|
||||
@---------------------------------------------------------------------------------
|
||||
.section ".init"
|
||||
.global _start
|
||||
@---------------------------------------------------------------------------------
|
||||
.align 4
|
||||
.arm
|
||||
@---------------------------------------------------------------------------------
|
||||
_start:
|
||||
@---------------------------------------------------------------------------------
|
||||
mov r0, #0x04000000 @ IME = 0;
|
||||
str r0, [r0, #0x208]
|
||||
|
||||
mov r0, #0x12 @ Switch to IRQ Mode
|
||||
msr cpsr, r0
|
||||
ldr sp, =__sp_irq @ Set IRQ stack
|
||||
|
||||
mov r0, #0x13 @ Switch to SVC Mode
|
||||
msr cpsr, r0
|
||||
ldr sp, =__sp_svc @ Set SVC stack
|
||||
|
||||
mov r0, #0x1F @ Switch to System Mode
|
||||
msr cpsr, r0
|
||||
ldr sp, =__sp_usr @ Set user stack
|
||||
|
||||
ldr r0, =__bss_start @ Clear BSS section to 0x00
|
||||
ldr r1, =__bss_end
|
||||
sub r1, r1, r0
|
||||
bl ClearMem
|
||||
|
||||
mov r0, #0 @ int argc
|
||||
mov r1, #0 @ char *argv[]
|
||||
ldr r3, =main
|
||||
bx r3
|
||||
nop
|
||||
|
||||
@ If the user ever returns, return to flash cartridge
|
||||
mov r0, #0x08000000
|
||||
bx r0
|
||||
|
||||
@---------------------------------------------------------------------------------
|
||||
@ Clear memory to 0x00 if length != 0
|
||||
@ r0 = Start Address
|
||||
@ r1 = Length
|
||||
@---------------------------------------------------------------------------------
|
||||
ClearMem:
|
||||
@---------------------------------------------------------------------------------
|
||||
mov r2, #3 @ Round down to nearest word boundary
|
||||
add r1, r1, r2 @ Shouldn't be needed
|
||||
bics r1, r1, r2 @ Clear 2 LSB (and set Z)
|
||||
bxeq lr @ Quit if copy size is 0
|
||||
|
||||
mov r2, #0
|
||||
ClrLoop:
|
||||
stmia r0!, {r2}
|
||||
subs r1, r1, #4
|
||||
bne ClrLoop
|
||||
bx lr
|
||||
|
||||
@---------------------------------------------------------------------------------
|
||||
@ Copy memory if length != 0
|
||||
@ r1 = Source Address
|
||||
@ r2 = Dest Address
|
||||
@ r4 = Dest Address + Length
|
||||
@---------------------------------------------------------------------------------
|
||||
CopyMemCheck:
|
||||
@---------------------------------------------------------------------------------
|
||||
sub r3, r4, r2 @ Is there any data to copy?
|
||||
@---------------------------------------------------------------------------------
|
||||
@ Copy memory
|
||||
@ r1 = Source Address
|
||||
@ r2 = Dest Address
|
||||
@ r3 = Length
|
||||
@---------------------------------------------------------------------------------
|
||||
CopyMem:
|
||||
@---------------------------------------------------------------------------------
|
||||
mov r0, #3 @ These commands are used in cases where
|
||||
add r3, r3, r0 @ the length is not a multiple of 4,
|
||||
bics r3, r3, r0 @ even though it should be.
|
||||
bxeq lr @ Length is zero, so exit
|
||||
CIDLoop:
|
||||
ldmia r1!, {r0}
|
||||
stmia r2!, {r0}
|
||||
subs r3, r3, #4
|
||||
bne CIDLoop
|
||||
bx lr
|
||||
|
||||
@---------------------------------------------------------------------------------
|
||||
.align
|
||||
.pool
|
||||
.end
|
||||
@---------------------------------------------------------------------------------
|
237
rtl/nds/prt09.as
Normal file
237
rtl/nds/prt09.as
Normal file
@ -0,0 +1,237 @@
|
||||
@---------------------------------------------------------------------------------
|
||||
.section ".init"
|
||||
.global _start
|
||||
@---------------------------------------------------------------------------------
|
||||
.align 4
|
||||
.arm
|
||||
@---------------------------------------------------------------------------------
|
||||
_start:
|
||||
@---------------------------------------------------------------------------------
|
||||
mov r0, #0x04000000 @ IME = 0;
|
||||
str r0, [r0, #0x208]
|
||||
|
||||
@---------------------------------------------------------------------------------
|
||||
@ turn the power on for M3
|
||||
@---------------------------------------------------------------------------------
|
||||
ldr r1, =0x8203
|
||||
add r0,r0,#0x304
|
||||
strh r1, [r0]
|
||||
|
||||
ldr r1, =0x00002078 @ disable TCM and protection unit
|
||||
mcr p15, 0, r1, c1, c0
|
||||
|
||||
@---------------------------------------------------------------------------------
|
||||
@ Protection Unit Setup added by Sasq
|
||||
@---------------------------------------------------------------------------------
|
||||
@ Disable cache
|
||||
mov r0, #0
|
||||
mcr p15, 0, r0, c7, c5, 0 @ Instruction cache
|
||||
mcr p15, 0, r0, c7, c6, 0 @ Data cache
|
||||
|
||||
@ Wait for write buffer to empty
|
||||
mcr p15, 0, r0, c7, c10, 4
|
||||
|
||||
ldr r0, =__dtcm_start
|
||||
orr r0,r0,#0x0a
|
||||
mcr p15, 0, r0, c9, c1,0 @ DTCM base = __dtcm_start, size = 16 KB
|
||||
|
||||
mov r0,#0x20
|
||||
mcr p15, 0, r0, c9, c1,1 @ ITCM base = 0 , size = 32 MB
|
||||
|
||||
@---------------------------------------------------------------------------------
|
||||
@ Setup memory regions similar to Release Version
|
||||
@---------------------------------------------------------------------------------
|
||||
|
||||
@-------------------------------------------------------------------------
|
||||
@ Region 0 - IO registers
|
||||
@-------------------------------------------------------------------------
|
||||
ldr r0,=( (0b11001 << 1) | 0x04000000 | 1)
|
||||
mcr p15, 0, r0, c6, c0, 0
|
||||
|
||||
@-------------------------------------------------------------------------
|
||||
@ Region 1 - Main Memory
|
||||
@-------------------------------------------------------------------------
|
||||
ldr r0,=( (0b10101 << 1) | 0x02000000 | 1)
|
||||
mcr p15, 0, r0, c6, c1, 0
|
||||
|
||||
@-------------------------------------------------------------------------
|
||||
@ Region 2 - iwram
|
||||
@-------------------------------------------------------------------------
|
||||
ldr r0,=( (0b01110 << 1) | 0x037F8000 | 1)
|
||||
mcr p15, 0, r0, c6, c2, 0
|
||||
|
||||
@-------------------------------------------------------------------------
|
||||
@ Region 3 - DS Accessory (GBA Cart)
|
||||
@-------------------------------------------------------------------------
|
||||
ldr r0,=( (0b11010 << 1) | 0x08000000 | 1)
|
||||
mcr p15, 0, r0, c6, c3, 0
|
||||
|
||||
@-------------------------------------------------------------------------
|
||||
@ Region 4 - DTCM
|
||||
@-------------------------------------------------------------------------
|
||||
ldr r0,=__dtcm_start
|
||||
orr r0,r0,#((0b01101 << 1) | 1)
|
||||
mcr p15, 0, r0, c6, c4, 0
|
||||
|
||||
@-------------------------------------------------------------------------
|
||||
@ Region 5 - ITCM
|
||||
@-------------------------------------------------------------------------
|
||||
ldr r0,=__itcm_start
|
||||
orr r0,r0,#((0b01110 << 1) | 1)
|
||||
mcr p15, 0, r0, c6, c5, 0
|
||||
|
||||
@-------------------------------------------------------------------------
|
||||
@ Region 6 - System ROM
|
||||
@-------------------------------------------------------------------------
|
||||
ldr r0,=( (0b01110 << 1) | 0xFFFF0000 | 1)
|
||||
mcr p15, 0, r0, c6, c6, 0
|
||||
|
||||
@-------------------------------------------------------------------------
|
||||
@ Region 7 - non cacheable main ram
|
||||
@-------------------------------------------------------------------------
|
||||
ldr r0,=( (0b10101 << 1) | 0x02400000 | 1)
|
||||
mcr p15, 0, r0, c6, c7, 0
|
||||
|
||||
@-------------------------------------------------------------------------
|
||||
@ Write buffer enable
|
||||
@-------------------------------------------------------------------------
|
||||
ldr r0,=0b00000110
|
||||
mcr p15, 0, r0, c3, c0, 0
|
||||
|
||||
@-------------------------------------------------------------------------
|
||||
@ DCache & ICache enable
|
||||
@-------------------------------------------------------------------------
|
||||
ldr r0,=0b01000110
|
||||
ldr r0,=0x42
|
||||
mcr p15, 0, r0, c2, c0, 0
|
||||
mcr p15, 0, r0, c2, c0, 1
|
||||
|
||||
@-------------------------------------------------------------------------
|
||||
@ IAccess
|
||||
@-------------------------------------------------------------------------
|
||||
ldr r0,=0x36636333
|
||||
mcr p15, 0, r0, c5, c0, 3
|
||||
|
||||
@-------------------------------------------------------------------------
|
||||
@ DAccess
|
||||
@-------------------------------------------------------------------------
|
||||
ldr r0,=0x36333333
|
||||
mcr p15, 0, r0, c5, c0, 2
|
||||
|
||||
@-------------------------------------------------------------------------
|
||||
@ Enable ICache, DCache, ITCM & DTCM
|
||||
@-------------------------------------------------------------------------
|
||||
mrc p15, 0, r0, c1, c0, 0
|
||||
ldr r1,= (1<<18) | (1<<16) | (1<<12) | (1<<2) | (1<<0)
|
||||
orr r0,r0,r1
|
||||
mcr p15, 0, r0, c1, c0, 0
|
||||
|
||||
mov r0, #0x12 @ Switch to IRQ Mode
|
||||
msr cpsr, r0
|
||||
ldr sp, =__sp_irq @ Set IRQ stack
|
||||
|
||||
mov r0, #0x13 @ Switch to SVC Mode
|
||||
msr cpsr, r0
|
||||
ldr sp, =__sp_svc @ Set SVC stack
|
||||
|
||||
mov r0, #0x1F @ Switch to System Mode
|
||||
msr cpsr, r0
|
||||
ldr sp, =__sp_usr @ Set user stack
|
||||
|
||||
ldr r1, =__itcm_lma @ Copy instruction tightly coupled memory (itcm section) from LMA to VMA (ROM to RAM)
|
||||
ldr r2, =__itcm_start
|
||||
ldr r4, =__itcm_end
|
||||
bl CopyMemCheck
|
||||
|
||||
ldr r1, =__dtcm_lma @ Copy data tightly coupled memory (dtcm section) from LMA to VMA (ROM to RAM)
|
||||
ldr r2, =__dtcm_start
|
||||
ldr r4, =__dtcm_end
|
||||
bl CopyMemCheck
|
||||
|
||||
ldr r0, =__bss_start @ Clear BSS section
|
||||
ldr r1, =__bss_end
|
||||
sub r1, r1, r0
|
||||
bl ClearMem
|
||||
|
||||
ldr r0, =__sbss_start @ Clear SBSS section
|
||||
ldr r1, =__sbss_end
|
||||
sub r1, r1, r0
|
||||
bl ClearMem
|
||||
|
||||
ldr r1, =fake_heap_end @ set heap end
|
||||
ldr r0, =__eheap_end
|
||||
str r0, [r1]
|
||||
|
||||
|
||||
|
||||
|
||||
mov r0, #0 @ int argc
|
||||
mov r1, #0 @ char *argv[]
|
||||
ldr r3, =main
|
||||
bx r3
|
||||
nop
|
||||
|
||||
@ If the user ever returns, go to an infinte loop
|
||||
ldr r0, =ILoop
|
||||
ldr r0, [r0]
|
||||
ldr r1, =0x027FFE78
|
||||
str r0, [r1]
|
||||
bx r1
|
||||
ILoop:
|
||||
b ILoop
|
||||
|
||||
|
||||
@---------------------------------------------------------------------------------
|
||||
@---------------------------------------------------------------------------------
|
||||
@ Clear memory to 0x00 if length != 0
|
||||
@ r0 = Start Address
|
||||
@ r1 = Length
|
||||
@---------------------------------------------------------------------------------
|
||||
ClearMem:
|
||||
@---------------------------------------------------------------------------------
|
||||
mov r2, #3 @ Round down to nearest word boundary
|
||||
add r1, r1, r2 @ Shouldn't be needed
|
||||
bics r1, r1, r2 @ Clear 2 LSB (and set Z)
|
||||
bxeq lr @ Quit if copy size is 0
|
||||
|
||||
mov r2, #0
|
||||
ClrLoop:
|
||||
stmia r0!, {r2}
|
||||
subs r1, r1, #4
|
||||
bne ClrLoop
|
||||
|
||||
bx lr
|
||||
|
||||
@---------------------------------------------------------------------------------
|
||||
@ Copy memory if length != 0
|
||||
@ r1 = Source Address
|
||||
@ r2 = Dest Address
|
||||
@ r4 = Dest Address + Length
|
||||
@---------------------------------------------------------------------------------
|
||||
CopyMemCheck:
|
||||
@---------------------------------------------------------------------------------
|
||||
sub r3, r4, r2 @ Is there any data to copy?
|
||||
@---------------------------------------------------------------------------------
|
||||
@ Copy memory
|
||||
@ r1 = Source Address
|
||||
@ r2 = Dest Address
|
||||
@ r3 = Length
|
||||
@---------------------------------------------------------------------------------
|
||||
CopyMem:
|
||||
@---------------------------------------------------------------------------------
|
||||
mov r0, #3 @ These commands are used in cases where
|
||||
add r3, r3, r0 @ the length is not a multiple of 4,
|
||||
bics r3, r3, r0 @ even though it should be.
|
||||
bxeq lr @ Length is zero, so exit
|
||||
CIDLoop:
|
||||
ldmia r1!, {r0}
|
||||
stmia r2!, {r0}
|
||||
subs r3, r3, #4
|
||||
bne CIDLoop
|
||||
|
||||
bx lr
|
||||
@---------------------------------------------------------------------------------
|
||||
.align
|
||||
.pool
|
||||
.end
|
||||
@---------------------------------------------------------------------------------
|
39
rtl/nds/sysdir.inc
Normal file
39
rtl/nds/sysdir.inc
Normal file
@ -0,0 +1,39 @@
|
||||
{
|
||||
This file is part of the Free Pascal run time library.
|
||||
Copyright (c) 2006 by Free Pascal development team
|
||||
|
||||
Low level directory functions
|
||||
Nintendo DS does not have any drive, so no directory handling is needed.
|
||||
Copyright (c) 2006 by Francesco Lombardi
|
||||
|
||||
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.
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
|
||||
{*****************************************************************************
|
||||
Directory Handling
|
||||
*****************************************************************************}
|
||||
procedure mkdir(const s : string);[IOCheck];
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure rmdir(const s : string);[IOCheck];
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure chdir(const s : string);[IOCheck];
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure GetDir (DriveNr: byte; var Dir: ShortString);
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
|
80
rtl/nds/sysfile.inc
Normal file
80
rtl/nds/sysfile.inc
Normal file
@ -0,0 +1,80 @@
|
||||
{
|
||||
This file is part of the Free Pascal run time library.
|
||||
Copyright (c) 2005 by Free Pascal development team
|
||||
|
||||
Low level file functions
|
||||
Nintendo DS does not have any drive, so no file handling is needed.
|
||||
Copyright (c) 2006 by Francesco Lombardi
|
||||
|
||||
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.
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
|
||||
{****************************************************************************
|
||||
Low level File Routines
|
||||
All these functions can set InOutRes on errors
|
||||
****************************************************************************}
|
||||
|
||||
{ close a file from the handle value }
|
||||
procedure do_close(handle : longint);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
procedure do_erase(p : pchar);
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure do_rename(p1,p2 : pchar);
|
||||
begin
|
||||
end;
|
||||
|
||||
function do_write(h: longint; addr: pointer; len: longint) : longint;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
function do_read(h: longint; addr: pointer; len: longint) : longint;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
function do_filepos(handle: longint) : longint;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
procedure do_seek(handle, pos: longint);
|
||||
begin
|
||||
end;
|
||||
|
||||
function do_seekend(handle: longint):longint;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
function do_filesize(handle : longint) : longint;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
{ truncate at a given position }
|
||||
procedure do_truncate(handle, pos: longint);
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure do_open(var f;p:pchar;flags:longint);
|
||||
begin
|
||||
end;
|
||||
|
||||
function do_isdevice(handle: longint): boolean;
|
||||
begin
|
||||
result := false;
|
||||
end;
|
||||
|
34
rtl/nds/sysheap.inc
Normal file
34
rtl/nds/sysheap.inc
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
This file is part of the Free Pascal run time library.
|
||||
Copyright (c) 2005 by Free Pascal development team
|
||||
|
||||
Low level memory functions
|
||||
|
||||
Heap functions unit for Nintendo DS
|
||||
Copyright (c) 2006 by Francesco Lombardi
|
||||
|
||||
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.
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
{*****************************************************************************
|
||||
OS Memory allocation / deallocation
|
||||
****************************************************************************}
|
||||
|
||||
|
||||
function SysOSAlloc(size: ptrint): pointer;
|
||||
begin
|
||||
result := nil;//pointer($02000000);
|
||||
end;
|
||||
|
||||
{ $define HAS_SYSOSFREE}
|
||||
|
||||
procedure SysOSFree(p: pointer; size: ptrint);
|
||||
begin
|
||||
|
||||
end;
|
16
rtl/nds/sysos.inc
Normal file
16
rtl/nds/sysos.inc
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
This file is part of the Free Pascal run time library.
|
||||
Copyright (c) 2001 by Free Pascal development team
|
||||
|
||||
This file implements all the base types and limits required
|
||||
for a minimal POSIX compliant subset required to port the compiler
|
||||
to a new OS.
|
||||
|
||||
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.
|
||||
|
||||
**********************************************************************}
|
29
rtl/nds/sysosh.inc
Normal file
29
rtl/nds/sysosh.inc
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
This file is part of the Free Pascal run time library.
|
||||
Copyright (c) 2001 by Free Pascal development team
|
||||
|
||||
This file implements all the base types and limits required
|
||||
for a minimal POSIX compliant subset required to port the compiler
|
||||
to a new OS.
|
||||
|
||||
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.
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
{Platform specific information}
|
||||
type
|
||||
THandle = Longint;
|
||||
TThreadID = THandle;
|
||||
|
||||
PRTLCriticalSection = ^TRTLCriticalSection;
|
||||
TRTLCriticalSection = record
|
||||
Locked: boolean
|
||||
end;
|
||||
|
||||
|
||||
|
172
rtl/nds/system.pp
Normal file
172
rtl/nds/system.pp
Normal file
@ -0,0 +1,172 @@
|
||||
{
|
||||
This file is part of the Free Pascal run time library.
|
||||
Copyright (c) 2006 by Francesco Lombardi.
|
||||
|
||||
System unit for Nintendo DS
|
||||
|
||||
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.
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
unit System;
|
||||
|
||||
interface
|
||||
|
||||
{$define FPC_IS_SYSTEM}
|
||||
|
||||
{$i ndsbiosh.inc}
|
||||
|
||||
{$I systemh.inc}
|
||||
|
||||
{$define fpc_softfpu_interface}
|
||||
{$i softfpu.pp}
|
||||
{$undef fpc_softfpu_interface}
|
||||
|
||||
|
||||
const
|
||||
LineEnding = #10;
|
||||
LFNSupport = true;
|
||||
CtrlZMarksEOF: boolean = false;
|
||||
DirectorySeparator = '/';
|
||||
DriveSeparator = ':';
|
||||
PathSeparator = ';';
|
||||
FileNameCaseSensitive = false;
|
||||
maxExitCode = 255;
|
||||
MaxPathLen = 255;
|
||||
|
||||
|
||||
sLineBreak : string[1] = LineEnding;
|
||||
DefaultTextLineBreakStyle : TTextLineBreakStyle = tlbsCRLF;
|
||||
|
||||
const
|
||||
UnusedHandle = $ffff;
|
||||
StdInputHandle = 0;
|
||||
StdOutputHandle = 1;
|
||||
StdErrorHandle = $ffff;
|
||||
|
||||
|
||||
var
|
||||
argc: LongInt = 0;
|
||||
argv: PPChar;
|
||||
envp: PPChar;
|
||||
errno: integer;
|
||||
fake_heap_start: pchar; cvar;
|
||||
fake_heap_end: pchar; cvar;
|
||||
|
||||
implementation
|
||||
|
||||
{$define fpc_softfpu_implementation}
|
||||
{$i softfpu.pp}
|
||||
{$undef fpc_softfpu_implementation}
|
||||
|
||||
{ we get these functions and types from the softfpu code }
|
||||
{$define FPC_SYSTEM_HAS_float64}
|
||||
{$define FPC_SYSTEM_HAS_float32}
|
||||
{$define FPC_SYSTEM_HAS_flag}
|
||||
{$define FPC_SYSTEM_HAS_extractFloat64Frac0}
|
||||
{$define FPC_SYSTEM_HAS_extractFloat64Frac1}
|
||||
{$define FPC_SYSTEM_HAS_extractFloat64Exp}
|
||||
{$define FPC_SYSTEM_HAS_extractFloat64Frac}
|
||||
{$define FPC_SYSTEM_HAS_extractFloat64Sign}
|
||||
{$define FPC_SYSTEM_HAS_ExtractFloat32Frac}
|
||||
{$define FPC_SYSTEM_HAS_extractFloat32Exp}
|
||||
{$define FPC_SYSTEM_HAS_extractFloat32Sign}
|
||||
|
||||
{$I system.inc}
|
||||
|
||||
{$i ndsbios.inc}
|
||||
|
||||
|
||||
function GetProcessID: SizeUInt;
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
|
||||
{*****************************************************************************
|
||||
Misc. System Dependent Functions
|
||||
*****************************************************************************}
|
||||
procedure System_exit;
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
|
||||
{*****************************************************************************
|
||||
ParamStr/Randomize
|
||||
*****************************************************************************}
|
||||
|
||||
{ number of args }
|
||||
function paramcount : longint;
|
||||
begin
|
||||
paramcount:=0;
|
||||
end;
|
||||
|
||||
{ argument number l }
|
||||
function paramstr(l : longint) : string;
|
||||
begin
|
||||
paramstr:='';
|
||||
end;
|
||||
|
||||
{ set randseed to a new pseudo random value }
|
||||
procedure randomize;
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure SysInitStdIO;
|
||||
begin
|
||||
OpenStdIO(Input,fmInput,StdInputHandle);
|
||||
OpenStdIO(Output,fmOutput,StdOutputHandle);
|
||||
OpenStdIO(StdOut,fmOutput,StdOutputHandle);
|
||||
end;
|
||||
|
||||
|
||||
function CheckInitialStkLen(stklen : SizeUInt) : SizeUInt;
|
||||
begin
|
||||
result := stklen;
|
||||
end;
|
||||
|
||||
|
||||
procedure InitHeap;
|
||||
begin
|
||||
{
|
||||
FillChar(freelists_fixed,sizeof(tfreelists),0);
|
||||
FillChar(freelists_free_chunk,sizeof(freelists_free_chunk),0);
|
||||
|
||||
freelist_var:=nil;
|
||||
freeoslistcount:=1;
|
||||
freeoslist:=pointer($2040000);
|
||||
fillchar(freeoslist^,sizeof(freeoslist^),0);
|
||||
freeoslist^.size:=$40000;
|
||||
fillchar(internal_status,sizeof(internal_status),0);
|
||||
}
|
||||
end;
|
||||
|
||||
|
||||
begin
|
||||
StackLength := CheckInitialStkLen(InitialStkLen);
|
||||
///StackBottom := Sptr - StackLength;
|
||||
StackBottom := StackTop - StackLength;
|
||||
{ OS specific startup }
|
||||
fake_heap_start := pchar(0);
|
||||
fake_heap_end := pchar(0);
|
||||
{ Set up signals handlers }
|
||||
|
||||
{ Setup heap }
|
||||
InitHeap;
|
||||
//SysInitExceptions;
|
||||
{ Setup stdin, stdout and stderr }
|
||||
//SysInitStdIO;
|
||||
{ Reset IO Error }
|
||||
InOutRes := 0;
|
||||
{ Arguments }
|
||||
|
||||
//InitSystemThreads;
|
||||
//initvariantmanager;
|
||||
//initwidestringmanager;
|
||||
end.
|
25
rtl/nds/systhrd.inc
Normal file
25
rtl/nds/systhrd.inc
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
This file is part of the Free Pascal run time library.
|
||||
Copyright (c) 2002 by Peter Vreman,
|
||||
member of the Free Pascal development team.
|
||||
|
||||
Linux (pthreads) threading support implementation
|
||||
|
||||
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.
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
Procedure InitSystemThreads;
|
||||
begin
|
||||
{ This should be changed to a real value during
|
||||
thread driver initialization if appropriate. }
|
||||
ThreadID := 1;
|
||||
SetNoThreadManager;
|
||||
end;
|
||||
|
||||
|
284
rtl/nds/sysutils.pp
Normal file
284
rtl/nds/sysutils.pp
Normal file
@ -0,0 +1,284 @@
|
||||
{
|
||||
|
||||
This file is part of the Free Pascal run time library.
|
||||
Copyright (c) 2004 by Karoly Balogh
|
||||
|
||||
Sysutils unit for Nintendo DS.
|
||||
This unit is based on the MorphOS one and is adapted for Nintendo DS
|
||||
simply by stripping out all stuff inside funcs and procs.
|
||||
Copyright (c) 2006 by Francesco Lombardi
|
||||
|
||||
Based on Amiga version by Carl Eric Codere, and other
|
||||
parts of the 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.
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
unit sysutils;
|
||||
|
||||
interface
|
||||
|
||||
{$MODE objfpc}
|
||||
{ force ansistrings }
|
||||
{$H+}
|
||||
|
||||
{ Include platform independent interface part }
|
||||
{$i sysutilh.inc}
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
dos, sysconst;
|
||||
|
||||
{ Include platform independent implementation part }
|
||||
{$i sysutils.inc}
|
||||
|
||||
|
||||
{****************************************************************************
|
||||
File Functions
|
||||
****************************************************************************}
|
||||
function FileOpen(const FileName: string; Mode: Integer): LongInt;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
|
||||
function FileGetDate(Handle: LongInt) : LongInt;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
|
||||
function FileSetDate(Handle, Age: LongInt) : LongInt;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
|
||||
function FileCreate(const FileName: string) : LongInt;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
|
||||
function FileCreate(const FileName: string; Mode: integer): LongInt;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
|
||||
function FileRead(Handle: LongInt; var Buffer; Count: LongInt): LongInt;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
|
||||
function FileWrite(Handle: LongInt; const Buffer; Count: LongInt): LongInt;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
|
||||
function FileSeek(Handle, FOffset, Origin: LongInt) : LongInt;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
function FileSeek(Handle: LongInt; FOffset: Int64; Origin: Longint): Int64;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
|
||||
procedure FileClose(Handle: LongInt);
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
function FileTruncate(Handle, Size: LongInt): Boolean;
|
||||
begin
|
||||
result := false;
|
||||
end;
|
||||
|
||||
|
||||
function DeleteFile(const FileName: string) : Boolean;
|
||||
begin
|
||||
result := false;
|
||||
end;
|
||||
|
||||
|
||||
function RenameFile(const OldName, NewName: string): Boolean;
|
||||
begin
|
||||
result := false;
|
||||
end;
|
||||
|
||||
|
||||
(****** end of non portable routines ******)
|
||||
|
||||
|
||||
Function FileAge (Const FileName : String): Longint;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
|
||||
Function FileExists (Const FileName : String) : Boolean;
|
||||
Begin
|
||||
result := false;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
Function FindFirst (Const Path : String; Attr : Longint; Out Rslt : TSearchRec) : Longint;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
|
||||
Function FindNext (Var Rslt : TSearchRec) : Longint;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
Procedure FindClose (Var F : TSearchrec);
|
||||
begin
|
||||
end;
|
||||
|
||||
Function FileGetAttr (Const FileName : String) : Longint;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
|
||||
Function FileSetAttr (Const Filename : String; Attr: longint) : Longint;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
{****************************************************************************
|
||||
Disk Functions
|
||||
****************************************************************************}
|
||||
|
||||
Procedure AddDisk(const path:string);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
|
||||
|
||||
Function DiskFree(Drive: Byte): int64;
|
||||
Begin
|
||||
result := -1;
|
||||
End;
|
||||
|
||||
|
||||
Function DiskSize(Drive: Byte): int64;
|
||||
Begin
|
||||
result := -1;
|
||||
End;
|
||||
|
||||
|
||||
Function GetCurrentDir : String;
|
||||
begin
|
||||
result := '';
|
||||
end;
|
||||
|
||||
|
||||
Function SetCurrentDir (Const NewDir : String) : Boolean;
|
||||
begin
|
||||
result := false;
|
||||
end;
|
||||
|
||||
|
||||
Function CreateDir (Const NewDir : String) : Boolean;
|
||||
begin
|
||||
result := false;
|
||||
end;
|
||||
|
||||
|
||||
Function RemoveDir (Const Dir : String) : Boolean;
|
||||
begin
|
||||
result := false;
|
||||
end;
|
||||
|
||||
|
||||
function DirectoryExists(const Directory: string): Boolean;
|
||||
begin
|
||||
result := false;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
{****************************************************************************
|
||||
Misc Functions
|
||||
****************************************************************************}
|
||||
|
||||
procedure Beep;
|
||||
begin
|
||||
end;
|
||||
|
||||
|
||||
{****************************************************************************
|
||||
Locale Functions
|
||||
****************************************************************************}
|
||||
|
||||
Procedure GetLocalTime(var SystemTime: TSystemTime);
|
||||
begin
|
||||
end ;
|
||||
|
||||
|
||||
function SysErrorMessage(ErrorCode: Integer): String;
|
||||
begin
|
||||
{ Result:=StrError(ErrorCode);}
|
||||
result := '';
|
||||
end;
|
||||
|
||||
{****************************************************************************
|
||||
OS utility functions
|
||||
****************************************************************************}
|
||||
|
||||
Function GetEnvironmentVariable(Const EnvVar : String) : String;
|
||||
begin
|
||||
result := '';
|
||||
end;
|
||||
|
||||
Function GetEnvironmentVariableCount : Integer;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
Function GetEnvironmentString(Index : Integer) : String;
|
||||
begin
|
||||
result := '';
|
||||
end;
|
||||
|
||||
function ExecuteProcess (const Path: AnsiString; const ComLine: AnsiString): integer;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
function ExecuteProcess (const Path: AnsiString;
|
||||
const ComLine: array of AnsiString): integer;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
|
||||
{****************************************************************************
|
||||
Initialization code
|
||||
****************************************************************************}
|
||||
|
||||
Initialization
|
||||
InitExceptions;
|
||||
Finalization
|
||||
DoneExceptions;
|
||||
end.
|
112
rtl/nds/tthread.inc
Normal file
112
rtl/nds/tthread.inc
Normal file
@ -0,0 +1,112 @@
|
||||
{
|
||||
This file is part of the Free Component Library (FCL)
|
||||
Copyright (c) 1999-2002 by the Free Pascal development team
|
||||
|
||||
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.
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
{****************************************************************************}
|
||||
{* TThread *}
|
||||
{****************************************************************************}
|
||||
|
||||
{$WARNING This file is only a stub, and will not work!}
|
||||
|
||||
const
|
||||
ThreadCount: longint = 0;
|
||||
|
||||
(* Implementation of exported functions *)
|
||||
|
||||
procedure AddThread (T: TThread);
|
||||
begin
|
||||
Inc (ThreadCount);
|
||||
end;
|
||||
|
||||
|
||||
procedure RemoveThread (T: TThread);
|
||||
begin
|
||||
Dec (ThreadCount);
|
||||
end;
|
||||
|
||||
|
||||
procedure TThread.CallOnTerminate;
|
||||
begin
|
||||
FOnTerminate (Self);
|
||||
end;
|
||||
|
||||
|
||||
function TThread.GetPriority: TThreadPriority;
|
||||
begin
|
||||
result := tpNormal;
|
||||
end;
|
||||
|
||||
|
||||
procedure TThread.SetPriority(Value: TThreadPriority);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
|
||||
procedure TThread.SetSuspended(Value: Boolean);
|
||||
begin
|
||||
if Value <> FSuspended then
|
||||
begin
|
||||
if Value then Suspend else Resume;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TThread.DoTerminate;
|
||||
begin
|
||||
if Assigned (FOnTerminate) then Synchronize (@CallOnTerminate);
|
||||
end;
|
||||
|
||||
|
||||
constructor TThread.Create(CreateSuspended: Boolean;
|
||||
const StackSize: SizeUInt = DefaultStackSize);
|
||||
var
|
||||
Flags: cardinal;
|
||||
begin
|
||||
inherited Create;
|
||||
AddThread (Self);
|
||||
end;
|
||||
|
||||
|
||||
destructor TThread.Destroy;
|
||||
begin
|
||||
if not FFinished and not Suspended then
|
||||
begin
|
||||
Terminate;
|
||||
WaitFor;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TThread.Resume;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
|
||||
procedure TThread.Suspend;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
|
||||
procedure TThread.Terminate;
|
||||
begin
|
||||
FTerminated := true;
|
||||
end;
|
||||
|
||||
|
||||
function TThread.WaitFor: Integer;
|
||||
begin
|
||||
result := -1;
|
||||
end;
|
||||
|
||||
|
38
rtl/nds/varutils.pp
Normal file
38
rtl/nds/varutils.pp
Normal file
@ -0,0 +1,38 @@
|
||||
{
|
||||
This file is part of the Free Pascal run time library.
|
||||
Copyright (c) 1999-2000 by the Free Pascal development team
|
||||
|
||||
Interface and OS-dependent part of variant support
|
||||
|
||||
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.
|
||||
|
||||
**********************************************************************}
|
||||
|
||||
{$MODE ObjFPC}
|
||||
|
||||
Unit varutils;
|
||||
|
||||
Interface
|
||||
|
||||
Uses sysutils;
|
||||
|
||||
// Read definitions.
|
||||
|
||||
{$i varutilh.inc}
|
||||
|
||||
Implementation
|
||||
|
||||
// Code common to all platforms.
|
||||
|
||||
{$i cvarutil.inc}
|
||||
|
||||
// Code common to non-win32 platforms.
|
||||
|
||||
{$i varutils.inc}
|
||||
|
||||
end.
|
Loading…
Reference in New Issue
Block a user