Hacker News new | ask | show | jobs
by 90s_dev 320 days ago
Shorter description:

It's like love2d but with a pico8 style screen and the code is entirely asm.

Download at https://hram.dev/hram-110.zip for version with hot code reloading.

Write event handler function in native assembly at appdata\hram\hsig.s that interacts with keyboard/mouse and 128x72 8-bit screen (red/green only).

Uses native jit, no interpreter. So if you write bad assembly it will segfault! But it's okay, just restart hram.exe (~360 kb) and try again.

1 comments

Got one report on reddit that it's not creating the default file in appdata and just using the one in memory that it thinks it's writing. If you have the same issue, here's the whole sample asm file that you can write to appdata\hram\hsig.s before you open hram.exe:

    ; switch on arg
    cmp cl, 4
    je MouseDown
    cmp cl, 5
    je MouseUp

    ; if mouse not down then just skip
    mov al, byte [0x33000]
    test al, 1
    jz Skip

    ; draw green at mouse
    mov rax, 0
    mov rbx, 0
    mov al, [0x30007]
    mov bl, 128
    mul bl
    add al, [0x30006]
    mov byte ptr [rax+0x30100], 0x0f

    ; call blit()
    sub rsp, 24
    call [0x30030]
    add rsp, 24

    Skip:
    ret

    ; store mouse-down info

    MouseDown:
    mov byte ptr [0x33000], 1
    ret

    MouseUp:
    mov byte ptr [0x33000], 0
    ret
Fwiw I do not know assembly! This is the most complicated asm I've ever written! So if it's got dumb errors, please let me know and I'd be glad to fix them in the sample code!