Skip to content

expl01txx/RadianceVM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Radiance VM

A 32-bit fantasy console that uses RV32I for CPU emulation and SDL3 for framebuffer rendering written in Zig

Specifications:

  • Risc-V IMA emulated CPU
  • 512kb of ram with 394kb for prorgam`s code
  • 240x140 8 bit screen with 256 available colors using palette

It also have preconfigured example of using Zig to build roms and small standart library for drawing and reading keyboard.

Program example:

const rvm = @import("rvm.zig");

const image = @embedFile("image.bin");

export fn _start() callconv(.naked) noreturn {
    asm volatile (
        \\ .option push
        \\ .option norelax
        \\ la sp, 0x7FFF0
        \\ andi sp, sp, -16
        \\ li gp, 0x0 
        \\ jal ra, main
        \\ 1: j 1b
        \\ .option pop
    );
}

export fn main() void {
    rvm.clearScreen();
    rvm.setPaletteColor(0, 0x000000);
    rvm.setPaletteColor(1, 0xFF00FF);

    const text = "Radiance VM";
    const text_len = rvm.getTextSize(text);
    const pos_x = rvm.SCREEN_WIDTH / 2 - (text_len / 2);

    rvm.drawText(text, pos_x, 140 / 2, 1);
    rvm.refreshScreen();
}

About

A toy fantasy console which uses RV32I as CPU

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages