Skip to content

Instantly share code, notes, and snippets.

@digarok
digarok / dechex.s
Created January 16, 2016 04:50
Some code I used for doing decimal <-> hex conversions in my Apple IIgs memory testing app. This is actually straight 6502 code. Max int $FFFF.
* x/y = high/low
BINtoBCD stx BIN
sty BIN+1
jsr BINBCD16
ldx BCD
ldy BCD+1
rts
BCDtoBIN
stx BCD
/*
GSport - an Apple //gs Emulator
Copyright (C) 2010 - 2012 by GSport contributors
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
@digarok
digarok / .gitlab-ci.yml
Created February 6, 2016 15:37
My Gitlab CI Runner file for gsplus emulator build on Ubuntu
before_script:
- sudo apt-get update -qq && apt-get install -y -qq g++ libpcap0.8-dev libx11-dev libxext-dev
build:
script:
- cd src
- ln -s vars_x86linux_x11 vars
- make clean ; make
* KFSHIRT - 2016-01-14 9:56PM
* Dagen Brock <dagenbrock@gmail.com>
org $2000
jmp VANITY_ENTRY ; JUMP OVER TO PUT START AT 2016
PRE_INIT jsr CLRSCR
FRAME_INIT
lda #XINIT
@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
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 / 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
@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 / 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 / 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)