mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-02 23:47:21 +01:00
* Minor changes in input system and rand function
git-svn-id: trunk@4530 -
This commit is contained in:
parent
19d597f425
commit
e7fc75258b
@ -1,5 +1,5 @@
|
||||
(*
|
||||
gba_core.pas 18/06/2006 4.17.35
|
||||
gba_core.pas 01/09/2006 19.17.35
|
||||
------------------------------------------------------------------------------
|
||||
This lib is a raw porting of tonclib library for gba (you can find it at
|
||||
http://user.chem.tue.nl/jakvijn/index.htm).
|
||||
@ -52,6 +52,7 @@ var
|
||||
|
||||
function gbaRandomize(seed: dword): dword;
|
||||
function gbaRand(): dword;
|
||||
function gbaRand(value: integer): dword;
|
||||
|
||||
procedure memset16(dest: pointer; hw: word; hwcount: dword); cdecl; external;
|
||||
procedure memcpy16(dest: pointer; const src: pointer; hwcount: dword); cdecl; external;
|
||||
@ -78,6 +79,15 @@ begin
|
||||
gbaRand := (gbaRandSeed shr 16) and QRAN_MAX;
|
||||
end;
|
||||
|
||||
function gbaRand(value: integer): dword;
|
||||
var
|
||||
a: dword;
|
||||
begin
|
||||
gbaRandSeed := QRAN_A * gbaRandSeed + QRAN_C;
|
||||
a := (gbaRandSeed shr 16) and QRAN_MAX;
|
||||
gbaRand := (a * value) shr 15;
|
||||
end;
|
||||
|
||||
// memory handling routines
|
||||
// these are in ASM and optimized; use when possible
|
||||
{$l core_asm.o}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
(*
|
||||
gba_input.pas 18/06/2006 4.20.21
|
||||
gba_input.pas 01/09/2006 19.57.16
|
||||
------------------------------------------------------------------------------
|
||||
This lib is a raw porting of libgba library for gba (you can find it at
|
||||
http://www.devkitpro.org).
|
||||
@ -38,6 +38,26 @@ uses
|
||||
gba_types, gba_regs;
|
||||
|
||||
|
||||
|
||||
const
|
||||
KEY_A: TKeyPadBits = (1 shl 0);
|
||||
KEY_B: TKeyPadBits = (1 shl 1);
|
||||
KEY_SELECT: TKeyPadBits = (1 shl 2);
|
||||
KEY_START: TKeyPadBits = (1 shl 3);
|
||||
KEY_RIGHT: TKeyPadBits = (1 shl 4);
|
||||
KEY_LEFT: TKeyPadBits = (1 shl 5);
|
||||
KEY_UP: TKeyPadBits = (1 shl 6);
|
||||
KEY_DOWN: TKeyPadBits = (1 shl 7);
|
||||
KEY_R: TKeyPadBits = (1 shl 8);
|
||||
KEY_L: TKeyPadBits = (1 shl 9);
|
||||
|
||||
KEYIRQ_ENABLE: TKeyPadBits = (1 shl 14);
|
||||
KEYIRQ_OR: TKeyPadBits = (0 shl 15);
|
||||
KEYIRQ_AND: TKeyPadBits = (1 shl 15);
|
||||
DPAD: TKeyPadBits = (1 shl 6) or (1 shl 7) or (1 shl 5) or (1 shl 4);
|
||||
|
||||
|
||||
|
||||
type
|
||||
KeyInput = packed record
|
||||
Up: word;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
(*
|
||||
gba_types.pas 18/06/2006 4.38.46
|
||||
gba_types.pas 01/09/2006 19.57.46
|
||||
------------------------------------------------------------------------------
|
||||
This lib is a raw porting of libgba library for gba (you can find it at
|
||||
http://www.devkitpro.org).
|
||||
@ -142,23 +142,7 @@ type
|
||||
);
|
||||
TDMAModes = DMA_MODES;
|
||||
|
||||
KEYPAD_BITS = (
|
||||
KEY_A = (1 shl 0),
|
||||
KEY_B = (1 shl 1),
|
||||
KEY_SELECT = (1 shl 2),
|
||||
KEY_START = (1 shl 3),
|
||||
KEY_RIGHT = (1 shl 4),
|
||||
KEY_LEFT = (1 shl 5),
|
||||
KEY_UP = (1 shl 6),
|
||||
KEY_DOWN = (1 shl 7),
|
||||
KEY_R = (1 shl 8),
|
||||
KEY_L = (1 shl 9),
|
||||
|
||||
KEYIRQ_ENABLE = (1 shl 14),
|
||||
KEYIRQ_OR = (0 shl 15),
|
||||
KEYIRQ_AND = (1 shl 15),
|
||||
DPAD = integer(KEY_UP) or integer(KEY_DOWN) or integer(KEY_LEFT) or integer(KEY_RIGHT)
|
||||
);
|
||||
KEYPAD_BITS = integer;
|
||||
TKeyPadBits = KEYPAD_BITS;
|
||||
|
||||
OBJATTR = record
|
||||
|
||||
Loading…
Reference in New Issue
Block a user