Skip to content

Instantly share code, notes, and snippets.

Janne Hellsten nurpax

Block or report user

Report or block nurpax

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View c64.asm
!filescope c64
!macro basic_start(addr) {
* = $801
!byte $0c, $08, $00, $00, $9e
!for d in [10000, 1000, 100, 10, 1] {
!if (addr >= d) {
!byte $30 + (addr/d)%10
}
}
@nurpax
nurpax / context.js
Last active Aug 10, 2019
zero page allocation context example for c64jasm
View context.js
module.exports = {
create: ({}, initial) => {
const stack = [initial];
return {
push: (elt) => {
stack.push(elt)
},
pop: () => stack.pop(),
top: () => {
return stack[stack.length-1];
@nurpax
nurpax / README.md
Last active Aug 10, 2019
c64 size optimization -- lines
View README.md

C64 "lines" size optimization contents

Deadline: midnight Finnish time on Monday, Aug 12, 2019.

Problem: make a PRG file that draws two crossing lines in C64 text mode in as few bytes as possible. The output should look exactly like this:

reference_output.png

(Note: the reference includes the black border. See the reference code for details.)

@nurpax
nurpax / main.asm
Last active Aug 3, 2019
6502 lines size optimization
View main.asm
!include "c64.asm"
+c64::basic_start(entry)
entry: {
lda #0
sta $d020
sta $d021
@nurpax
nurpax / Load_Line.sid
Last active Jul 29, 2019
c64jasm content example in a gist
@nurpax
nurpax / main.asm
Last active Jul 29, 2019
c64jasm sprites example in a gist
View main.asm
!include "c64.asm"
; C64jasm example program
;
; see https://github.com/nurpax/c64jasm/tree/master/examples for more
!let SIN_LEN = 64
!let zptmp0 = $20
@nurpax
nurpax / main.asm
Last active Jul 26, 2019
c64jasm gist example 1
View main.asm
!include "c64.asm"
+c64::basic_start(entry)
entry: {
lda #0
}
; try includes
!include "other.asm"
View readgist.js
const urlParams = new URLSearchParams(window.location.search);
const myParam = urlParams.get('gist_id');
console.log(myParam);
console.log(process.env.PUBLIC_URL);
fetch('https://api.github.com/gists/5cbb8438e12add2d8cd1723c7459e0ec')
.then(resp => resp.json())
.then(json => console.log(json));
View zp_object_literal.asm
!include "c64.asm"
+c64::basic_start(entry)
!let zp = {
tmp0: $20,
tmp1: $22,
sprite_idx: $24
}
View sneakier_memo.ts
const _getExpensiveThing = () => {
const c: any = getExpensiveThing;
if (c.cache) {
return c.cache;
}
c.cache = expensiveThing();
return c.cache;
}
You can’t perform that action at this time.