forked from TCShenanigans/symphony_stdlib
Added initial draft of globals and errno
This commit is contained in:
@@ -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
@@ -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
|
||||
Reference in New Issue
Block a user