Skip to content

Instantly share code, notes, and snippets.

@digarok
digarok / FRIDAY.BAS
Created May 25, 2018 14:56
Applesoft BASIC one-liner for fans of Friday
GR:COLOR=15:HLIN 12,28 AT 9:FOR I=10 TO 35:HLIN 10,30 AT I:NEXT I:HLIN 12,28 AT 36: HLIN 16,24 AT 37:HLIN 30,34 AT 14:HLIN 14,34 AT 30:VLIN 15,29 AT 35:COLOR=8:HLIN 14,26 AT 12:HOME:VTAB 22:?"HAPPY FRIDAY"
@digarok
digarok / svg_to_line.php
Created April 16, 2018 13:10
PHP script that can parse just enough of an SVG to get line coordinates and scale them to integer values for use on 320x200 Apple IIgs screen.
<?php
// hi plamen ;)
class Line
{
public $internal_x1 = 0;
public $internal_y1 = 0;
public $internal_x2 = 0;
public $internal_y2 = 0;
public function svgStrParse($s) {
org $300
clc
xce
rep #$30 ; full 16 bit registers
pea #$000B ; push literal "000B" on stack
ldx #$2303 ; set toolcall
jsl E10000 ; call tool "03" = Misc. Tools, function "23" = IntSource
* We have just made a call to the IIgs toolbox routine called IntSource.
* IntSource enables or disables interrupts based on the bit pattern we
@digarok
digarok / archimedes.bas
Last active February 19, 2018 17:14
ARCHIMEDES SPIRAL from Analog Magazine, adapted for Apple II
100 REM ARCHIMEDES SPIRAL
110 REM
120 REM ANALOG MAGAZINE
130 REM
140 HGR2: HCOLOR =3:XS=0.85:YS=0.9
150 XP=139:XR=4.71238905:XF=XR/XP
160 FOR ZI=-64 TO 64
170 ZT=ZI*2.25:ZS=ZT*ZT
180 XL=INT(SQR(20736-ZS)+0.5)
@digarok
digarok / testhires.bas
Created January 5, 2018 23:31
Screen test of hires for Applesoft BASIC (Moiré pattern)
10 HGR2
20 HCOLOR= 1:Y0 = 89:Y1 = 0:YS = - 3:X0 = 0:CX = 139:CY = 89: GOSUB 95
25 HCOLOR= 2:X0 = 0:X1 = 139:XS = 4:Y0 = 0:CX = 139:CY = 89: GOSUB 85
30 HCOLOR= 3:X0 = 140:X1 = 279:Y0 = 0:XS = 3:CX = 140:CY = 89: GOSUB 85
35 HCOLOR= 7:Y0 = 0:Y1 = 89:X0 = 279:YS = 3:CX = 140:CY = 89: GOSUB 95
40 HCOLOR= 5:Y0 = 90:Y1 = 179:X0 = 279:YS = 3:CX = 140:CY = 90: GOSUB 95
45 HCOLOR= 6:X0 = 279:X1 = 140:Y0 = 179:XS = - 5:CX = 140:CY = 90: GOSUB 85
50 HCOLOR= 3:X0 = 139:X1 = 0:Y0 = 179:XS = - 5:CX = 139:CY = 90: GOSUB 85
55 HCOLOR= 7:Y0 = 179:Y1 = 90:X0 = 0:YS = - 5:CX = 139:CY = 90: GOSUB 95
60 REM dividers
@digarok
digarok / gs_pal_color_example.s
Last active December 13, 2017 14:33
65816 assembly routine to set a color in the Apple IIgs palette table without using temp variables (uses stack addition)
mx %00 ; full 16-bit registers
lda #$0000 ; palette 0
ldx #$0001 ; color 1
ldy #$033F ; blue (r=3,g=3,b=F)
jsr SHR_SETPALIDXCOLOR
jmp Quit ; or whatever comes next
@digarok
digarok / apple_ii_hires_lines.py
Last active November 28, 2017 14:59
prints out the base addresses of the apple ii hi res screen
addrs = [0x2000, 0x2028, 0x2050] # 3) 'top','middle','bottom' base addresses
for addr in addrs:
for b in range(0, 8): # 2) and those 8-line bars are striped each 0x80 bytes
lineaddr = addr
for l in range(0, 8): # 1) 8 consecutive lines are spaced by 0x400 bytes
print(hex(lineaddr))
lineaddr = lineaddr + 0x400
addr = addr + 0x80
org $300 ;Tiny program so we'll use the page at $300
COUT equ $FDED ;equates for two firmware routines we'll be using
PRHEX equ $FDDA ;COUT prints a character, PRHEX prints a 2-digit hex value
Init lda #0 ;starting number (will increment at beginning of loop)
sta $0
MainLoop sed ;use decimal mode to increment
lda $0
clc
@digarok
digarok / fs_bas_dis.s
Created January 26, 2017 21:16
This is a disassembly of the FutureShock controller driver for AppleSoft BASIC as found in the FS.ASM file on this game disk. http://www.whatisthe2gs.apple2.org.za/futureshock-3d
*** FutureShock Controller Applesoft BASIC Driver
***
*** Disassembly by Dagen Brock 1/26/
***
*** This comes from the file /FUTURESHOCK/TOOLKIT/FS.ASM
*** Which can be found in the disk image of FutureShock for the Apple IIgs
*** ( You may find a copy here: http://www.whatisthe2gs.apple2.org.za/futureshock-3d )
***
*** This version was disassembled (with a little help) from:
*** The Flaming Bird Disassembler by Phoenix Team
* KFSHIRT - 2016-01-14 9:56PM
* Dagen Brock <[email protected]>
org $2000
jmp VANITY_ENTRY ; JUMP OVER TO PUT START AT 2016
PRE_INIT jsr CLRSCR
FRAME_INIT
lda #XINIT