Skip to content

Instantly share code, notes, and snippets.

View BrentFarris's full-sized avatar
✝️
Some Assembly required

Brent Farris BrentFarris

✝️
Some Assembly required
View GitHub Profile
ffmpeg -r 30 -f image2 -c:v ppm -s 640x480 -start_number 0 -i frame-%%d.ppm -vcodec libx264 -crf 25 -pix_fmt yuv420p baked.mp4
int threadsPerBlock = blockDim.x * blockDim.y * blockDim.z;
int blocksPerGrid = gridDim.x * gridDim.y * gridDim.z;
int threadPositionInBlock = threadIdx.x +
blockDim.x * threadIdx.y +
blockDim.x * blockDim.y * threadIdx.z;
int blockPosInGrid = blockIdx.x +
gridDim.x * blockIdx.y +
gridDim.x * gridDim.y * blockIdx.z;
BITS 16 ; Instruct the system this is 16-bit code
; This is the entry point, nothing should happen before this
; other than setting the instruction size
main:
mov ax, 07C0h ; Setup 4KB stack space after this bootloader
add ax, 288 ; (4096+515) / 16 bytes (aligned) per paragraph
cli ; Disable interrupts (solvs old DOS bug)
mov ss, ax ; Assign current stack segment
mov sp, 4096 ; Setup our stack pointer
@BrentFarris
BrentFarris / parse_ast.go
Created October 14, 2023 21:03
Go Generate and AST
fs := token.NewFileSet()
ast, err := parser.ParseFile(fs, filePath, orFileSrc, parser.ParseComments)
@BrentFarris
BrentFarris / README.md
Last active June 18, 2023 03:23
Getting Go setup with SDL for game development video - https://youtu.be/yxK_dwJ3Bbc
@BrentFarris
BrentFarris / SurveyMonkeyRadioButtonCheat.js
Created February 9, 2015 08:55
Survey Monkey Radio Button Cheat
// This is an array of selected responses to the list of questions to seem more human. It will randomly select one of the indexes. This was used when each question had 3 bubbles per-question
var answers = [[2, 1], [1, 0], [1, 0], [2, 1], [0, 1, 2], [1, 0], [2, 1], [0, 1, 2], [2, 1], [0, 1], [0, 1, 2], [0, 1, 2], [2, 1], [0, 1, 2], [2, 1], [0, 1], [0, 1, 2], [0, 1], [2, 1], [0, 1, 2], [2, 1], [1, 0], [2, 1], [0, 1, 2], [2, 1], [2, 1], [0, 1, 2], [0, 1, 2], [1, 0], [2, 1], [1, 0], [2, 1], [0, 1, 2]];
// How many radio buttons there are per question
var radiosPerQuestion = 3;
function Check(answers)
{
// Get all of the input fields
var radios = document.getElementsByTagName("input");
@BrentFarris
BrentFarris / gbsum.c
Last active November 30, 2021 04:50
Game Boy Cartridge ROM Checksum code
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
int main(int argc, char** argv) {
FILE* fp = fopen(argv[1], "rb");
if (fp == NULL) {
printf("Failed to open the file to read: %s\n", argv[1]);
return -1;
}
@BrentFarris
BrentFarris / sum.c
Last active November 19, 2021 16:52
The code I used for my "Hacking Pokemon Red to say Hello! (Nintendo Game Boy)" YouTube video - https://youtu.be/Vm4UpRkBD5g
#include <stdio.h>
#include <stdint.h>
int main(int argc, char** argv) {
FILE* fp = fopen(argv[1], "rb");
if (fp == NULL) {
return -1;
}
fseek(fp, 0L, SEEK_END);
size_t len = ftell(fp);
@BrentFarris
BrentFarris / _README.md
Last active March 6, 2021 18:58
Gameboy assembly programming environment setup - Brent video tutorial

Video tutorial URLs:

Below are a list of the download files we use in this tutorial for setting up our environment for Gameboy development.

Required for the tutorial:

*=$0801
!byte $01,$08,$0b,$08,$01,$00,$9e,$32,$30,$36,$31,$00,$00,$00
lda #$09
sta $08f0
brk