Initial commit

This commit is contained in:
blondie7575 2017-07-28 17:11:25 -05:00
parent 38350af665
commit 4c8be2d8aa
11 changed files with 332 additions and 46 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/GSCats.xcodeproj/xcuserdata/qd.xcuserdatad/xcschemes/GSCats.xcscheme
/gscats.lst

BIN
AppleCommander.jar Normal file

Binary file not shown.

View File

@ -6,10 +6,23 @@
objectVersion = 46;
objects = {
/* Begin PBXFileReference section */
70E9D85F1F2BD95400555C19 /* equates.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = equates.s; sourceTree = "<group>"; };
70E9D8601F2BD95400555C19 /* graphics.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = graphics.s; sourceTree = "<group>"; };
70E9D8611F2BD95400555C19 /* gscats.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gscats.s; sourceTree = "<group>"; };
70E9D8621F2BD95400555C19 /* macros.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = macros.s; sourceTree = "<group>"; };
70E9D8631F2BD95400555C19 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXGroup section */
70E9D8541F2BD8EF00555C19 = {
isa = PBXGroup;
children = (
70E9D85F1F2BD95400555C19 /* equates.s */,
70E9D8601F2BD95400555C19 /* graphics.s */,
70E9D8621F2BD95400555C19 /* macros.s */,
70E9D8611F2BD95400555C19 /* gscats.s */,
70E9D8631F2BD95400555C19 /* Makefile */,
);
sourceTree = "<group>";
};
@ -184,6 +197,7 @@
70E9D85E1F2BD8EF00555C19 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};

View File

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

35
Makefile Normal file
View File

@ -0,0 +1,35 @@
#
# Makefile
# GS Cats
#
# Created by Quinn Dunki on 7/14/15.
# One Girl, One Laptop Productions
# http://www.quinndunki.com
# http://www.quinndunki.com/blondihacks
#
CL65=cl65
AC=AppleCommander.jar
ADDR=6000
PGM=gscats
all: $(PGM)
$(PGM):
@PATH=$(PATH):/usr/local/bin; $(CL65) -t apple2enh --cpu 65816 --start-addr $(ADDR) -l$(PGM).lst $(PGM).s
java -jar $(AC) -d $(PGM).2mg $(PGM)
java -jar $(AC) -p $(PGM).2mg $(PGM) BIN 0x$(ADDR) < $(PGM)
cp $(PGM).2mg ~/Library/Application\ Support/Sweet16/Disk\ Images
rm -f $(PGM)
rm -f $(PGM).o
osascript V2Make.scpt $(PROJECT_DIR) $(PGM)
clean:
rm -f $(PGM)
rm -f $(PGM).o
rm ~/Library/Application\ Support/Sweet16/Disk\ Images/*

BIN
V2Make.scpt Normal file

Binary file not shown.

19
equates.s Normal file
View File

@ -0,0 +1,19 @@
TEXTCOLOR = $c022
NEWVIDEO = $c029
BORDERCOLOR = $c034
CLOCKCTL = $c034
COUT = $fded
KBD = $c000
KBDSTROBE = $c010
; Zero page locations we use (unused by Monitor, Applesoft, or ProDOS)
PARAM0 = $06
PARAM1 = $07
PARAM2 = $08
PARAM3 = $09
PARAML0 = $06 ; 16-bit versions of params
PARAML1 = $08
SCRATCH0 = $19
SCRATCH1 = $1a
SCRATCHL = $19 ; 16-bit version of scratch

94
graphics.s Normal file
View File

@ -0,0 +1,94 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; colorFill
; Fills the screen with a color (or two). Not very fast.
; A 4:4:4:4 = Palette entries
colorFill:
phx
ldx #32000
colorFillLoop:
sta $e11ffe,x
dex
dex
bne colorFillLoop
plx
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; initSCBs
; Initialize all scanline control bytes
;
; Trashes A,X
initSCBs:
lda #0
ldx #$0100 ;set all $100 scbs to A
initSCBsLoop:
dex
dex
sta $e19cfe,x
bne initSCBsLoop
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; setPaletteColor
; Set a single color in a palette
; PARAML0 = 0:Color index
; PARAML1 = 0:R:G:B
; A = Palette index
;
; Trashes X
setPaletteColor:
asl
asl
asl
asl
asl
sta SCRATCHL
lda PARAML0
asl
clc
adc SCRATCHL
tax
lda PARAML1
sta $e19e00,x
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; setPalette
; Set a single color in a palette
; PARAML0 = Pointer to 32 color bytes
; A = Palette index
;
setPalette:
SAVE_XY
asl
asl
asl
asl
asl
tax
ldy #0
setPaletteLoop:
lda (PARAML0),y
sta $e19e00,x
iny
iny
inx
inx
cmp #16
bne setPaletteLoop
RESTORE_XY
rts

BIN
gscats.2mg Normal file

Binary file not shown.

72
gscats.s Normal file
View File

@ -0,0 +1,72 @@
;
; gsshr
; GS sample application
;
; Created by Quinn Dunki on 7/9/17
;
.include "macros.s"
.include "equates.s"
.org $6000
main:
NATIVE
lda #$f0
sta TEXTCOLOR
jsr initSCBs
SHRVIDEO
lda #basePalette
sta PARAML0
lda #0
jsr setPalette
lda #$3333
jsr colorFill
jsr kbdWait
CLASSICVIDEO
EMULATION
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; kbdWait
; Waits for a keystroke
;
kbdWait:
EMULATION
kbdWaitLoop:
lda KBD
bpl kbdWaitLoop
sta KBDSTROBE
NATIVE
rts
basePalette:
.word $0F00,$00F0,$000F,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
.include "graphics.s"
; Suppress some linker warnings - Must be the last thing in the file
; This is because Quinn doesn't really know how to use ca65 properly
.SEGMENT "ZPSAVE"
.SEGMENT "EXEHDR"
.SEGMENT "STARTUP"
.SEGMENT "INIT"
.SEGMENT "LOWCODE"

96
macros.s Normal file
View File

@ -0,0 +1,96 @@
.macro EMULATION
sec ; Enable 8-bit mode
xce
.i8
.a8
.endmacro
.macro NATIVE
clc ; Enable 16-bit mode
xce
rep #$30
.i16
.a16
.endmacro
.macro SHRVIDEO
sep #$30
.i8
.a8
lda NEWVIDEO
ora #%11000001
sta NEWVIDEO
rep #$30
.i16
.a16
.endmacro
.macro CLASSICVIDEO
sep #$30
.i8
.a8
lda NEWVIDEO
and #%00111111
sta NEWVIDEO
rep #$30
.i16
.a16
.endmacro
;;;;;;;;;;
; Stack Macros
.macro SAVE_AXY ; Saves all registers
pha
phx
phy
.endmacro
.macro RESTORE_AXY ; Restores all registers
ply
plx
pla
.endmacro
.macro SAVE_AY ; Saves accumulator and Y index
pha
phy
.endmacro
.macro RESTORE_AY ; Restores accumulator and Y index
ply
pla
.endmacro
.macro SAVE_AX ; Saves accumulator and X index
pha
phx
.endmacro
.macro RESTORE_AX ; Restores accumulator and X index
plx
pla
.endmacro
.macro SAVE_XY ; Saves X and Y index
phx
phy
.endmacro
.macro RESTORE_XY ; Restores X and Y index
ply
plx
.endmacro