Hi all :-)
I need to pick the brains of you freepascal and assembly (ARM) people out there :-)
If I have an assembly file that is in text format like so:
asmlib.s
Code:
@ gp2x demo article code by Dzz
@ this code is placed in the public domain. do anything you want with it.
.align 4
.globl OpenFile
.globl CloseFile
.globl WriteFile
.globl MUnmap
.globl ChangeDir
.globl ExecuteFile
.globl MMap
.globl Ioctl3
OpenFile:
swi #0x900005
mov pc, lr
CloseFile:
swi #0x900006
mov pc, lr
WriteFile:
swi #0x900004
mov pc, lr
MUnmap:
swi #0x90005B
mov pc, lr
ChangeDir:
swi #0x90000C
mov pc, lr
ExecuteFile:
swi #0x90000B
mov pc, lr
Ioctl3:
swi #0x900036
mov pc, lr
MMap:
stmdb sp!, {r0, r1, r2, r3}
mov r0, sp
swi #0x90005A
add sp, sp, #16
mov pc, lr
and a c header file like this (Before conversion to pascal)
library.h
Code:
extern int OpenFile(char *pszFile, int nMode);
extern void CloseFile(int nFile);
extern int WriteFile(int fd, void *pBuffer, int nLen);
extern void *MMap(void *pAddr, int nLen, int nProtection, int nFlags, int nFD, int nOff);
extern void MUnmap(void *p, int nSize);
extern void ChangeDir(char *pszDir);
extern void ExecuteFile(char *pszFile, int nZero1, int nZero2);
extern int Ioctl3(int fd, unsigned int ulFunction, unsigned int ulParameter);
does anyone know how I can compile the asmlib.s file and link the library routines to it so I can call them from freepascal?
I assume I would need to use the arm-linux-ld.exe, arm-linux-as.exe, etc. programs somehow...
or possibly the pccrossarm.exe cross-compiler?
cheers,
Paul.
Bookmarks