Skip to content

Instantly share code, notes, and snippets.

@appblue
appblue / AmigaIntroStartup.md
Last active August 30, 2024 17:11
Amiga 4K Intro Template

Example m68k startup code for 4k demo on Amiga

;              T         T               T

; Compact demo-startup by Blueberry/Loonies
; Version 1.5, October 7, 2014
; Public Domain

;; ********** System constants **********
@appblue
appblue / gensin.clj
Last active May 12, 2024 10:14
Clojure - generating binary data big/little endian
(defn get-nth-byte [v n]
(bit-and 0xff (bit-shift-right v (* 8 n))))
(defn pack-little-endian [v n]
(let [l []]
(for [i (range n)]
(into (get-nth-byte v i) l))))
(defn pack-big-endian [v n]
(let [l []]
@appblue
appblue / hex.asm
Created January 8, 2024 23:06
convert number to hex in x64 assembly
; fasm demonstration of writing 64-bit ELF executable
; (thanks to František Gábriš)
; syscall numbers: /usr/src/linux/include/asm-x86_64/unistd.h
; parameters order:
; r9 ; 6th param
; r8 ; 5th param
; r10 ; 4th param
; rdx ; 3rd param
@appblue
appblue / nim-setup.lua
Created November 4, 2023 23:58
NeoVim LSP Setup
vim.api.nvim_create_autocmd({'BufNewFile', 'BufRead'}, {
pattern = {'*.nim', },
-- command = 'set shiftwidth=4',
callback = function ()
vim.lsp.start({
name='nimlsp',
cmd={'/Users/$USER/.nimble/bin/nimlsp.cmd'},
root_dir='~'
})
vim.lsp.buf_attach_client(0, 1)
@appblue
appblue / Yacht.txt
Created October 14, 2023 09:41 — forked from cbmeeks/Yacht.txt
M68000 Cycle Counting
Yacht
(Yet Another Cycle Hunting Table)
-------------------------------------------------------------------------------
Forewords :
-------------------------------------------------------------------------------
This document is based on :
- 9th Edition of M68000 8-16-32-bit Microporcessor User's Manual
(Motorola, 1993) (laterly refered as M68000UM)
@appblue
appblue / Sprites.daric
Created August 30, 2023 23:18
Daric Sample Code
option base 1
if @main then
mode -1, -1, windowed or banked
sprites()
endif
def sprites()
spriterenderpoint 0
bankedon
@appblue
appblue / scales.lisp
Last active June 27, 2023 07:35
Scales and Guitar
(defvar *notes*
'("C" "Db" "D" "Eb" "E" "F" "Gb" "G" "Ab" "A" "Bb" "B"))
;; 0 1 2 3 4 5 6 7 8 9 10 11
(defvar *intervals*
'("R" "2b" "2" "3b" "3" "4" "5b" "5" "5#" "6" "7b" "7"))
(defvar *scales*)
(setf *scales*
'(;; MAJOR SCALES
@appblue
appblue / parse.lisp
Created January 25, 2023 02:14
Rudimentary file reading and string processing
;;;Sets up the file for use
(defparameter *my-file* (open "~/_work_/parse.lisp"))
;;;Reads the entire file printing each line, (loopfile file)
(defun loopfile (x)
(loop for line = (read-line x nil)
while line do (print line)))
;; Strings are vectors. Vectors are sequences.
;; Strings are vectors and sequences. So all operations for them apply:
@appblue
appblue / sdlanim.c
Created December 2, 2022 00:08
SDL2 Animation in ANSI C
// to compile and run: gcc -o Mikas t.c -lsdl2 && ./Mikas
//
#include <stdio.h>
#include <stdbool.h>
#include <SDL2/SDL.h>
#include <stdlib.h>
#define WINDOW_WIDTH 800
#define WINDOW_HEIGHT 600
#define RECT_SIZE 64