Set FP_OFF (), FP_SEG() for the callback function at interrupt setting in WonderWitch
Adjust appropriately according to the setting method. (Fit to wwterm)
UNIXTimer.c: UNIXTimer_Unpause()
((unix_timer -> pause == 1) && (unix_timer -> interrupt_in_pause == 0))
Fixed a bug that was not unix_timer-> pause--; when it was.
(It was not unposted when interrupt was not applied during pause)
Serial receive interrupt, keyboard interrupt added. (corresponding to wwterm, operation confirmed)
Added UNIXSerialPort class.
With this, at WonderWitch,
com_intvector.callback = (void (near *) ()) FP_OFF (com_handler);
com_intvector.cs = _ asm_inline ("\tmov \tax, cs");
com_intvector.ds = _ asm_inline ("\tmov \tax, ds");
sys_interrupt_set_hook (SYS_INT_RECEIVEREADY,
& com_intvector, & com_last_intvector);
Interrupt setting like that shown in Fig.
For warning, add WonX_Warning ().
Move WonX_Error () to WonX.c.
comm_send_string (), text_put_string (), text_put_substring () When executed
Fix output message.
Implement cursor display function. (Add WWCursor class) (Do not blink. Display only)
When displaying the cursor, text information inside WWDisplay_DrawLCDPanel ()
Since we need to be able to read it, we will discontinue the WonXText class and add the WWText class
I moved to a member of the WWDisplay class.
In palette_get_color (), transparent color is displayed when executing WWPalette_GetMappedColors ()
Since it was not considered to be returned as -1, palette_get_color ()
Fixed a bug where return value was wrong value.
Character color palette, LCD color palette initial value, with WonderWitch
It was made to coincide with the initial value.
As a sample, add wwterm - b 05. (Add wwterm target to Makefile)
Version 1.1 - from wonx-1.1.tar.gz
168 lines
5.7 KiB
C
168 lines
5.7 KiB
C
/*****************************************************************************/
|
||
/* ここから */
|
||
/*****************************************************************************/
|
||
|
||
#include "WWTextP.h"
|
||
#include "WonX.h"
|
||
|
||
/* フォントのビットマップデータ */
|
||
#include "WWTextFonts.c"
|
||
|
||
/*****************************************************************************/
|
||
/* メンバ関数の定義 */
|
||
/*****************************************************************************/
|
||
|
||
/*===========================================================================*/
|
||
/* メンバの取得 */
|
||
/*===========================================================================*/
|
||
|
||
WWScreen WWText_GetScreen(WWText t) { return (t->screen); }
|
||
int WWText_GetX(WWText t) { return (t->x); }
|
||
int WWText_GetY(WWText t) { return (t->y); }
|
||
int WWText_GetWidth( WWText t) { return (t->width ); }
|
||
int WWText_GetHeight(WWText t) { return (t->height); }
|
||
int WWText_GetBase(WWText t) { return (t->base); }
|
||
WWPalette WWText_GetPalette(WWText t) { return (t->palette); }
|
||
static WWCharacter WWText_GetFont(WWText t, int n) { return (t->font[n]); }
|
||
|
||
/*===========================================================================*/
|
||
/* メンバの設定 */
|
||
/*===========================================================================*/
|
||
|
||
WWScreen WWText_SetScreen(WWText t, WWScreen s) { return (t->screen = s); }
|
||
int WWText_SetX(WWText t, int n) { return (t->x = n); }
|
||
int WWText_SetY(WWText t, int n) { return (t->y = n); }
|
||
int WWText_SetWidth( WWText t, int n) { return (t->width = n); }
|
||
int WWText_SetHeight(WWText t, int n) { return (t->height = n); }
|
||
int WWText_SetBase(WWText t, int n) { return (t->base = n); }
|
||
WWPalette WWText_SetPalette(WWText t, WWPalette p) { return (t->palette = p); }
|
||
static WWCharacter WWText_SetFont(WWText t, int n, WWCharacter c)
|
||
{ return (t->font[n] = c); }
|
||
|
||
int WWText_SetTextWindow(WWText ww_text, int x, int y,
|
||
int width, int height, int base,
|
||
WWDisplay ww_display)
|
||
{
|
||
int tx, ty, c;
|
||
WWCharacter ww_character;
|
||
|
||
WWText_SetX(ww_text, x);
|
||
WWText_SetY(ww_text, y);
|
||
WWText_SetWidth(ww_text, width);
|
||
WWText_SetHeight(ww_text, height);
|
||
WWText_SetBase(ww_text, base);
|
||
|
||
c = WWText_GetBase(ww_text);
|
||
for (ty = 0; ty < WWText_GetHeight(ww_text); ty++) {
|
||
for (tx = 0; tx < WWText_GetWidth(ww_text); tx++) {
|
||
if (c >= 512) WonX_Error("WWText_SetTextWindow", "Over character.");
|
||
ww_character = WWDisplay_GetCharacter(ww_display, c);
|
||
WWCharacter_SetBitmap(ww_character, NULL);
|
||
WWScreen_SetCharacter(WWText_GetScreen(ww_text),
|
||
WWText_GetX(ww_text) + tx,
|
||
WWText_GetY(ww_text) + ty,
|
||
ww_character);
|
||
c++;
|
||
}
|
||
}
|
||
return (0);
|
||
}
|
||
|
||
int WWText_PutCharacter(WWText ww_text, int x, int y, int character,
|
||
WWDisplay ww_display)
|
||
{
|
||
WWCharacter ww_character;
|
||
|
||
if ((character < 0) || (character > 127)) {
|
||
WonX_Warning("WWText_PutCharacter", "Character number is out of range.");
|
||
fflush(stdout);
|
||
return (-1);
|
||
}
|
||
|
||
/*
|
||
* テキスト表示は,text_window_init() で指定したテキストウインドウの
|
||
* 座標系で行う(らしい).(ウインドウ内の左上が(0,0)になる)
|
||
*/
|
||
|
||
if ( (x < 0) || (x > WWText_GetWidth( ww_text) - 1) ||
|
||
(y < 0) || (y > WWText_GetHeight(ww_text) - 1) ) {
|
||
WonX_Warning("WWText_PutCharacter", "Position is out of range.");
|
||
fflush(stdout);
|
||
return (-1);
|
||
}
|
||
|
||
#if 0
|
||
n = WWText_GetBase(ww_text) +
|
||
(x - WWText_GetX(ww_text)) +
|
||
(y - WWText_GetY(ww_text)) * WWText_GetWidth(ww_text);
|
||
ww_character = WWDisplay_GetCharacter(ww_display, n);
|
||
#else
|
||
ww_character = WWScreen_GetCharacter(WWText_GetScreen(ww_text),
|
||
WWText_GetX(ww_text) + x,
|
||
WWText_GetY(ww_text) + y);
|
||
#endif
|
||
|
||
WWCharacter_CopyBitmap(ww_character, WWText_GetFont(ww_text, character));
|
||
|
||
/* 表示時にパレットを設定するのでいいのか? 不明 */
|
||
WWScreen_SetPalette(WWText_GetScreen(ww_text),
|
||
WWText_GetX(ww_text) + x,
|
||
WWText_GetY(ww_text) + y,
|
||
WWText_GetPalette(ww_text));
|
||
|
||
return (character);
|
||
}
|
||
|
||
/*===========================================================================*/
|
||
/* オブジェクトの生成と消去 */
|
||
/*===========================================================================*/
|
||
|
||
WWText WWText_Create(WWScreen screen,
|
||
int x, int y, int width, int height,
|
||
WWPalette palette)
|
||
{
|
||
WWText ww_text;
|
||
int i;
|
||
|
||
ww_text = (WWText)malloc(sizeof(_WWText));
|
||
if (ww_text == NULL) WonX_Error("WWText_Create", "Cannot allocate memory.");
|
||
|
||
WWText_SetScreen(ww_text, screen);
|
||
WWText_SetX(ww_text, 0);
|
||
WWText_SetY(ww_text, 0);
|
||
WWText_SetWidth( ww_text, width );
|
||
WWText_SetHeight(ww_text, height);
|
||
WWText_SetPalette(ww_text, palette);
|
||
|
||
for (i = 0; i < 128; i++) {
|
||
WWText_SetFont(ww_text, i, WWCharacter_Create(i, &(fonts[i * 16])));
|
||
}
|
||
|
||
return (ww_text);
|
||
}
|
||
|
||
WWText WWText_Destroy(WWText ww_text)
|
||
{
|
||
int i;
|
||
|
||
if (ww_text == NULL) WonX_Error("WWText_Destroy", "Object is not created.");
|
||
|
||
for (i = 0; i < 128; i++) {
|
||
if (WWText_GetFont(ww_text, i))
|
||
WWText_SetFont(ww_text, i,
|
||
WWCharacter_Destroy(WWText_GetFont(ww_text, i)));
|
||
}
|
||
|
||
free(ww_text);
|
||
|
||
return (NULL);
|
||
}
|
||
|
||
/*****************************************************************************/
|
||
/* ここまで */
|
||
/*****************************************************************************/
|
||
|
||
/*****************************************************************************/
|
||
/* End of File. */
|
||
/*****************************************************************************/
|