Skip to content

Instantly share code, notes, and snippets.

@mgcaret
mgcaret / main.go
Created July 1, 2022 16:27
gfxtest
package main
import (
"fmt"
"image"
"image/color"
"image/draw"
"github.com/fogleman/gg"
"golang.org/x/exp/shiny/driver"
@mgcaret
mgcaret / typechanger
Created June 14, 2022 23:50
Applesoft-based ProDOS file type changer
10 REM By MG
100 GOSUB 900
200 INPUT "Filename? (none to exit): ";F$
210 IF LEN (F$) = 0 THEN END
220 GOSUB 800
230 GOSUB 700
240 CALL 768
250 E = PEEK (778)
260 IF E > 0 THEN PRINT "MLI error: ";E: GOTO 200
270 PRINT "The file type of ";F$;" is "; PEEK (779 + 4)
@mgcaret
mgcaret / gist:c8505fc29f21c296b8bd5f8bd1ce6b26
Last active November 9, 2021 19:41
DOES> example/implementation in OF816.

References/notes: DOES> compilation semantics: https://github.com/mgcaret/of816/blob/master/asm/forth-dictionary.s#L5835-L5848

DOES> execution semantics: https://github.com/mgcaret/of816/blob/master/asm/forth-dictionary.s#L5797-L5831

JSL = jump to subroutine long, leaves a 24-bit return address on the return stack

Execution semantics for some words have headers omitted in OF816 to save memory. SEE replaces the name with ^address.

Each word starts with machine code. All secondaries start with a JSL opcode (0x22)

@mgcaret
mgcaret / japh.pl
Last active March 4, 2021 16:38
JAPH
#!/usr/bin/perl
$l=($s='rtlntr"" ,h ahkP trcr\ain;eepeusnoJ')=~y///c;for(1..$l){@a=sort@a;
for(0..$l-1){$a[$_]=substr($s,$_,1).$a[$_]}}for(@a){eval$_ if/;$/}
@mgcaret
mgcaret / gist:2e8442dd5bf0ad2367b284435bad9452
Created May 17, 2019 23:04
Screen editor for OF816 in FCode source...
start1 decimal
." OF816 screen EDITOR by M.G. "
s" get-current vocabulary EDITOR also EDITOR definitions" evaluate
headers
@mgcaret
mgcaret / mgforth.dx.s
Created October 29, 2018 19:58
MG's Davex Forth interpreter, (likely) Forth 2012 core word set compliant
; %help
; Davex Forth interpeter.
;
; syntax: dxforth
;
; This is a Forth system implementing the Forth 2012 Core Word Set
; a subset of the Core Extensions word set, the Exception word set,
; and select words from other word sets.
;
; Additionally, words supporting Davex and ProDOS are provided.
@mgcaret
mgcaret / fizzbuzz.s
Created May 23, 2017 17:53
FizzBuzz!
; originally written by Dagen Brock
; https://gist.github.com/digarok/12ce4a12993c4c4444c0819e9fcc752a
; Reworked by M.G.
; changelog:
; * port to ca65
; * removed some redundancies
; * trade +1 byte of ZP usage to eliminate special case for "FizzBuzz"
; * improved output formatting
; * converted all addresses to labels
@mgcaret
mgcaret / NS.CLOCK.SYSTEM.s
Last active September 4, 2022 13:34
NS.CLOCK.SYSTEM.s - Complete disassembly of Apple II No-Slot Clock driver/driver loader
; Fully disassembled and analyzed source to SMT
; NS.CLOCK.SYSTEM by M.G. - 04/20/2017
; Assembles to a binary match for SMT code if
; IncludeJunk is set, see the .if IncludeJunk for details.
; other notes:
; * uses direct block access to read volume directory,
; so won't launch from an AppleShare volume.
; Build instructions:
@mgcaret
mgcaret / DCLOCK.SYSTEM.s
Last active September 1, 2021 16:41
Complete disassembly of DCLOCK.SYSTEM - AE DClock ProDOS driver
; Fully disassembled and analyzed source to AE
; DCLOCK.SYSTEM by M.G. - 04/18/2017
; Assembles to a binary match for AE code unless
; FIX_BUGS is set.
; speaking of FIX_BUGS, there are critical bugs in the
; original AE code:
; * When driver loader is initially probing it corrupts the
; Apple //c Memory Expansion Card:
; - it saves, but fails to restore, data at address $080000
@mgcaret
mgcaret / mig.insp.lst
Last active April 5, 2017 16:59
MIG Inspector
ca65 V2.15
Main file : mig.insp.s
Current file: mig.insp.s
000000r 1 ; MIG Inspector by M.G.
000000r 1
000000r 1 ; Displays the MIG RAM from the Apple IIc Plus
000000r 1 ; this is used by the 3.5 drive firmware and the
000000r 1 ; accelerator.
000000r 1