Skip to content

Instantly share code, notes, and snippets.

all: menu.hex
menu.o: menu.c calculator.h digilines.h games.h
clang -target riscv32-none-elf -I../rvcontroller-libraries -march=rv32imacb_zicntr_zicond_zicsr_zifencei_zihintpause_zilsd_zclsd_zabha_zacas_zbkb_zbkx -ffreestanding -O3 -c -o menu.o menu.c
calculator.o: calculator.c
clang -target riscv32-none-elf -I../rvcontroller-libraries -march=rv32imacb_zicntr_zicond_zicsr_zifencei_zihintpause_zilsd_zclsd_zabha_zacas_zbkb_zbkx -ffreestanding -O3 -c -o calculator.o calculator.c
digilines.o: digilines.c
clang -target riscv32-none-elf -I../rvcontroller-libraries -march=rv32imacb_zicntr_zicond_zicsr_zifencei_zihintpause_zilsd_zclsd_zabha_zacas_zbkb_zbkx -ffreestanding -O3 -c -o digilines.o digilines.c
/* Conway's Game of Life for RVController
* A product of Advanced Mesecons Devices, a Cheapie Systems company
* This is free and unencumbered software released into the public domain.
* See http://unlicense.org/ for more information */
#include <stdint.h>
#include <stdbool.h>
#include "rvcontroller-ecalls.h"
bool field[176] = {false}; // 22*8, extra pixel on each edge will just always be false, makes generation logic easier
/* Drawer Capacity Calculator for RVController
* A product of Advanced Mesecons Devices, a Cheapie Systems company
* This is free and unencumbered software released into the public domain.
* See http://unlicense.org/ for more information */
#include <stdint.h>
#include <stdbool.h>
#include "rvcontroller-ecalls.h"
#define BASE_SLOTS 32
--RVController Loader
--A product of Advanced Mesecons Devices, a Cheapie Systems company
--This is free and unencumbered software released into the public domain.
--See http://unlicense.org/ for more information
local function formspec_escape(text)
local ret = ""
local badchars = {
["\\"] = true,
["["] = true,
#include <stdint.h>
#include <stdbool.h>
//My library for the platform-specific bits really needs a better name than "init"
#include "init.h"
bool streq(char *a, char *b) {
for (int i=0;a[i] != 0 || b[i] != 0;i++) {
if (a[i] != b[i]) {
return false;
}
local a = tonumber(arg[1])
local b = tonumber(arg[2])
--Break 32-bit arguments into 16-bit pieces
local alow = a%2^16
local ahigh = math.floor(a/2^16)
local blow = b%2^16
local bhigh = math.floor(b/2^16)
--Multiply 16x16-bit numbers to get 32-bit partial products
li a7,134 # Clear digilines buffer
ecall
restart:
# Hardware initialization
# Make sure light is off
li a7,129 # Send digilines message
la a0,lightchannel
la a1,lightoffmsg
restart:
rdtime t3 # Get the time the program was started at
li a7,11 # Print character
li a0,0xa # \n
ecall
li t0,0 # Number of guesses
# Get a random number for the player to guess
li a7,128 # Get random integer
--RVController has moved!
--New location: https://cheapiesystems.com/git/rvcontroller/
--The following program is a snapshot of the current state at the time of the move and will no longer be updated.
--RVController
--A product of Advanced Mesecons Devices, a Cheapie Systems company
--This is free and unencumbered software released into the public domain.
--See http://unlicense.org/ for more information
local function implodebits(bits,count,signed)
local negative = false
if signed then
negative = bits[count-1]
end
local out = 0
for i=0,count-1 do
if bits[i] then out = out + (2^i) end
end
if negative then out = out - (2^count) end