FRANK OS API Reference
API reference for apps/api/frankos-app.h. All functions are called through the MOS2 sys_table at 0x10FFF000.
sys_table Index#
| Option | Description |
|---|
| 17 | xTaskGetTickCount (FreeRTOS) |
| 404 | wm_create_window |
| 405 | wm_destroy_window |
| 406 | wm_show_window |
| 407 | wm_set_focus |
| 408 | wm_get_window |
| 409 | wm_set_window_rect |
| 410 | wm_invalidate |
| 411 | wm_post_event |
| 412 | wm_get_client_rect |
| 413 | wd_begin |
| 414 | wd_end |
| 415 | wd_pixel |
| 416 | wd_hline |
| 417 | wd_vline |
| 418 | wd_fill_rect |
| 419 | wd_clear |
| 420 | wd_rect |
| 421 | wd_bevel_rect |
| 422 | wd_char_ui |
| 423 | wd_text_ui |
| 424-427 | Menus, Dialogs, Taskbar, Timers |
| 430-431 | Task notifications |
| 438 | printf (serial debug) |
| 439-442 | File dialog, button, framebuffer pointer |
| 443-450 | MP3 decoding (Helix) and PCM audio |
| 451-454 | Clipboard operations |
| 455-474 | Scrollbar and Textarea controls |
| 475-481 | File save dialog, Find/Replace |
| 482 | wm_mark_dirty |
| 483 | snd_open |
| 484 | snd_write |
| 485 | snd_close |
| 486-490 | MOD playback (HxCMod) |
| 491-493 | PSRAM allocator |
| 494-505 | File associations, desktop shortcuts, fullscreen, deferred launch |
| 506-511 | MIDI/OPL audio |
| 512-514 | 32x32 icons, ICO parsing |
| 515-521 | Video mode switching and display state |
| 522-528 | Direct framebuffer, keyboard polling (fullscreen) |
| 529-535 | SRAM allocator, display_request_mode, volume control |
Data Types#
rect_t β { int16_t x, y, w, h }
point_t β { int16_t x, y }
hwnd_t β uint8_t (0 = HWND_NULL, 1-16 = valid)
window_event_t β type + union of key, charev, mouse, move, size, command, timer, dropfiles
window_t β flags, state, frame rect, restore_rect, bg_color, z_order, title[24], event_handler, paint_handler, user_data
Constants#
Window Flags (WF_*)#
| Option | Description |
|---|
| WF_ALIVE | bit 0 |
| WF_VISIBLE | bit 1 |
| WF_FOCUSED | bit 2 |
| WF_CLOSABLE | bit 3 |
| WF_RESIZABLE | bit 4 |
| WF_MOVABLE | bit 5 |
| WF_BORDER | bit 6 |
| WF_DIRTY | bit 7 |
| WF_MENUBAR | bit 8 |
| WF_FRAME_DIRTY | bit 9 |
| WF_FULLSCREENABLE | bit 11 |
Window States#
| Option | Description |
|---|
| WS_NORMAL | 0 |
| WS_MINIMIZED | 1 |
| WS_MAXIMIZED | 2 |
Keyboard Modifiers#
| Option | Description |
|---|
| KMOD_SHIFT | bit 0 |
| KMOD_CTRL | bit 1 |
| KMOD_ALT | bit 2 |
Dialog Constants#
| Option | Description |
|---|
| DIALOG_ICON_NONE | No icon |
| DIALOG_ICON_INFO | Info icon |
| DIALOG_ICON_WARNING | Warning icon |
| DIALOG_ICON_ERROR | Error icon |
| DIALOG_BTN_OK | OK button |
| DIALOG_BTN_CANCEL | Cancel button |
| DIALOG_BTN_YES | Yes button |
| DIALOG_BTN_NO | No button |
| DIALOG_RESULT_OK | 0xFF01 |
| DIALOG_RESULT_CANCEL | 0xFF02 |
| DIALOG_RESULT_YES | 0xFF03 |
| DIALOG_RESULT_NO | 0xFF04 |
| DIALOG_RESULT_INPUT | 0xFF10 |
| DIALOG_RESULT_FILE | 0xFF20 |
| DIALOG_RESULT_FILE_SAVE | 0xFF21 |
| DIALOG_RESULT_FIND_NEXT | 0xFF31 |
| DIALOG_RESULT_REPLACE | 0xFF32 |
| DIALOG_RESULT_REPLACE_ALL | 0xFF33 |
Display Constants#
| Option | Description |
|---|
| DISPLAY_WIDTH | 640 |
| DISPLAY_HEIGHT | 480 |
| TASKBAR_HEIGHT | 28 |
| FONT_UI_WIDTH | 6 |
| FONT_UI_HEIGHT | 12 |
| SCROLLBAR_WIDTH | 16 |
Theme Constants#
| Option | Description |
|---|
| THEME_TITLE_HEIGHT | 20 |
| THEME_MENU_HEIGHT | 20 |
| THEME_BORDER_WIDTH | 4 |
| THEME_BUTTON_FACE | COLOR_LIGHT_GRAY |
Colors#
| Option | Description |
|---|
| COLOR_BLACK | 0 |
| COLOR_BLUE | 1 |
| COLOR_GREEN | 2 |
| COLOR_CYAN | 3 |
| COLOR_RED | 4 |
| COLOR_MAGENTA | 5 |
| COLOR_BROWN | 6 |
| COLOR_LIGHT_GRAY | 7 |
| COLOR_DARK_GRAY | 8 |
| COLOR_LIGHT_BLUE | 9 |
| COLOR_LIGHT_GREEN | 10 |
| COLOR_LIGHT_CYAN | 11 |
| COLOR_LIGHT_RED | 12 |
| COLOR_LIGHT_MAGENTA | 13 |
| COLOR_YELLOW | 14 |
| COLOR_WHITE | 15 |