wonx/system.c
Hiroaki Sakai 5e1a9795b7 Create your own header file. It became compilable with only Wonx.
Since there is a possibility that the Error () function will collide with libwonx.a when linking,
It changed to Wonx_Error ().
Added bios_exit ().
sprite_set_char, sprite_get_char, palette number minus 8
Fixed bug that was not specified.
font_set_monodata (), font_set_colordata (), font_get_data (), disp.c,
The arguments of screen_set_char (), screen_get_char (), sprite_set_data ()
Changed from void * to appropriate type.
Sample program and attached SpeedMac.
I added a document.

Version 0.3 beta - from wonx-b03.tar.gz
2018-03-07 23:06:08 +00:00

194 lines
4.3 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*****************************************************************************/
/* ここから */
/*****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include "wonx_include/system.h"
#include "Wonx.h"
/*****************************************************************************/
/* 互換関数の定義 */
/*****************************************************************************/
/*
* Xサーバとの同期の整合性がとれなくなるなどの問題が考えられるので
* 互換関数の内部は UNIXTimer_Pause(), UNIXTimer_Unpause() でくくり,
* タイマ割り込みを一時停止して処理を行うまたunpause するまえに,
* かならず sync するようにする.
*/
/*
* タイマの一時停止の2重解除の問題が出てくるので,
* 互換関数から互換関数を呼んではいけない.
* (一時停止はネストされるが,いちおう)
* 似たような処理をする関数の場合は,必ず static な別関数に処理をまとめ,
* そっちを呼び出すようにすること.
* 引数の表示の問題もあるしね.
*/
void sys_interrupt_set_hook(int type, intvector_t * vector,
intvector_t * old_vector)
{
WWInterrupt ww_interrupt;
if (!Wonx_IsCreated()) Wonx_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
printf("call : sys_interrupt_set_hook() : type = %d, vector = %p, old_vector = %p\n", type, vector, old_vector);
fflush(stdout);
ww_interrupt = WonxSystem_GetWWInterrupt(Wonx_GetWonxSystem());
old_vector->callback = WWInterrupt_GetCallback(ww_interrupt, type);
old_vector->cs = WWInterrupt_GetCS(ww_interrupt, type);
old_vector->ds = WWInterrupt_GetDS(ww_interrupt, type);
WWInterrupt_SetCallback(ww_interrupt, type, vector->callback);
WWInterrupt_SetCS(ww_interrupt, type, vector->cs);
WWInterrupt_SetDS(ww_interrupt, type, vector->ds);
printf("call : sys_interrupt_set_hook() : return value = none\n");
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
return;
}
void sys_interrupt_reset_hook(int type, intvector_t * old_vector)
{
WWInterrupt ww_interrupt;
if (!Wonx_IsCreated()) Wonx_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
printf("call : sys_interrupt_reset_hook() : type = %d, old_vector = %p\n", type, old_vector);
fflush(stdout);
ww_interrupt = WonxSystem_GetWWInterrupt(Wonx_GetWonxSystem());
WWInterrupt_SetCallback(ww_interrupt, type, old_vector->callback);
WWInterrupt_SetCS(ww_interrupt, type, old_vector->cs);
WWInterrupt_SetDS(ww_interrupt, type, old_vector->ds);
printf("call : sys_interrupt_reset_hook() : return value = none\n");
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonxSystem_GetUNIXTimer(Wonx_GetWonxSystem()));
return;
}
void sys_wait(unsigned int wait_time)
{
}
unsigned long int sys_get_tick_count(void)
{
return (0);
}
void sys_sleep(void)
{
}
void sys_set_sleep_time(int sleep_time)
{
}
int sys_get_sleep_time(void)
{
return (0);
}
void sys_set_awake_key(int pattern)
{
}
int sys_get_awake_key(void)
{
return (0);
}
void sys_set_keepalive_int(int pattern)
{
}
void sys_get_ownerinfo(int size, char * buffer)
{
}
int sys_suspend(int core)
{
return (0);
}
void sys_resume(int core)
{
}
void sys_set_remote(int remote)
{
}
unsigned int sys_get_remote(void)
{
return (0);
}
void * sys_alloc_iram(void * p, unsigned int size)
{
return (NULL);
}
void sys_free_iram(void * p)
{}
void * sys_get_my_iram(void)
{
return (NULL);
}
unsigned int sys_get_version(void)
{
return (0);
}
int sys_swap(int core)
{
return (0);
}
void sys_set_resume(unsigned int flags)
{
}
unsigned int sys_get_resume(void)
{
return (0);
}
void bios_exit()
{
printf("call : bios_exit() : \n");
fflush(stdout);
exit (0);
}
/*****************************************************************************/
/* ここまで */
/*****************************************************************************/
/*****************************************************************************/
/* End of File. */
/*****************************************************************************/