Added some tools, some drawing functions and some GUI functions.

This commit is contained in:
mibi88 2023-01-20 18:19:42 +01:00
parent 64aa5dcc5e
commit 40e4d7dd31
6 changed files with 149 additions and 8 deletions

View File

@ -2,6 +2,8 @@
Make very small add-ins.
You can also write this name "libµfx" or "ufx".
With this library you can easly make very small add-ins, but they are not as fast as add-ins made using gint, so you should use gint to write more complex add-ins. This library only provides support of the fx98xx series of CASIO monochrome calculators that support add-ins.
## Getting started

View File

@ -48,13 +48,13 @@ The available colors are SWHITE or SBLACK.
void spixel(int x, int y, int color);
/* void stext(int x, int y, char *text);
/* void stext(int x, int y, char *text, int color);
Puts the text text at (x, y) on the screen using casio
default font.
default font with color color.
*/
void stext(int x, int y, char *text);
void stext(int x, int y, char *text, int color);
/* void slocate(int x, int y, char *text);
@ -63,6 +63,29 @@ Works like the Locate function of CASIO Basic.
void slocate(int x, int y, char *text);
/* void saddlocate(char *text);
Continues the text displayed with slocate, can be used
multiple times after a locate.
*/
void saddlocate(char *text);
/* void sgoto(int x, int y);
Moves the position where you can add text with saddlocate.
*/
void sgoto(int x, int y);
/* void stextmini(int x, int y, char *text);
Works like stext, but here the font is PrintMini and you cannot
set the color.
*/
void stextmini(int x, int y, char *text);
/******* KEYBOARD *******/
/* int kisdown(void);
@ -123,6 +146,14 @@ Free __ptr.
void free(void *__ptr);
/* void itohex(char *buffer, int value, int len);
Puts the hex representation of value into buffer. The hex number
will have the size len.
*/
void itohex(char *buffer, int value, int len);
/******* TIME *******/
/* void tsleep_ms(int ms);
@ -182,4 +213,19 @@ string and maxlen is the maximal length of the input.
void gstrask(char *buffer, char *message, int maxlen);
/* void simage(int sx, int sy, int w, int h, unsigned char *img, int mode);
Draws an fkey from a Sprite Coder string that is in img,
at fkey position pos.
*/
void gfkeyset(int pos, unsigned char *img);
/* void gmessagebox(int height, char *message);
Draws a message box of height height with that contains message.
*/
void gmessagebox(int height, char *message);
#endif

View File

@ -13,6 +13,8 @@ void _locate(int x, int y);
void _Print(unsigned char *text);
void _Bdisp_DrawLineVRAM(int x1, int y1, int x2, int y2);
void _Bdisp_ClearLineVRAM(int x1, int y1, int x2, int y2);
void _PrintMiniSd(int x, int y, unsigned char *text, int color);
void _DisplayMessageBox(int height, unsigned char *message);
/* Microfx */
@ -40,8 +42,8 @@ void sline(int x1, int y1, int x2, int y2, int color) {
}
}
void stext(int x, int y, char *text) {
_PrintXY(x, y, (unsigned char*)text, 0);
void stext(int x, int y, char *text, int color) {
_PrintXY(x, y, (unsigned char*)text, !color);
}
void slocate(int x, int y, char *text) {
@ -49,6 +51,22 @@ void slocate(int x, int y, char *text) {
_Print((unsigned char*)text);
}
void saddlocate(char *text) {
_Print((unsigned char*)text);
}
void sgoto(int x, int y) {
_locate(x, y);
}
void stextmini(int x, int y, char *text) {
_PrintMiniSd(x, y, (unsigned char*)text, 0);
}
void gmessagebox(int height, char *message) {
_DisplayMessageBox(height, (unsigned char*)message);
}
/******* KEYBOARD *******/
/* Syscalls */
@ -90,6 +108,18 @@ int kgetkey(void){
return (buffer[1] & 0x0F) * 10 + ((buffer[2] & 0xF0 ) >> 4);
}
/******* Tools *******/
/* Syscalls */
int _LongToAscHex(int value, char *dest, int digits);
/* Microfx */
void itohex(char *buffer, int value, int len) {
_LongToAscHex(value, buffer, len);
}
/******* Time *******/
/* Syscalls */
@ -126,6 +156,7 @@ void csleep(void) {
int _InputNumber(unsigned char *heading, int maxlen, int mode);
int _InputString(unsigned char *buffer, unsigned char *heading, int maxlen);
void _DisplayFKeyIcon(int FKeyPos, unsigned char *pBitmap);
/* Microfx */
@ -135,4 +166,8 @@ int gnumask(char *message, int maxlen, int type) {
void gstrask(char *buffer, char *message, int maxlen) {
_InputString((unsigned char *)buffer, (unsigned char *)message, maxlen);
}
void gfkeyset(int pos, unsigned char *img) {
_DisplayFKeyIcon(pos, img);
}

View File

@ -10,6 +10,8 @@
.global __Print
.global __Bdisp_DrawLineVRAM
.global __Bdisp_ClearLineVRAM
.global __PrintMiniSd
.global __DisplayMessageBox
/* Keyboard */
.global __Keyboard_GetPressedTime
.global __Keyboard_IsKeyPressed
@ -27,9 +29,11 @@
.global _calloc
.global _realloc
.global _free
.global __LongToAscHex
/* GUI */
.global __InputNumber
.global __InputString
.global __DisplayFKeyIcon
#define syscall(syscall_number) \
mov.l 1f, r0 ;\
@ -60,6 +64,10 @@ __Bdisp_DrawLineVRAM:
syscall(0x030)
__Bdisp_ClearLineVRAM:
syscall(0x031)
__PrintMiniSd:
syscall(0xC4F)
__DisplayMessageBox:
syscall(0x0901)
/* Keyboard */
__Keyboard_GetPressedTime:
syscall(0x249)
@ -91,11 +99,15 @@ _realloc:
syscall(0xE6D)
_free:
syscall(0xACC)
__LongToAscHex:
syscall(0x467)
/* GUI */
__InputNumber:
syscall(0x0CC4)
__InputString:
syscall(0x0CC5)
__DisplayFKeyIcon:
syscall(0x04D1)
/* Menu */
/* Nothing here ... */

View File

@ -48,13 +48,13 @@ The available colors are SWHITE or SBLACK.
void spixel(int x, int y, int color);
/* void stext(int x, int y, char *text);
/* void stext(int x, int y, char *text, int color);
Puts the text text at (x, y) on the screen using casio
default font.
default font with color color.
*/
void stext(int x, int y, char *text);
void stext(int x, int y, char *text, int color);
/* void slocate(int x, int y, char *text);
@ -63,6 +63,29 @@ Works like the Locate function of CASIO Basic.
void slocate(int x, int y, char *text);
/* void saddlocate(char *text);
Continues the text displayed with slocate, can be used
multiple times after a locate.
*/
void saddlocate(char *text);
/* void sgoto(int x, int y);
Moves the position where you can add text with saddlocate.
*/
void sgoto(int x, int y);
/* void stextmini(int x, int y, char *text);
Works like stext, but here the font is PrintMini and you cannot
set the color.
*/
void stextmini(int x, int y, char *text);
/******* KEYBOARD *******/
/* int kisdown(void);
@ -123,6 +146,14 @@ Free __ptr.
void free(void *__ptr);
/* void itohex(char *buffer, int value, int len);
Puts the hex representation of value into buffer. The hex number
will have the size len.
*/
void itohex(char *buffer, int value, int len);
/******* TIME *******/
/* void tsleep_ms(int ms);
@ -182,4 +213,19 @@ string and maxlen is the maximal length of the input.
void gstrask(char *buffer, char *message, int maxlen);
/* void simage(int sx, int sy, int w, int h, unsigned char *img, int mode);
Draws an fkey from a Sprite Coder string that is in img,
at fkey position pos.
*/
void gfkeyset(int pos, unsigned char *img);
/* void gmessagebox(int height, char *message);
Draws a message box of height height with that contains message.
*/
void gmessagebox(int height, char *message);
#endif

Binary file not shown.