Skip to content

Instantly share code, notes, and snippets.

@nurpax
Last active March 26, 2019 22:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nurpax/a44d91a4c65f9a7a9cf44165f24c960c to your computer and use it in GitHub Desktop.
Save nurpax/a44d91a4c65f9a7a9cf44165f24c960c to your computer and use it in GitHub Desktop.
// loader for .64c font files
module.exports = ({readFileSync, resolveRelative}, filename) => {
const buf = readFileSync(resolveRelative(filename.lit));
const numChars = (buf.length - 2) / 8;
const data = [];
let offs = 2;
for (let i = 0; i < numChars; i++) {
const c = [];
for (let bi = 0; bi < 8; bi++) {
c.push(buf.readUInt8(offs++));
}
data.push(c);
}
return {
numChars,
data
};
}
; c64jasm example
!use "./plugins/64c" as load64c
!let intro_architect_10 = load64c("../assets/intro-architect_10.64c")
!align 2048
architect_font:
+fix_architect_font(intro_architect_10)
!macro fix_architect_font(charset) {
!for i in range(64) {
!if (i == $20) {
!fill 8, 0
} elif (i == $2c) { ; ','
!byte %00000000
!byte %00000000
!byte %00000000
!byte %00000000
!byte %00000000
!byte %00110000
!byte %01100000
!byte %00000000
} elif (i == $2e) { ; '.'
!byte %00000000
!byte %00000000
!byte %00000000
!byte %00000000
!byte %00000000
!byte %01100000
!byte %01100000
!byte %00000000
} elif (i == $21) { ; '!'
!byte %01100000
!byte %01100000
!byte %01100000
!byte %01100000
!byte %01100000
!byte %00000000
!byte %01100000
!byte %00000000
} elif (i == $2d) { ; '-'
!byte %00000000
!byte %00000000
!byte %00000000
!byte %01111100
!byte %01111100
!byte %00000000
!byte %00000000
!byte %00000000
} elif (i == $2f) { ; '/'
!byte %00000000
!byte %00000100
!byte %00001100
!byte %00011000
!byte %00110000
!byte %01100000
!byte %01000000
!byte %00000000
} elif (i == $3a) { ; ':'
!byte %00000000
!byte %01100000
!byte %01100000
!byte %00000000
!byte %01100000
!byte %01100000
!byte %00000000
!byte %00000000
} elif (i == $3f) { ; ':'
!byte %01111100
!byte %01111100
!byte %01001100
!byte %00111000
!byte %00110000
!byte %00000000
!byte %00110000
!byte %00000000
} else {
!byte charset.data[i]
}
}
; $40
!fill 8, $ff
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment