Skip to content

Instantly share code, notes, and snippets.

@Blecki
Created January 24, 2013 05:13
Show Gist options
  • Select an option

  • Save Blecki/4617835 to your computer and use it in GitHub Desktop.

Select an option

Save Blecki/4617835 to your computer and use it in GitHub Desktop.
struct num32
{
high;
low;
}
function compare32(a:num32, b:num32)
{
if (a.high != b.high) return 0;
if (a.low != b.low) return 0;
return 1;
}
static lem = -1;
static lem_hardware_id[2] = { 0x7349, 0xf615 };
static lem_vram[384];
function detect_lem()
{
local num_hardware = 0;
asm (B = &num_hardware)
{
HWN [B]
}
local n = 0;
while (n < num_hardware)
{
local hardware_id[2];
asm ( A = n; I = hardware_id )
{
HWQ A
SET [I + 0x0001], A
SET [I], B
}
if (compare32(hardware_id, lem_hardware_id) != 0)
{
lem = n;
}
n += 1;
}
}
detect_lem();
asm (C = lem; B = lem_vram)
{
SET A, 0
HWI C
}
local str = "Hello World!";
local str_len = *str; //Strings are stored in length prefix form.
local i = 0;
while (i < str_len)
{
lem_vram[i] = 0xF000 | str[i + 1];
i += 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment