Skip to content

Instantly share code, notes, and snippets.

@Blecki
Created February 4, 2013 02:07
Show Gist options
  • Select an option

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

Select an option

Save Blecki/4704656 to your computer and use it in GitHub Desktop.
local screen = 0x8000; // This won't actually work without a lem device already initialized
local hello = "Hello World!";
local i = 0;
while (i < *hello)
{
screen[i] = 0xF000 | hello[i + 1];
i += 1;
}
SET J, SP
; Entering blocknode emit
; bypassed
; local screen = 0x8000;
SET PUSH, 0x8000
; local hello = "Hello World!";
SET PUSH, L1_STRING
; local i = 0;
SET PUSH, 0x0000
; while (i < *hello)
:L2BEGIN_WHILE
SET B, [0xFFFE+J]
SET B, [B]
SET C, [0xFFFD+J]
IFL C, B
SET PC, L3YES
SET PC, L4END_WHILE
:L3YES
; Entering blocknode emit
; screen[i] = 0xF000 | hello[i + 1];
SET B, 0xF000
SET C, [0xFFFD+J]
ADD C, 0x0001
ADD C, [0xFFFE+J]
SET C, [C]
BOR B, C
SET C, [0xFFFD+J]
ADD C, [0xFFFF+J]
SET [C], B
; i += 1;
SET B, 0x0001
ADD [0xFFFD+J], B
; Leaving blocknode emit
SET PC, L2BEGIN_WHILE
:L4END_WHILE
; Leaving blocknode emit
:L0main_footer
SET PC, L0main_footer
:L1_STRING DAT 0x000C 0x0048 0x0065 0x006C 0x006C 0x006F 0x0020 0x0057 0x006F 0x0072 0x006C 0x0064 0x0021
:ENDOFPROGRAM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment