diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c0d5c50 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/GSCats.xcodeproj/xcuserdata/qd.xcuserdatad/xcschemes/GSCats.xcscheme +/gscats.lst diff --git a/AppleCommander.jar b/AppleCommander.jar new file mode 100644 index 0000000..f74e7cb Binary files /dev/null and b/AppleCommander.jar differ diff --git a/GSCats.xcodeproj/project.pbxproj b/GSCats.xcodeproj/project.pbxproj index a6efef7..fe1d467 100644 --- a/GSCats.xcodeproj/project.pbxproj +++ b/GSCats.xcodeproj/project.pbxproj @@ -6,10 +6,23 @@ objectVersion = 46; objects = { +/* Begin PBXFileReference section */ + 70E9D85F1F2BD95400555C19 /* equates.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = equates.s; sourceTree = ""; }; + 70E9D8601F2BD95400555C19 /* graphics.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = graphics.s; sourceTree = ""; }; + 70E9D8611F2BD95400555C19 /* gscats.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = gscats.s; sourceTree = ""; }; + 70E9D8621F2BD95400555C19 /* macros.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = macros.s; sourceTree = ""; }; + 70E9D8631F2BD95400555C19 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; +/* 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 = ""; }; @@ -184,6 +197,7 @@ 70E9D85E1F2BD8EF00555C19 /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; diff --git a/GSCats.xcodeproj/xcuserdata/qd.xcuserdatad/xcschemes/GSCats.xcscheme b/GSCats.xcodeproj/xcuserdata/qd.xcuserdatad/xcschemes/GSCats.xcscheme deleted file mode 100644 index b422b1d..0000000 --- a/GSCats.xcodeproj/xcuserdata/qd.xcuserdatad/xcschemes/GSCats.xcscheme +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b6a348d --- /dev/null +++ b/Makefile @@ -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/* + + diff --git a/V2Make.scpt b/V2Make.scpt new file mode 100644 index 0000000..274dd79 Binary files /dev/null and b/V2Make.scpt differ diff --git a/equates.s b/equates.s new file mode 100644 index 0000000..4c06ca1 --- /dev/null +++ b/equates.s @@ -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 diff --git a/graphics.s b/graphics.s new file mode 100644 index 0000000..fa80fc7 --- /dev/null +++ b/graphics.s @@ -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 diff --git a/gscats.2mg b/gscats.2mg new file mode 100644 index 0000000..8809fe8 Binary files /dev/null and b/gscats.2mg differ diff --git a/gscats.s b/gscats.s new file mode 100644 index 0000000..7ff91bc --- /dev/null +++ b/gscats.s @@ -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" diff --git a/macros.s b/macros.s new file mode 100644 index 0000000..67c1dee --- /dev/null +++ b/macros.s @@ -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 +