jibby/utils/codegen

Macros to bring SDCC-specific annotations to Nim.

Macros

macro asmDefined(node: untyped): untyped
Declares a var that has been allocated statically; i.e. defined explicitly in WRAM.

Example: cmd: --compileOnly -r:off

import jibby/utils/codegen

var myStaticVariable {.importc, asmDefined, noinit.}: byte
discard
macro banked(node: untyped): untyped
Declares a proc as banked.

Example: cmd: --compileOnly -r:off

import jibby/utils/codegen

proc something(): void {.exportc, banked.} =
  discard
macro hramByte(node: untyped): untyped
Declares a byte var in HRAM.

Example: cmd: --compileOnly -r:off

import jibby/utils/codegen

var myStaticVariable {.importc, hramByte, noinit.}: byte
discard
macro isr(node: untyped): untyped
Declares a proc that is an interrupt service routine (ISR). As a result, when this proc is called, the contents of every register is pushed beforehand and will be popped after execution.

Example: cmd: --compileOnly -r:off

import jibby/utils/codegen

proc something(): void {.exportc, isr.} =
  discard
macro oldCall(node: untyped): untyped
Declares a proc that uses the SDCC v0 convention. For reference, the default convention used is SDCC v1.

Example: cmd: --compileOnly -r:off

import jibby/utils/codegen

proc something(): void {.exportc, oldCall.} =
  discard