Globals and start.asm #19

Merged
ShatteredMINT merged 10 commits from Gelthor/symphony_stdlib:graphics into main 2026-09-06 20:13:07 +02:00
3 changed files with 46 additions and 0 deletions
Showing only changes of commit 4d752ef67c - Show all commits
Executable
+24
View File
@@ -0,0 +1,24 @@
; Error numbers should be 16 bit ODD numbers, so they can be loaded as immediates
; and can be checked with:
;
; qcall falible_function
; jne falible_ok ; Jump no error
; ; handle error
; falible_ok:
; ; Happy path
; ; ...
; OR
; qcall falible_function
; je handle_error ; Jump if error
; ; Happy path
; ; ...
; handle_error:
; ; handle error
pub const OK = 0x0000
pub const SCREEN_INVALID_MODE = 0x0001
pub const SCREEN_INVALID_WIDTH = 0x0003
pub const SCREEN_FB_TOO_SMALL = 0x0005
; Extended error codes, these would require loading a 32 bit value.
pub const EXT_OK = 0x00000000
Executable
+18
View File
@@ -0,0 +1,18 @@
; Addresses of global variables
; If not double buffering these point to the same buffer
pub const FB_DISPLAY_PTR = 16 ; U32 Currently displayed buffer
pub const FB_DRAW_PTR = 20 ; U32 Draw to this buffer
pub const FRAME_BUFFER_SIZE = 24 ; U32
pub const PIXEL_WIDTH = 28 ; U16
pub const PIXEL_HEIGHT = 30 ; U16
; Log2 of width in pixels, e.g.
; * 10 => 1024 * 768
pub const LOG_WIDTH = 32 ; U8
pub const BYTES_PER_PIXEL = 33 ; U8
; Log2 of bytes per pixel
; * 0 => 8 bits per pixel
; * 2 => 32 bits per pixel
pub const LOG_BPP = 34 ; U8
Executable
+4
View File
@@ -0,0 +1,4 @@
@0 ; Reserve space for globals
jmp 0x100 ; jump over them
@0x100 ; start of user code