api/internal

Search:
Group by:
Source   Edit  

Types

Button = enum
  P1_Up, P1_Down, P1_Left, P1_Right, P1_A, P1_B, P1_X, P1_Y, P2_Up, P2_Down,
  P2_Left, P2_Right, P2_A, P2_B, P2_X, P2_Y, P3_Up, P3_Down, P3_Left, P3_Right,
  P3_A, P3_B, P3_X, P3_Y, P4_Up, P4_Down, P4_Left, P4_Right, P4_A, P4_B, P4_X,
  P4_Y
Source   Edit  
Color = enum
  Null = -1, Color0, Color1, Color2, Color3, Color4, Color5, Color6, Color7,
  Color8, Color9, Color10, Color11, Color12, Color13, Color14, Color15
Source   Edit  
Key = enum
  Key_Null, Key_A, Key_B, Key_C, Key_D, Key_E, Key_F, Key_G, Key_H, Key_I,
  Key_J, Key_K, Key_L, Key_M, Key_N, Key_O, Key_P, Key_Q, Key_R, Key_S, Key_T,
  Key_U, Key_V, Key_W, Key_X, Key_Y, Key_Z, Key_0, Key_1, Key_2, Key_3, Key_4,
  Key_5, Key_6, Key_7, Key_8, Key_9, Key_Minus, Key_Equals, Key_Leftbracket,
  Key_Rightbracket, Key_Backslash, Key_Semicolon, Key_Apostrophe, Key_Grave,
  Key_Comma, Key_Period, Key_Slash, Key_Space, Key_Tab, Key_Return,
  Key_Backspace, Key_Delete, Key_Insert, Key_Pageup, Key_Pagedown, Key_Home,
  Key_End, Key_Up, Key_Down, Key_Left, Key_Right, Key_Capslock, Key_Ctrl,
  Key_Shift, Key_Alt
Source   Edit  
MouseState {.bycopy.} = object
  x*: int16
  y*: int16
  scrollx*: int8
  scrolly*: int8
  left*: bool
  middle*: bool
  right*: bool
Source   Edit  
VRAM {.bycopy.} = object
  screen*: array[130560 div 8, uint8]
  palette*: array[48, uint8] ## 16 colors.
  palletteMap*: array[8, uint8] ## 16 indices.
  borderColorAndOvrTransparency*: uint8 ## Bank 0 is border color, bank 1 is OVR transparency.
  screenOffsetX*: int8
  screenOffsetY*: int8
  mouseCursor*: int8
  blitSegment*: uint8
  reserved*: array[3, uint8]
Source   Edit  

Vars

Framebuffer = cast[ptr VRAM](0)
Source   Edit  
Gamepads = cast[ptr array[GamepadsSize, uint8]](0x0000FF80)
Source   Edit  
Keyboard = cast[ptr array[KeyboardSize, uint8]](0x0000FF88)
Source   Edit  
Map = cast[ptr array[MapSize, uint8]](0x00008000)
Source   Edit  
Mouse = cast[ptr array[MouseSize, uint8]](0x0000FF84)
Source   Edit  
MusicPatterns = cast[ptr array[MusicPatternsSize, uint8]](0x00011164)
Source   Edit  
MusicTracks = cast[ptr array[MusicTracksSize, uint8]](0x00013E64)
Source   Edit  
PersistentMemory = cast[ptr array[PersistentMemorySize, uint8]](0x00014004)
Source   Edit  
Sfx = cast[ptr array[SfxSize, uint8]](0x000100E4)
Source   Edit  
SfxState = cast[ptr array[SfxStateSize, uint8]](0x0000FF8C)
Source   Edit  
SoundRegisters = cast[ptr array[SoundRegistersSize, uint8]](0x0000FF9C)
Source   Edit  
SoundState = cast[ptr array[SoundStateSize, uint8]](0x00013FFC)
Source   Edit  
SpriteFlags = cast[ptr array[SpriteFlagsSize, uint8]](0x00014404)
Source   Edit  
Sprites = cast[ptr array[SpritesSize, uint8]](0x00006000)
Source   Edit  
StereoVolume = cast[ptr array[StereoVolumeSize, uint8]](0x00014000)
Source   Edit  
SystemFont = cast[ptr array[SystemFontSize, uint8]](0x00014604)
Source   Edit  
Tiles = cast[ptr array[TilesSize, uint8]](0x00004000)
Source   Edit  
WasmFreeRam = cast[ptr array[WasmFreeRamSize, uint8]](0x00018000)
Source   Edit  
Waveforms = cast[ptr array[WaveformsSize, uint8]](0x0000FFE4)
Source   Edit  

Consts

Bpp = 4
bits per pixel Source   Edit  
GamepadsSize: uint32 = 4
Source   Edit  
Height = 136
Source   Edit  
HeightTiles = 17
Source   Edit  
KeyboardSize: uint32 = 4
Source   Edit  
MapSize: uint32 = 32640
Source   Edit  
MouseSize: uint32 = 4
Source   Edit  
MusicPatternsSize: uint32 = 11520
Source   Edit  
MusicTracksSize: uint32 = 408
Source   Edit  
PersistentMemorySize: uint32 = 1024
Source   Edit  
SfxSize: uint32 = 4224
Source   Edit  
SfxStateSize: uint32 = 16
Source   Edit  
SoundRegistersSize: uint32 = 72
Source   Edit  
SoundStateSize: uint32 = 4
Source   Edit  
SpriteFlagsSize: uint32 = 512
Source   Edit  
SpritesSize: uint32 = 0x00002000
Source   Edit  
StereoVolumeSize: uint32 = 4
Source   Edit  
SystemFontSize: uint32 = 2048
Source   Edit  
TileSize = 8
Source   Edit  
TilesSize: uint32 = 0x00002000
Source   Edit  
WasmFreeRamSize: uint32 = 163840
Source   Edit  
WaveformsSize: uint32 = 256
Source   Edit  
Width = 240
Source   Edit  
WidthTiles = 30
Source   Edit  

Procs

proc btn(button: Button): uint32 {.importc, codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3",
                                   ...raises: [], tags: [], forbids: [].}
Get gamepad button state in current frame. Source   Edit  
proc btnp(button: Button; hold: int32 = -1; period: int32 = -1): uint32 {.
    importc, codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3",
    ...raises: [], tags: [], forbids: [].}
Get gamepad button state according to previous frame. Source   Edit  
proc circ(x, y, radius: int32; color: Color) {.importc,
    codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3", ...raises: [],
    tags: [], forbids: [].}
Draw a filled circle. Source   Edit  
proc circb(x, y, radius: int32; color: Color) {.importc,
    codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3", ...raises: [],
    tags: [], forbids: [].}
Draw a circle border. Source   Edit  
proc clip(x, y, width, height: int32) {.importc, codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3",
                                        ...raises: [], tags: [], forbids: [].}
Set the screen clipping region. Source   Edit  
proc cls(color: Color = Color0) {.importc, codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3",
                                  ...raises: [], tags: [], forbids: [].}
Clear the screen. Source   Edit  
proc elli(x, y, a, b: int32; color: Color) {.importc,
    codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3", ...raises: [],
    tags: [], forbids: [].}
Draw a filled ellipse. Source   Edit  
proc ellib(x, y, a, b: int32; color: Color) {.importc,
    codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3", ...raises: [],
    tags: [], forbids: [].}
Draw an ellipse border. Source   Edit  
proc fget(sprite_index: int32; flag: int8): bool {.importc,
    codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3", ...raises: [],
    tags: [], forbids: [].}
Retrieve a sprite flag. Source   Edit  
proc font(text: cstring; x, y: int32; trans_colors: ptr uint8;
          trans_count: int8; char_width, char_height: int8; fixed: bool;
          scale: int8; alt: bool): int8 {.importc,
    codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3", ...raises: [],
    tags: [], forbids: [].}
Print a string using foreground sprite data as the font. Source   Edit  
proc fset(sprite_index: int32; flag: int8; value: bool): bool {.discardable,
    importc, codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3",
    ...raises: [], tags: [], forbids: [].}
Update a sprite flag. Source   Edit  
proc key(key: Key): bool {.importc, codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3",
                           ...raises: [], tags: [], forbids: [].}
Get keyboard button state in current frame. Source   Edit  
proc keyp(key: Key; hold: int32 = -1; period: int32 = -1): bool {.importc,
    codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3", ...raises: [],
    tags: [], forbids: [].}
Get keyboard button state relative to previous frame. Source   Edit  
proc line(x0, y0, x1, y1: cfloat; color: Color) {.importc,
    codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3", ...raises: [],
    tags: [], forbids: [].}
Draw a straight line. Source   Edit  
proc map(x, y, w, h, sx, sy: int32; trans_colors: ptr uint8; colorCount: int8;
         scale: int8; remap: int32) {.importc, codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3",
                                      ...raises: [], tags: [], forbids: [].}
Draw a map region. Source   Edit  
proc mget(x, y: int32): int32 {.importc, codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3",
                                ...raises: [], tags: [], forbids: [].}
Retrieve a map tile at given coordinates. Source   Edit  
proc mouse(mouse_ptr_addy: ptr MouseState) {.importc,
    codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3", ...raises: [],
    tags: [], forbids: [].}
Get XY and press state of mouse/touch. Source   Edit  
proc mset(x, y, value: int32) {.importc, codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3",
                                ...raises: [], tags: [], forbids: [].}
Update a map tile at given coordinates. Source   Edit  
proc music(track, frame, row: int32; loop, sustain: bool; tempo, speed: int32) {.
    importc, codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3",
    ...raises: [], tags: [], forbids: [].}
Play or stop playing music. Source   Edit  
proc peek(address: int32; bits: int8 = 8): int8 {.importc,
    codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3", ...raises: [],
    tags: [], forbids: [].}
Read a byte from an address in RAM. Source   Edit  
proc peek1(address: int32): int8 {.importc, codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3",
                                   ...raises: [], tags: [], forbids: [].}
Read a single bit from an address in RAM. Source   Edit  
proc peek2(address: int32): int8 {.importc, codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3",
                                   ...raises: [], tags: [], forbids: [].}
Read two bit value from an address in RAM. Source   Edit  
proc peek4(address: int32): int8 {.importc, codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3",
                                   ...raises: [], tags: [], forbids: [].}
Read a nibble value from an address. Source   Edit  
proc pix(x, y: int32; color: Color): uint8 {.discardable, importc,
    codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3", ...raises: [],
    tags: [], forbids: [].}
Get or set the color of a single pixel. Source   Edit  
proc pmem(address: int32; value: int64): uint32 {.discardable, importc,
    codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3", ...raises: [],
    tags: [], forbids: [].}
Access or update the persistent memory. Source   Edit  
proc poke(address: int32; value: int8; bits: int8 = 8) {.importc,
    codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3", ...raises: [],
    tags: [], forbids: [].}
Write a byte value to an address in RAM. Source   Edit  
proc poke1(address: int32; value: int8) {.importc,
    codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3", ...raises: [],
    tags: [], forbids: [].}
Write a single bit to an address in RAM. Source   Edit  
proc poke2(address: int32; value: int8) {.importc,
    codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3", ...raises: [],
    tags: [], forbids: [].}
Write a two bit value to an address in RAM. Source   Edit  
proc poke4(address: int32; value: int8) {.importc,
    codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3", ...raises: [],
    tags: [], forbids: [].}
Write a nibble value to an address in RAM. Source   Edit  
proc rect(x, y, w, h: int32; color: Color) {.importc,
    codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3", ...raises: [],
    tags: [], forbids: [].}
Draw a filled rectangle. Source   Edit  
proc rectb(x, y, w, h: int32; color: Color) {.importc,
    codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3", ...raises: [],
    tags: [], forbids: [].}
Draw a rectangle border. Source   Edit  
proc sfx(sfx_id, note, octave, duration, channel, volume_left, volume_right,
         speed: int32) {.importc, codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3",
                         ...raises: [], tags: [], forbids: [].}
Play or stop playing a given sound. Source   Edit  
proc spr(id, x, y: int32; trans_colors: ptr uint8; color_count: int8;
         scale, flip, rotate, w, h: int32) {.importc,
    codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3", ...raises: [],
    tags: [], forbids: [].}
Draw a sprite or composite sprite. Source   Edit  
proc sync(mask: int32 = 0; bank: int8 = 0; to_cart = false) {.importc,
    codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3", ...raises: [],
    tags: [], forbids: [].}
Copy banks of RAM (sprites, map, etc) to and from the cartridge. Source   Edit  
proc tic_exit() {.importc, noreturn, codegenDecl: "__attribute__((import_name(\"exit\"))) $1 $2$3",
                  ...raises: [], tags: [], forbids: [].}
exit() Interrupts program and returns to console. Source   Edit  
proc tic_time(): cfloat {.importc, codegenDecl: "__attribute__((import_name(\"time\"))) $1 $2$3",
                          ...raises: [], tags: [], forbids: [].}
time() Returns how many milliseconds have passed since game started. Source   Edit  
proc trace(text: cstring; color: Color = Color15) {.importc,
    codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3", ...raises: [],
    tags: [], forbids: [].}
Print a string to the Console. Source   Edit  
proc tri(x1, y1, x2, y2, x3, y3: cfloat; color: Color) {.importc,
    codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3", ...raises: [],
    tags: [], forbids: [].}
Draw a filled triangle. Source   Edit  
proc trib(x1, y1, x2, y2, x3, y3: cfloat; color: Color) {.importc,
    codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3", ...raises: [],
    tags: [], forbids: [].}
Draw a triangle border. Source   Edit  
proc tstamp(): uint32 {.importc, codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3",
                        ...raises: [], tags: [], forbids: [].}
Returns the current Unix timestamp in seconds. Source   Edit  
proc ttri(x1, y1, x2, y2, x3, y3, u1, v1, u2, v2, u3, v3: cfloat; texsrc: int32;
          trans_colors: ptr uint8; color_count: int8; z1, z2, z3: cfloat;
          depth: bool) {.importc, codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3",
                         ...raises: [], tags: [], forbids: [].}
Draw a triangle filled with texture. Source   Edit  
proc vbank(bank: int8): int8 {.importc, codegenDecl: "__attribute__((import_name(\"$2\"))) $1 $2$3",
                               ...raises: [], tags: [], forbids: [].}
Switch the 16kb of banked video RAM. Source   Edit