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 64c.js
// 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++) {
View linalg.ts
interface Matrix3x3 {
v: number[];
}
function c(a: Matrix3x3, col: number): number[] {
return [a.v[col], a.v[col + 3], a.v[col + 6]];
}
function r(a: Matrix3x3, row: number): number[] {
return [a.v[row*3+0], a.v[row*3+1], a.v[row*3+2]];
@nurpax
nurpax / package.json
Created Dec 24, 2018
run .ts file in petmate (pets target)
View package.json
"scripts": {
"dev": "yarn react-scripts start",
"build": "react-scripts build",
"start": "concurrently \"cross-env BROWSER=none yarn react-scripts start\" \"wait-on http://localhost:3000 && electron .\"",
"debug": "concurrently \"cross-env BROWSER=none yarn react-scripts start\" \"wait-on http://localhost:3000 && electron --remote-debugging-port=9223 .\"",
"package": "electron-builder --dir",
"dist": "npx build --x64 --macos --win --linux --c.extraMetadata.main=build/electron.js -p never",
"pets": "ts-node -O '{\"module\": \"commonjs\"}' ./src/utils/importers/png2petscii"
},
View settings.ts
const actionCreators = {
load: (data: SettingsJson) => createAction(LOAD, fromJson(data)),
saveEditsAction: () => createAction(SAVE_EDITS),
cancelEdits: () => createAction(CANCEL_EDITS),
setPalette: (data: SetPaletteArgs) => createAction(SET_PALETTE, data),
setSelectedColorPaletteName: (data: SetSelectedColorPaletteNameArgs) => createAction(SET_SELECTED_COLOR_PALETTE, data),
setIntegerScale: (data: SetIntegerScaleArgs) => createAction(SET_INTEGER_SCALE, data)
};
type Actions = ActionsUnion<typeof actionCreators>
@nurpax
nurpax / sprite_array_clear_loop.asm
Last active Oct 28, 2018
sprite array clear loop
View sprite_array_clear_loop.asm
; Note: optimized to rely on dst ptr to be 64-byte aligned (as sprites are)
clear_writer_sprite_row: {
+mov16($30, zp_sprite_dst)
ldx #num_writer_sprites
sprite_loop:
lda $31
sta dstp0-1
sta dstp1-1
sta dstp2-1
View example.ts
export interface Node {
loc: SourceLoc;
}
export type Expr = any | Ident | Literal
export type Stmt =
StmtInsn
| StmtSetPC
| StmtAlign
| StmtData
View spriteplugin.js
const CW = 6;
const CH = 7;
function readSprites({readFileSync, resolveRelative}, filename) {
const buf = readFileSync(resolveRelative(filename.lit));
const numSprites = buf.readUInt8(4);
const data = [];
for (let i = 0; i < numSprites; i++) {
const offs = i*64+9;
const bytes = [];
View tasks.json for assembly
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "c64jasm build & run",
"type": "shell",
"command": "c64jasm main.asm --out main.prg && x64 main.prg",
"problemMatcher": "$c64jasm"
View irq.asm
FALSE=0
TRUE=1
irq0_line = 100
irq1_line = 150
!macro basic_start(addr) {
* = $801
!byte $0c
!byte $08
View test.asm
!macro basic_start(addr) {
* = $801
!byte $0c
!byte $08
!byte $00
!byte $00
!byte $9e
!if (addr >= 10000) {
!byte $30 + (addr/10000)%10
}
You can’t perform that action at this time.