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 / 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
@BrentFarris
BrentFarris / http.js
Created June 25, 2017 02:33
JavaScript HTTP request thing
var http = {
xhr: function () {
if (typeof XMLHttpRequest !== 'undefined') {
return new XMLHttpRequest();
}
var versions = [
"MSXML2.XmlHttp.6.0",
"MSXML2.XmlHttp.5.0",
"MSXML2.XmlHttp.4.0",