* Updated nds linker script for new binutils

* Quick'n'dirt random number generator for nds

git-svn-id: trunk@10887 -
This commit is contained in:
Legolas 2008-05-05 17:50:13 +00:00
parent dc1ac3f9fa
commit f2437bb479
2 changed files with 38 additions and 44 deletions

View File

@ -389,6 +389,7 @@ begin
add('');
add('');
add(' __dtcm_lma = . ;');
add(' __bss_vma = . ;');
add('');
add(' .dtcm __dtcm_start : AT (__dtcm_lma)');
add(' {');
@ -420,9 +421,7 @@ begin
add('');
add('');
add('');
add(' __bss_lma = __itcm_lma + SIZEOF(.itcm) ;');
add(' __appended_data = __itcm_lma + SIZEOF(.itcm) ;');
add(' .bss __bss_lma : AT (__bss_lma)');
add(' .bss __bss_vma (NOLOAD):');
add(' {');
add(' __bss_start = ABSOLUTE(.);');
add(' __bss_start__ = ABSOLUTE(.);');
@ -433,12 +432,11 @@ begin
add(' . = ALIGN(4); /* REQUIRED. LD is flaky without it. */');
add(' __bss_end = ABSOLUTE(.) ;');
add(' __bss_end__ = __bss_end ;');
add(' } >ewram');
add(' } AT>ewram');
add('');
add('');
add(' _end = . ;');
add(' __end__ = . ;');
add(' PROVIDE (end = _end);');
add(' _end = __bss_end__ ;');
add(' __end__ = __bss_end__ ;');
add('');
add('');
add('');
@ -513,13 +511,11 @@ begin
add(' .text : /* ALIGN (4): */');
add(' {');
add('');
add(' *(.text.*)');
add(' *(.stub)');
add(' *(.text .stub .text.* .gnu.linkonce.t.*)');
add(' KEEP (*(.text.*personality*))');
add(' /* .gnu.warning sections are handled specially by elf32.em. */');
add(' *(.gnu.warning)');
add(' *(.gnu.linkonce.t*)');
add(' *(.glue_7)');
add(' *(.glue_7t)');
add(' KEEP (*(.text.*personality*))');
add(' . = ALIGN(4); /* REQUIRED. LD is flaky without it. */');
add(' } >iwram = 0xff');
add('');

View File

@ -57,7 +57,7 @@ var
argv: PPChar;
envp: PPChar;
errno: integer;
fake_heap_end: ^byte; cvar;
fake_heap_end: ^byte; cvar; external;
irq_vector: integer; external name '__irq_vector';
@ -101,32 +101,6 @@ begin
IsARM9 := integer(@irq_vector) = $0B003FFC;
end;
{
NDS CPU detecting function (thanks to 21o6):
--------------------------------------------
"You see, the ARM7 can't write to bank A of VRAM, but it doesn't give any
error ... it just doesn't write there... so it's easily determinable what
CPU is running the code"
ARM946E-S processor can handle dsp extensions extensions, but ARM7TDMI does
not. FPC can't retrieve the CPU target at compiling time, so this small
function takes care to check if the code is running on an ARM9 or on an ARM7
CPU. It works on Nintendo DS only, I guess :)
}
function IsARM92(): boolean;
var
Dummy : pword absolute $06800000;
tmp: word;
begin
tmp := Dummy^;
Dummy^ := $C0DE;
IsARM92 := Dummy^ = $C0DE;
Dummy^ := tmp;
end;
{$ifdef FPC_HAS_FEATURE_PROCESSES}
function GetProcessID: SizeUInt;
begin
@ -148,6 +122,35 @@ end;
{*****************************************************************************
ParamStr/Randomize
*****************************************************************************}
const
QRAN_SHIFT = 15;
QRAN_MASK = ((1 shl QRAN_SHIFT) - 1);
QRAN_MAX = QRAN_MASK;
QRAN_A = 1664525;
QRAN_C = 1013904223;
{ set randseed to a new pseudo random value }
procedure randomize;
var
IPC_Timer: array [0..2] of byte absolute $27FF01B;
begin
RandSeed := (IPC_Timer[0] * 3600) + (IPC_Timer[1] * 60) + IPC_Timer[2];
end;
function random(): integer;
begin
RandSeed := QRAN_A * RandSeed + QRAN_C;
random := (RandSeed shr 16) and QRAN_MAX;
end;
function random(value: integer): integer;
var
a: integer;
begin
RandSeed := QRAN_A * RandSeed + QRAN_C;
a := (RandSeed shr 16) and QRAN_MAX;
random := (a * value) shr 15;
end;
{ number of args }
function paramcount : longint;
@ -161,11 +164,6 @@ begin
paramstr := '';
end;
{ set randseed to a new pseudo random value }
procedure randomize;
begin
// Boo!
end;
{$ifdef FPC_HAS_FEATURE_TEXTIO}
procedure SysInitStdIO;