A single header should be enough for all TOS calls.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23206 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
François Revol 2008-01-01 19:56:53 +00:00
parent 6152d8f58b
commit a24251b49b
5 changed files with 96 additions and 84 deletions

View File

@ -1,42 +0,0 @@
/*
* Copyright 2007, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT license.
*
* Author:
* François Revol, revol@free.fr.
*/
#ifndef _BIOS_H
#define _BIOS_H
/*
* Atari BIOS calls
*/
#define BIOS_TRAP XXX
// BIOSxxx...: x: param type {W|L}
#define BIOS(nr) \
({ uint32 ret; \
asm volatile ( \
" move #%0,-(sp)\n" \
" trap #" #BIOS_TRAP "\n" \
" add.l #2,sp" \
:: "=r"(ret)); \
ret; })
#define BIOSW(nr, w0) \
({ uint32 ret; \
asm volatile ( \
" move.w %1,-(sp)\n" \
" move #" #nr ",-(sp)\n" \
" trap #" #BIOS_TRAP "\n" \
" add.l #2,sp" \
:: "=r"(ret)); \
ret; })
#define Bconin(p0) (uint32)BIOSW(2, p0)
//XXX nparams ?
#define Kbshift(p0) (uint32)BIOSW(11, p0)
#endif /* _BIOS_H */

View File

@ -1,24 +0,0 @@
/*
* Copyright 2007, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT license.
*
* Author:
* François Revol, revol@free.fr.
*/
#ifndef _GEMDOS_H
#define _GEMDOS_H
/*
* Atari GEMDOS calls
*/
#define GEMDOS_TRAP 1
// official names
#define Cconin() GEMDOS(1)
// check for names
#define supexec() GEMDOS(0x20)
#define terminate() GEMDOS(0)
#endif /* _GEMDOS_H */

View File

@ -0,0 +1,46 @@
/*
* Copyright 2007, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT license.
*
* Author:
* François Revol, revol@free.fr.
*/
#define FUNCTION(x) .global x; .type x,@function; x
/* non reentrant but that's enough
* idea taken from
* http://www.fortunecity.com/skyscraper/apple/308/html/chap4.htm
*/
_trap_ret_addr:
.long 0
/* uint32 bios(uint16 nr, ...); */
FUNCTION(bios):
move.l (%a7)+,_trap_ret_addr
trap #
move.l _trap_ret_addr,-(%a7)
rts
/* uint32 xbios(uint16 nr, ...); */
FUNCTION(xbios):
move.l (%a7)+,_trap_ret_addr
trap #14
move.l _trap_ret_addr,-(%a7)
rts
/* uint32 gemdos(uint16 nr, ...); */
FUNCTION(gemdos):
move.l (%a7)+,_trap_ret_addr
trap #1
move.l _trap_ret_addr,-(%a7)
rts
/* uint32 vdi(uint16 nr, ...); */
FUNCTION(vdi):
move.l (%a7)+,_trap_ret_addr
trap #14
move.l _trap_ret_addr,-(%a7)
rts

View File

@ -0,0 +1,50 @@
/*
* Copyright 2007, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT license.
*
* Author:
* François Revol, revol@free.fr.
*/
#ifndef _TOSCALLS_H
#define _TOSCALLS_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* Atari BIOS calls
*/
extern uint32 bios(uint16 nr, ...);
#define Bconin(p0) bios(2, p0)
//XXX nparams ?
#define Kbshift(p0) bios(11, p0)
/*
* Atari XBIOS calls
*/
extern uint32 bios(uint16 nr, ...);
/*
* Atari GEMDOS calls
*/
extern uint32 gemdos(uint16 nr, ...);
// official names
#define Cconin() gemdos(1)
#define Super(a) gemdos(0x20, (uint32)a)
// check for names
#define terminate() GEMDOS(0)
#ifdef __cplusplus
}
#endif
#endif /* _TOSCALLS_H */

View File

@ -1,18 +0,0 @@
/*
* Copyright 2007, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT license.
*
* Author:
* François Revol, revol@free.fr.
*/
#ifndef _XBIOS_H
#define _XBIOS_H
/*
* Atari XBIOS calls
*/
#define BIOS_TRAP 14
//#define GEMDOS_TRAP 1
#endif /* _XBIOS_H */