- Initial commit

This commit is contained in:
Quinn Dunki 2014-08-29 12:19:19 -07:00
parent 1c7737fc2a
commit 9cbc3e0cf8
19 changed files with 3427 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/WeeGUI.xcodeproj/project.xcworkspace/xcuserdata/
/WeeGUI.xcodeproj/xcuserdata/

BIN
AppleCommander.jar Normal file

Binary file not shown.

42
Makefile Normal file
View File

@ -0,0 +1,42 @@
#
# Makefile
# WeeGUI
#
# Created by Quinn Dunki on 8/15/14.
# One Girl, One Laptop Productions
# http://www.quinndunki.com
# http://www.quinndunki.com/blondihacks
#
CL65=cl65
AC=AppleCommander.jar
ADDR=4000
ADDRDEMO=6000
PGM=gui
DEMO=guidemo
all: $(DEMO) $(PGM)
$(DEMO):
@PATH=$(PATH):/usr/local/bin; $(CL65) -t apple2enh --start-addr $(ADDRDEMO) -l$(DEMO).lst $(DEMO).s
java -jar $(AC) -d $(DEMO).dsk $(DEMO)
java -jar $(AC) -p $(DEMO).dsk $(DEMO) BIN 0x$(ADDRDEMO) < $(DEMO)
rm -f $(DEMO)
rm -f $(DEMO).o
$(PGM):
@PATH=$(PATH):/usr/local/bin; $(CL65) -t apple2enh --start-addr $(ADDR) -l$(PGM).lst $(PGM).s
java -jar $(AC) -d $(DEMO).dsk $(PGM)
java -jar $(AC) -p $(DEMO).dsk $(PGM) BIN 0x$(ADDR) < $(PGM)
rm -f $(PGM)
rm -f $(PGM).o
osascript V2Make.scpt $(PROJECT_DIR) $(DEMO) $(PGM)
clean:
rm -f $(DEMO)
rm -f $(DEMO).o
rm -f $(PGM)
rm -f $(PGM).o

BIN
V2Make.scpt Normal file

Binary file not shown.

View File

@ -0,0 +1,205 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXFileReference section */
709E88E319AC0A5F0069DB55 /* views.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = views.s; sourceTree = "<group>"; };
709E88E419AC0DC20069DB55 /* unit_test.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = unit_test.s; sourceTree = "<group>"; };
70B2272519A9685200702171 /* utility.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = utility.s; sourceTree = "<group>"; };
70D435B119A0137F001BFD9B /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
70D435B219A013AF001BFD9B /* gui.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = gui.s; sourceTree = "<group>"; };
70D435B419A0141F001BFD9B /* guidemo.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = guidemo.s; sourceTree = "<group>"; };
70F1DB4A19A56CDA00321637 /* macros.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = macros.s; sourceTree = "<group>"; };
70F1DB4B19A56D6300321637 /* switches.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = switches.s; sourceTree = "<group>"; };
70F1DB5619A6B02900321637 /* painting.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = painting.s; sourceTree = "<group>"; };
70F1DB5D19A7FF8700321637 /* memory.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = memory.s; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXGroup section */
70D435A619A012CF001BFD9B = {
isa = PBXGroup;
children = (
70D435B119A0137F001BFD9B /* Makefile */,
70F1DB4A19A56CDA00321637 /* macros.s */,
70F1DB4B19A56D6300321637 /* switches.s */,
70F1DB5D19A7FF8700321637 /* memory.s */,
70B2272519A9685200702171 /* utility.s */,
70F1DB5619A6B02900321637 /* painting.s */,
709E88E319AC0A5F0069DB55 /* views.s */,
70D435B219A013AF001BFD9B /* gui.s */,
709E88E419AC0DC20069DB55 /* unit_test.s */,
70D435B419A0141F001BFD9B /* guidemo.s */,
);
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXLegacyTarget section */
70D435AB19A012D0001BFD9B /* WeeGUI */ = {
isa = PBXLegacyTarget;
buildArgumentsString = "$(ACTION)";
buildConfigurationList = 70D435AE19A012D0001BFD9B /* Build configuration list for PBXLegacyTarget "WeeGUI" */;
buildPhases = (
);
buildToolPath = /usr/bin/make;
dependencies = (
);
name = WeeGUI;
passBuildSettingsInEnvironment = 1;
productName = WeeGUI;
};
/* End PBXLegacyTarget section */
/* Begin PBXProject section */
70D435A719A012CF001BFD9B /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0600;
ORGANIZATIONNAME = "One Girl, One Laptop Productions";
TargetAttributes = {
70D435AB19A012D0001BFD9B = {
CreatedOnToolsVersion = 6.0;
};
};
};
buildConfigurationList = 70D435AA19A012CF001BFD9B /* Build configuration list for PBXProject "WeeGUI" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 70D435A619A012CF001BFD9B;
projectDirPath = "";
projectRoot = "";
targets = (
70D435AB19A012D0001BFD9B /* WeeGUI */,
);
};
/* End PBXProject section */
/* Begin XCBuildConfiguration section */
70D435AC19A012D0001BFD9B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
};
70D435AD19A012D0001BFD9B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
};
name = Release;
};
70D435AF19A012D0001BFD9B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
DEBUGGING_SYMBOLS = YES;
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
70D435B019A012D0001BFD9B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
OTHER_CFLAGS = "";
OTHER_LDFLAGS = "";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
70D435AA19A012CF001BFD9B /* Build configuration list for PBXProject "WeeGUI" */ = {
isa = XCConfigurationList;
buildConfigurations = (
70D435AC19A012D0001BFD9B /* Debug */,
70D435AD19A012D0001BFD9B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
70D435AE19A012D0001BFD9B /* Build configuration list for PBXLegacyTarget "WeeGUI" */ = {
isa = XCConfigurationList;
buildConfigurations = (
70D435AF19A012D0001BFD9B /* Debug */,
70D435B019A012D0001BFD9B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 70D435A719A012CF001BFD9B /* Project object */;
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:WeeGUI.xcodeproj">
</FileRef>
</Workspace>

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDESourceControlProjectFavoriteDictionaryKey</key>
<false/>
<key>IDESourceControlProjectIdentifier</key>
<string>CF799A61-C8B1-43FD-B9D1-A4282374D325</string>
<key>IDESourceControlProjectName</key>
<string>WeeGUI</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>F041408A2ABBA5E27FC164AE936A5C1AA13AD5FD</key>
<string>https://github.com/blondie7575/WeeGUI</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>WeeGUI.xcodeproj</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>F041408A2ABBA5E27FC164AE936A5C1AA13AD5FD</key>
<string>../..</string>
</dict>
<key>IDESourceControlProjectURL</key>
<string>https://github.com/blondie7575/WeeGUI</string>
<key>IDESourceControlProjectVersion</key>
<integer>111</integer>
<key>IDESourceControlProjectWCCIdentifier</key>
<string>F041408A2ABBA5E27FC164AE936A5C1AA13AD5FD</string>
<key>IDESourceControlProjectWCConfigurations</key>
<array>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>F041408A2ABBA5E27FC164AE936A5C1AA13AD5FD</string>
<key>IDESourceControlWCCName</key>
<string>WeeGUI</string>
</dict>
</array>
</dict>
</plist>

1570
gui.lst Normal file

File diff suppressed because it is too large Load Diff

128
gui.s Normal file
View File

@ -0,0 +1,128 @@
;
; gui.s
; AssemblyTest
;
; Created by Quinn Dunki on 8/15/14.
; Copyright (c) 2014 One Girl, One Laptop Productions. All rights reserved.
;
.org $4000
; Common definitions
.include "switches.s"
.include "macros.s"
; Main
main:
jsr begin80cols
jsr WGClearScreen
lda #<testView
sta PARAM0
lda #>testView
sta PARAM1
jsr WGCreateView
lda #0
jsr WGSelectView
jsr WGPaintView
ldx #4
ldy #3
jsr WGSetCursor
; lda #-4
; jsr WGScrollX
; lda #-3
; jsr WGScrollY
lda #<testStr
sta PARAM0
lda #>testStr
sta PARAM1
jsr WGPrintASCII
; lda #1
; sta PARAM0
; lda #1
; sta PARAM1
; lda #2
; sta PARAM2
; lda #2
; sta PARAM3
; ldx #'Q'+$80
; jsr WGFillRect
; jsr WGStrokeRect
; jmp loop
; jsr waitForKey
; jmp tortureTestRects
loop:
; lda #'Q' + $80
; jsr COUT
jmp loop
rts ; This seems to work for returning to BASIC.SYSTEM, but I don't think it's right
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; begin80cols
; Enables 80 column mode (and enhanced video firmware)
begin80cols:
lda #$a0
jsr $c300
SETSWITCH TEXTON
SETSWITCH PAGE2OFF
SETSWITCH COL80ON
SETSWITCH STORE80ON
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; waitForKey
; Spinlocks until a key is pressed
waitForKey:
lda KBDSTRB
bpl waitForKey
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; read80ColSwitch
; Returns value of the 80 col switch on //c and //c+ machines
; OUT A: Switch state (non-zero=80 cols)
; NOTE: Untested
read80ColSwitch:
lda $c060
bpl read80ColSwitch_40
lda #$1
rts
read80ColSwitch_40:
lda #$0
rts
; Code modules
.include "utility.s"
.include "painting.s"
.include "views.s"
.include "unit_test.s"
.include "memory.s"
testView:
.byte "0007033e130404"
testStr:
.byte "This is a test of the emergency broadcast system. If this had been a real emergency, you would be dead now.",0

BIN
guidemo.dsk Normal file

Binary file not shown.

37
guidemo.lst Normal file
View File

@ -0,0 +1,37 @@
ca65 V2.13.3 - (C) Copyright 1998-2012 Ullrich von Bassewitz
Main file : guidemo.s
Current file: guidemo.s
000000r 1 ;
000000r 1 ; gui.s
000000r 1 ; AssemblyTest
000000r 1 ;
000000r 1 ; Created by Quinn Dunki on 8/15/14.
000000r 1 ; Copyright (c) 2014 One Girl, One Laptop Productions. All rights reserved.
000000r 1 ;
000000r 1
000000r 1
000000r 1 .org $6000
006000 1
006000 1 ; Reserved locations
006000 1
006000 1
006000 1 ; Constants
006000 1
006000 1
006000 1 ; ROM entry points
006000 1
006000 1
006000 1 ; WeeGUI entry points
006000 1
006000 1 GUI_MAIN = $4000
006000 1
006000 1
006000 1 ; Main
006000 1
006000 1 main:
006000 1 4C 00 40 jmp GUI_MAIN
006003 1
006003 1
006003 1
006003 1

32
guidemo.s Normal file
View File

@ -0,0 +1,32 @@
;
; gui.s
; AssemblyTest
;
; Created by Quinn Dunki on 8/15/14.
; Copyright (c) 2014 One Girl, One Laptop Productions. All rights reserved.
;
.org $6000
; Reserved locations
; Constants
; ROM entry points
; WeeGUI entry points
GUI_MAIN = $4000
; Main
main:
jmp GUI_MAIN

137
macros.s Normal file
View File

@ -0,0 +1,137 @@
;
; macros.s
; Generally useful macros for 6502 code
;
; Created by Quinn Dunki on 8/15/14.
; Copyright (c) 2014 One Girl, One Laptop Productions. All rights reserved.
;
; Macros
.macro SETSWITCH name ; Sets the named softswitch (assumes write method)
sta name
.endmacro
.macro SAVE_AXY ; Saves all registers
pha
txa
pha
tya
pha
.endmacro
.macro RESTORE_AXY ; Restores all registers
pla
tay
pla
tax
pla
.endmacro
.macro SAVE_AY ; Saves accumulator and Y index
pha
tya
pha
.endmacro
.macro RESTORE_AY ; Restores accumulator and Y index
pla
tay
pla
.endmacro
.macro SAVE_AX ; Saves accumulator and X index
pha
txa
pha
.endmacro
.macro RESTORE_AX ; Restores accumulator and X index
pla
tax
pla
.endmacro
.macro SAVE_ZPP ; Saves Zero Page locations we use for parameters
lda PARAM0
pha
lda PARAM1
pha
lda PARAM2
pha
lda PARAM3
pha
.endmacro
.macro RESTORE_ZPP ; Restores Zero Page locations we use for parameters
pla
sta PARAM3
pla
sta PARAM2
pla
sta PARAM1
pla
sta PARAM0
.endmacro
.macro SAVE_ZPS ; Saves Zero Page locations we use for scratch
lda SCRATCH0
pha
lda SCRATCH1
pha
.endmacro
.macro RESTORE_ZPS ; Restores Zero Page locations we use for scratch
pla
sta SCRATCH1
pla
sta SCRATCH0
.endmacro
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Rendering macros
;
.macro LDY_ACTIVEVIEW
lda WG_ACTIVEVIEW ; Find our new view record
and #%00001111
asl
asl
asl
asl ; Records are 8 bytes wide
tay
.endmacro
.macro LDX_ACTIVEVIEW
lda WG_ACTIVEVIEW ; Find our new view record
and #%00001111
asl
asl
asl
asl ; Records are 8 bytes wide
tax
.endmacro
.macro VBL_SYNC ; Synchronize with vertical blanking
lda #$80
macroWaitVBLToFinish:
bit RDVBLBAR
bmi tortureTestRectsWaitVBLToFinish
macroWaitVBLToStart:
bit RDVBLBAR
bpl tortureTestRectsWaitVBLToStart
.endmacro

123
memory.s Normal file
View File

@ -0,0 +1,123 @@
;
; memory.s
; Memory mapping information
;
; Created by Quinn Dunki on 8/15/14.
; Copyright (c) 2014 One Girl, One Laptop Productions. All rights reserved.
;
; Reserved locations
INVERSE = $32
BASL = $28
BASH = $29
; Zero page locations we use (unused by Monitor, Applesoft, or ProDOS)
PARAM0 = $06
PARAM1 = $07
PARAM2 = $08
PARAM3 = $09
SCRATCH0 = $19
SCRATCH1 = $1A
; Constants
CHAR_NORMAL = $ff
CHAR_INVERSE = $3f
CHAR_FLASH = $7f
; ROM entry points
COUT = $fded
BASCALC = $fbc1
; System state
WG_CURSORX: ; In screenspace
.byte 0
WG_CURSORY:
.byte 0
WG_LOCALCURSORX: ; In current viewspace
.byte 0
WG_LOCALCURSORY:
.byte 0
WG_ACTIVEVIEW:
.byte 0
WG_VIEWRECORDS:
; X, Y, Screen Width, Screen Height, Style, X Offset, Y Offset, View Width, View Height
.byte 0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0
.byte 0,0,0,0,0,0,0,0
; Video memory lookup table
TEXTLINES_H:
.byte $04 ;0
.byte $04 ;1
.byte $05 ;2
.byte $05 ;3
.byte $06 ;4
.byte $06 ;5
.byte $07 ;6
.byte $07 ;7
.byte $04 ;8
.byte $04 ;9
.byte $05 ;10
.byte $05 ;11
.byte $06 ;12
.byte $06 ;13
.byte $07 ;14
.byte $07 ;15
.byte $04 ;16
.byte $04 ;17
.byte $05 ;18
.byte $05 ;19
.byte $06 ;20
.byte $06 ;21
.byte $07 ;22
.byte $07 ;23
TEXTLINES_L:
.byte $00 ;0
.byte $80 ;1
.byte $00 ;2
.byte $80 ;3
.byte $00 ;4
.byte $80 ;5
.byte $00 ;6
.byte $80 ;7
.byte $28 ;8
.byte $a8 ;9
.byte $28 ;10
.byte $a8 ;11
.byte $28 ;12
.byte $a8 ;13
.byte $28 ;14
.byte $a8 ;15
.byte $50 ;16
.byte $d0 ;17
.byte $50 ;18
.byte $d0 ;19
.byte $50 ;20
.byte $d0 ;21
.byte $50 ;22
.byte $d0 ;23

606
painting.s Normal file
View File

@ -0,0 +1,606 @@
;
; painting.s
; Rendering routines for 80 column text elements
;
; Created by Quinn Dunki on 8/15/14.
; Copyright (c) 2014 One Girl, One Laptop Productions. All rights reserved.
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; WGClearScreen
; Clears the text screen (assumes 80 cols)
; Side effects: Clobbers BASL,BASH
;
WGClearScreen:
SAVE_AXY
SETSWITCH PAGE2OFF
ldx #23
WGClearScreen_lineLoop:
lda TEXTLINES_L,x ; Compute video memory address of line
sta BASL
lda TEXTLINES_H,x
sta BASH
ldy #39
lda #' ' + $80
WGClearScreen_charLoop:
sta (BASL),y
SETSWITCH PAGE2ON
sta (BASL),y
SETSWITCH PAGE2OFF
dey
bpl WGClearScreen_charLoop
dex
bpl WGClearScreen_lineLoop
RESTORE_AXY
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; WGFillRect
; Fills a rectangle (assumes 80 cols)
; PARAM0: Left edge
; PARAM1: Top edge
; PARAM2: Width
; PARAM3: Height
; X: Character to fill
; Side effects: Clobbers BASL,BASH
;
WGFillRect:
SAVE_AXY
SAVE_ZPS
stx SCRATCH0
clc ; Compute bottom edge
lda PARAM1
adc PARAM3
tax
WGFillRect_vertLoop:
phx ; We'll need X back for now, but save the line number
lda TEXTLINES_L,x ; Compute video memory address of left edge of rect
sta BASL
lda TEXTLINES_H,x
sta BASH
lda PARAM0
lsr
clc
adc BASL
sta BASL
lda #$0
adc BASH
sta BASH
lda PARAM0 ; Left edge even?
and #$01
bne WGFillRect_horzLoopOdd
; CASE 1: Left edge even-aligned, even width
SETSWITCH PAGE2OFF
lda PARAM2
lsr
tay ; Iterate w/2
dey
phy ; We'll reuse this calculation for the odd columns
WGFillRect_horzLoopEvenAligned0: ; Draw even columns
lda SCRATCH0 ; Plot the character
sta (BASL),y
dey
bpl WGFillRect_horzLoopEvenAligned0 ; Loop for w/2
SETSWITCH PAGE2ON ; Prepare for odd columns
ply ; Iterate w/2 again
WGFillRect_horzLoopEvenAligned1: ; Draw odd columns
lda SCRATCH0 ; Plot the character
sta (BASL),y
dey
bpl WGFillRect_horzLoopEvenAligned1 ; Loop for w/2
lda PARAM2 ; Is width even?
and #$01
beq WGFillRect_horzLoopEvenAlignedEvenWidth
; CASE 1a: Left edge even aligned, odd width
lda PARAM2 ; Fill in extra last column
lsr
tay
lda SCRATCH0 ; Plot the character
sta (BASL),y
WGFillRect_horzLoopEvenAlignedEvenWidth:
plx ; Prepare for next row
dex
cpx PARAM1
bcs WGFillRect_vertLoop
jmp WGFillRect_done
WGFillRect_horzLoopOdd:
; CASE 2: Left edge odd-aligned, even width
SETSWITCH PAGE2ON
lda PARAM2
lsr
tay ; Iterate w/2
phy ; We'll reuse this calculation for the even columns
WGFillRect_horzLoopOddAligned0: ; Draw even columns
lda SCRATCH0 ; Plot the character
sta (BASL),y
dey
bne WGFillRect_horzLoopOddAligned0 ; Loop for w/2
SETSWITCH PAGE2OFF ; Prepare for odd columns
ply ; Iterate w/2 again, shift left 1
dey
WGFillRect_horzLoopOddAligned1: ; Draw even columns
lda SCRATCH0 ; Plot the character
sta (BASL),y
dey
bpl WGFillRect_horzLoopOddAligned1 ; Loop for w/2
lda PARAM2 ; Is width even?
and #$01
beq WGFillRect_horzLoopOddAlignedEvenWidth
; CASE 2a: Left edge odd aligned, odd width
lda PARAM2 ; Fill in extra last column
lsr
tay
lda SCRATCH0 ; Plot the character
sta (BASL),y
WGFillRect_horzLoopOddAlignedEvenWidth:
plx ; Prepare for next row
dex
cpx PARAM1
bcs WGFillRect_vertLoopJmp
jmp WGFillRect_done
WGFillRect_vertLoopJmp:
jmp WGFillRect_vertLoop
WGFillRect_done:
RESTORE_ZPS
RESTORE_AXY
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; WGStrokeRect
; Strokes a rectangle (assumes 80 cols)
; PARAM0: Left edge
; PARAM1: Top edge
; PARAM2: Width
; PARAM3: Height
; Side effects: Clobbers BASL,BASH
;
CH_TOP = '_'+$80
CH_BOTTOM = 'L';'_'+$80
CH_LEFT = 'Z';'_'+$80
CH_RIGHT = '_'
CH_BOTTOMLEFT = 'L'
CH_BOTTOMRIGHT = '_'+$80
WGStrokeRect:
SAVE_AXY
SAVE_ZPS
; Top and bottom edges
;
ldx PARAM1 ; Start with top edge
dex
lda #CH_TOP
sta SCRATCH0
WGStrokeRect_horzEdge:
lda TEXTLINES_L,x ; Compute video memory address of left edge of rect
sta BASL
lda TEXTLINES_H,x
sta BASH
lda PARAM0
lsr
clc
adc BASL
sta BASL
lda #$0
adc BASH
sta BASH
lda PARAM0 ; Left edge even?
and #$01
bne WGStrokeRect_horzLoopOdd
; CASE 1: Left edge even-aligned, even width
SETSWITCH PAGE2OFF
lda PARAM2
lsr
tay ; Start at right edge
dey
phy ; We'll reuse this calculation for the odd columns
WGStrokeRect_horzLoopEvenAligned0: ; Draw even columns
lda SCRATCH0 ; Plot the character
sta (BASL),y
dey
bpl WGStrokeRect_horzLoopEvenAligned0 ; Loop for w/2
SETSWITCH PAGE2ON ; Prepare for odd columns
ply ; Start at right edge again
WGStrokeRect_horzLoopEvenAligned1: ; Draw odd columns
lda SCRATCH0 ; Plot the character
sta (BASL),y
dey
bpl WGStrokeRect_horzLoopEvenAligned1 ; Loop for w/2
lda PARAM2 ; Is width even?
and #$01
beq WGStrokeRect_horzLoopEvenAlignedEvenWidth
; CASE 1a: Left edge even aligned, odd width
;SETSWITCH PAGE2OFF
lda PARAM2 ; Fill in extra last column
lsr
tay
lda SCRATCH0 ; Plot the character
sta (BASL),y
WGStrokeRect_horzLoopEvenAlignedEvenWidth:
inx
cpx PARAM1
bne WGStrokeRect_vertEdge
clc ; Prepare for bottom edge
lda PARAM1
adc PARAM3
tax
lda #CH_BOTTOM
sta SCRATCH0
jmp WGStrokeRect_horzEdge
WGStrokeRect_horzLoopOdd:
; CASE 2: Left edge odd-aligned, even width
SETSWITCH PAGE2ON
lda PARAM2
lsr
tay ; Iterate w/2
phy ; We'll reuse this calculation for the even columns
WGStrokeRect_horzLoopOddAligned0: ; Draw even columns
lda SCRATCH0 ; Plot the character
sta (BASL),y
dey
bne WGStrokeRect_horzLoopOddAligned0 ; Loop for w/2
SETSWITCH PAGE2OFF ; Prepare for odd columns
ply ; Iterate w/2 again, shift left 1
dey
WGStrokeRect_horzLoopOddAligned1: ; Draw even columns
lda SCRATCH0 ; Plot the character
sta (BASL),y
dey
bpl WGStrokeRect_horzLoopOddAligned1 ; Loop for w/2
lda PARAM2 ; Is width even?
and #$01
beq WGStrokeRect_horzLoopOddAlignedEvenWidth
; CASE 2a: Left edge odd aligned, odd width
lda PARAM2 ; Fill in extra last column
dec
lsr
tay
lda SCRATCH0 ; Plot the character
sta (BASL),y
WGStrokeRect_horzLoopOddAlignedEvenWidth:
inx
cpx PARAM1
bne WGStrokeRect_vertEdge
clc ; Prepare for bottom edge
lda PARAM1
adc PARAM3
tax
lda #CH_BOTTOM
sta SCRATCH0
jmp WGStrokeRect_horzEdge
WGStrokeRect_vertEdge:
; Left and right edges
;
clc
lda PARAM1 ; Compute bottom edge
adc PARAM3
sta SCRATCH0
ldx PARAM1 ; Start with top edge
WGStrokeRect_vertLoop:
phx ; We'll need X back for now, but save the line number
lda TEXTLINES_L,x ; Compute video memory address of left edge of rect
sta BASL
lda TEXTLINES_H,x
sta BASH
lda PARAM0
dec
lsr
clc
adc BASL
sta BASL
lda #$0
adc BASH
sta BASH
lda PARAM0 ; Left edge even?
dec
and #$01
bne WGStrokeRect_vertLoopOdd
; CASE 1: Left edge even-aligned, even width
SETSWITCH PAGE2ON
ldy #$0
lda #CH_LEFT ; Plot the left edge
sta (BASL),y
lda PARAM2 ; Is width even?
inc
inc
and #$01
bne WGStrokeRect_vertLoopEvenAlignedOddWidth
lda PARAM2 ; Calculate right edge
inc
inc
lsr
dec
tay
SETSWITCH PAGE2OFF
lda #CH_RIGHT ; Plot the right edge
sta (BASL),y
jmp WGStrokeRect_vertLoopEvenAlignedNextRow
WGStrokeRect_vertLoopEvenAlignedOddWidth:
; CASE 1a: Left edge even-aligned, odd width
SETSWITCH PAGE2ON
lda PARAM2 ; Calculate right edge
inc
inc
lsr
tay
lda #CH_RIGHT ; Plot the right edge
sta (BASL),y
WGStrokeRect_vertLoopEvenAlignedNextRow:
plx ; Prepare for next row
inx
cpx SCRATCH0
bne WGStrokeRect_vertLoop
jmp WGStrokeRect_done
WGStrokeRect_vertLoopOdd:
; CASE 2: Left edge odd-aligned, even width
SETSWITCH PAGE2OFF
ldy #$0
lda #CH_LEFT ; Plot the left edge
sta (BASL),y
lda PARAM2 ; Is width even?
inc
inc
and #$01
bne WGStrokeRect_vertLoopOddAlignedOddWidth
lda PARAM2 ; Calculate right edge
inc
inc
lsr
tay
SETSWITCH PAGE2ON
lda #CH_RIGHT ; Plot the right edge
sta (BASL),y
jmp WGStrokeRect_vertLoopOddAlignedNextRow
WGStrokeRect_vertLoopOddAlignedOddWidth:
; CASE 2a: Left edge odd-aligned, odd width
SETSWITCH PAGE2OFF
lda PARAM2 ; Calculate right edge
inc
inc
lsr
tay
lda #CH_RIGHT ; Plot the right edge
sta (BASL),y
WGStrokeRect_vertLoopOddAlignedNextRow:
plx ; Prepare for next row
inx
cpx SCRATCH0
bne WGStrokeRect_vertLoopJmp
jmp WGStrokeRect_done
WGStrokeRect_vertLoopJmp:
jmp WGStrokeRect_vertLoop
WGStrokeRect_done:
RESTORE_ZPS
RESTORE_AXY
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; WGPlot
; Plots a character at current cursor position (assumes 80 cols)
; A: Character to plot
; Side effects: Clobbers SCRATCH0,BASL,BASH
;
WGPlot:
sta SCRATCH0
SAVE_AXY
SAVE_ZPS
ldx WG_CURSORY
lda TEXTLINES_L,x ; Compute video memory address of point
sta BASL
lda TEXTLINES_H,x
sta BASH
lda WG_CURSORX
lsr
clc
adc BASL
sta BASL
lda #$0
adc BASH
sta BASH
lda WG_CURSORX ; X even?
and #$01
bne WGPlot_xOdd
SETSWITCH PAGE2ON ; Plot the character
ldy #$0
lda SCRATCH0
sta (BASL),y
jmp WGPlot_done
WGPlot_xOdd:
SETSWITCH PAGE2OFF ; Plot the character
ldy #$0
lda SCRATCH0
sta (BASL),y
WGPlot_done:
RESTORE_ZPS
RESTORE_AXY
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; WGPrintASCII
; Prints a null-terminated ASCII string at the current view's
; cursor position. Clips to current view
; PARAM0: String pointer, LSB
; PARAM1: String pointer, MSB
; Side effects: Clobbers BASL,BASH
;
WGPrintASCII:
SAVE_AXY
SAVE_ZPS
jsr WGSyncGlobalCursor
LDY_ACTIVEVIEW
iny ; Clip to upper extent
lda WG_CURSORY
cmp WG_VIEWRECORDS,y
bcc WGPrintASCII_done
lda WG_VIEWRECORDS,y ; Clip to lower extent
iny
iny
clc
adc WG_VIEWRECORDS,y
dec
cmp WG_CURSORY
bcc WGPrintASCII_done
jsr WGStrLen ; We'll need the length of the string to clip horizontally
sta SCRATCH0
dey ; Clip left/right extents
dey
dey
lda WG_CURSORX ; startIndex = -(globalX - windowStartX)
sec
sbc WG_VIEWRECORDS,y
eor #$ff
inc
bmi WGPrintASCII_leftEdgeStart
cmp SCRATCH0
bcs WGPrintASCII_done ; Entire string is left of window
tax ; Starting mid-string on the left
lda WG_VIEWRECORDS,y
sta WG_CURSORX
txa
bra WGPrintASCII_findRightEdge
WGPrintASCII_leftEdgeStart:
lda #0
WGPrintASCII_findRightEdge:
pha ; Stash start index
lda WG_VIEWRECORDS,y
iny
iny
clc
adc WG_VIEWRECORDS,y
tax
dex
ply ; End cursor in X, start index in Y
WGPrintASCII_loop:
cpx WG_CURSORX
bcc WGPrintASCII_done ; Hit the right edge of the window
lda (PARAM0),y
beq WGPrintASCII_done ; Hit the end of the string
ora #$80
jsr WGPlot
iny
clc
lda #1
adc WG_CURSORX
sta WG_CURSORX
lda #0
adc WG_CURSORY
sta WG_CURSORY
jmp WGPrintASCII_loop
WGPrintASCII_done:
RESTORE_ZPS
RESTORE_AXY
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; WGPrint
; Prints a null-terminated Apple string at the current view's
; cursor position. Clips to current view.
; PARAM0: String pointer, LSB
; PARAM1: String pointer, MSB
; Side effects: Clobbers BASL,BASH
;
WGPrint:
SAVE_AXY
SAVE_ZPS
WGPrint_done:
RESTORE_ZPS
RESTORE_AXY
rts

29
switches.s Normal file
View File

@ -0,0 +1,29 @@
;
; switches.s
; Softswitches for Apple ][
;
; Created by Quinn Dunki on 8/15/14.
; Copyright (c) 2014 One Girl, One Laptop Productions. All rights reserved.
;
PAGE2 = $c01c ; Read bit 7
PAGE2OFF = $c054 ; Read/Write
PAGE2ON = $c055 ; Read/Write
COL80 = $c01f ; Read bit 7
COL80OFF = $c00c ; Write
COL80ON = $c00d ; Write
STORE80 = $c018 ; Read bit 7
STORE80OFF = $c000 ; Write
STORE80ON = $c001 ; Write
TEXT = $c01a ; Read bit 7
TEXTOFF = $c050 ; Read/Write
TEXTON = $C051 ; Read/Write
KBD = $c000 ; Read
KBDSTRB = $c010 ; Read/Write
RDVBLBAR = $C019 ; Read bit 7 (active low)

85
unit_test.s Normal file
View File

@ -0,0 +1,85 @@
;
; unit_test.s
; WeeGui
;
; Unit tests of various systems
;
; Created by Quinn Dunki on 8/15/14.
; Copyright (c) 2014 One Girl, One Laptop Productions. All rights reserved.
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; tortureTestRects
; Strokes and paints rectangles of many different geometries
;
; Stack:
; Curr X
; Curr Y
; Curr Width
; Curr Height
tortureTestRects:
jsr WGClearScreen
lda #38 ; Initialize
pha
lda #11
pha
lda #2
pha
lda #2
pha
tortureTestRectsLoop:
jsr WGClearScreen
tsx
inx
lda $0100,x ; Load Height, then modify
sta PARAM3
inc
inc
sta $0100,x
cmp #25
bcs tortureTestRectsDone
inx ; Load Width, then modify
lda $0100,x
sta PARAM2
inc
inc
inc
inc
inc
inc
sta $0100,x
inx ; Load Y, then modify
lda $0100,x
sta PARAM1
dec
sta $0100,x
inx ; Load X, then modify
lda $0100,x
sta PARAM0
dec
dec
dec
sta $0100,x
; ldx #'Q'+$80
; jsr WGFillRect
jsr WGStrokeRect
; jsr delayShort
jmp tortureTestRectsLoop
tortureTestRectsDone:
pla
pla
pla
pla
jmp tortureTestRects

133
utility.s Normal file
View File

@ -0,0 +1,133 @@
;
; utility.s
; General utilities for 6502
;
; Created by Quinn Dunki on 8/15/14.
; Copyright (c) 2014 One Girl, One Laptop Productions. All rights reserved.
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; delay
; Sleeps for ~1 second
;
delay:
SAVE_AXY
ldy #$ce ; Loop a bunch
delayOuter:
ldx #$ff
delayInner:
nop
nop
nop
nop
nop
nop
nop
dex
bne delayInner
dey
bne delayOuter
RESTORE_AXY
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; delayShort
; Sleeps for ~1/30th second
;
delayShort:
SAVE_AXY
ldy #$06 ; Loop a bit
delayShortOuter:
ldx #$ff
delayShortInner:
nop
nop
nop
nop
nop
nop
nop
dex
bne delayShortInner
dey
bne delayShortOuter
RESTORE_AXY
rts
;;;;;;;;;;;;;;;;;;;;;;;
; scanHexDigit
; Scans a 4 bit hex value from an ASCII character
; A: ASCII character
; Out A: Hex value
;
scanHexDigit:
cmp #'A'
bcs scanHexDigitLetter
sec
sbc #'0'
jmp scanHexDigitDone
scanHexDigitLetter:
sec
sbc #55
scanHexDigitDone:
rts
;;;;;;;;;;;;;;;;;;;;;;;
; scanHex8
; Scans an 8 bit hex value from a string
; PARAM0: Pointer to string (LSB)
; PARAM1: Pointer to string (MSB)
; Y: Offset into string
; Out A: 8-bit hex value
; Side effects: Clobbers Y and S0
;
scanHex8:
lda (PARAM0),y
jsr scanHexDigit
asl
asl
asl
asl
sta SCRATCH0 ; Stash first digit for later
iny
lda (PARAM0),y
jsr scanHexDigit
ora SCRATCH0
iny ; Be nice and advance Y to end
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; WGStrLen
; Finds the length of a null-terminated string
; PARAM0: String pointer, LSB
; PARAM1: String pointer, MSB
; Return: A: String length, not including null
;
WGStrLen:
phy
ldy #$0
WGStrLen_loop:
lda (PARAM0),y
beq WGStrLen_done
iny
bra WGStrLen_loop
WGStrLen_done:
tya
ply
rts

249
views.s Normal file
View File

@ -0,0 +1,249 @@
;
; views.s
; Management routines for GUI views
;
; Created by Quinn Dunki on 8/15/14.
; Copyright (c) 2014 One Girl, One Laptop Productions. All rights reserved.
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; WGCreateView
; Creates a new view
; PARAM0: Pointer to configuration string (LSB)
; PARAM1: Pointer to configuration string (MSB)
;
; Configuration string: "STXXYYSWSHVWVH"
; ST: (4:4) Style:ID
; XX: Screen X origin
; YY: Screen Y origin
; SW: Screen width
; SH: Screen height
; VW: View Width
; VH: View Height
;
WGCreateView:
SAVE_AXY
SAVE_ZPS
ldy #0
jsr scanHex8
pha
and #%00001111 ; Find our new view record
asl
asl
asl
asl ; Records are 8 bytes wide
tax
pla ; Cache style nybble for later
lsr
lsr
lsr
lsr
pha
jsr scanHex8
sta WG_VIEWRECORDS,x ; Screen X
inx
jsr scanHex8
sta WG_VIEWRECORDS,x ; Screen Y
inx
jsr scanHex8
sta WG_VIEWRECORDS,x ; Screen Width
inx
jsr scanHex8
sta WG_VIEWRECORDS,x ; Screen Height
inx
pla
sta WG_VIEWRECORDS,x ; Style
inx
lda #0 ; Initialize scrolling
sta WG_VIEWRECORDS,x
inx
sta WG_VIEWRECORDS,x
inx
jsr scanHex8
sta WG_VIEWRECORDS,x ; View Width
inx
jsr scanHex8
sta WG_VIEWRECORDS,x ; View Height
WGCreateView_done:
RESTORE_ZPS
RESTORE_AXY
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; WGPaintView
; Paints the current view
;
WGPaintView:
SAVE_AY
SAVE_ZPP
LDY_ACTIVEVIEW
lda WG_VIEWRECORDS,y ; Fetch the record
sta PARAM0
iny
lda WG_VIEWRECORDS,y
sta PARAM1
iny
lda WG_VIEWRECORDS,y
sta PARAM2
iny
lda WG_VIEWRECORDS,y
sta PARAM3
jsr WGStrokeRect
WGPaintView_done:
RESTORE_ZPP
RESTORE_AY
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; WGSelectView
; Selects the active view
; A: ID
;
WGSelectView:
SAVE_AY
sta WG_ACTIVEVIEW
LDY_ACTIVEVIEW
; Initialize cursor to local origin
lda #0
sta WG_LOCALCURSORX
sta WG_LOCALCURSORY
WGSelectView_done:
RESTORE_AY
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; WGSetCursor
; Sets the current local view cursor
; X: X
; Y: Y
;
WGSetCursor:
stx WG_LOCALCURSORX
sty WG_LOCALCURSORY
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; WGSyncGlobalCursor
; Synchronizes the global cursor with the current local view's
; cursor
;
WGSyncGlobalCursor:
SAVE_AY
; X
LDY_ACTIVEVIEW
clc ; Transform to viewspace
lda WG_LOCALCURSORX
adc WG_VIEWRECORDS,y
iny
iny
iny
iny
iny
clc
adc WG_VIEWRECORDS,y ; Transform to scrollspace
sta WG_CURSORX
; Y
LDY_ACTIVEVIEW
iny
clc ; Transform to viewspace
lda WG_LOCALCURSORY
adc WG_VIEWRECORDS,y
iny
iny
iny
iny
iny
clc
adc WG_VIEWRECORDS,y ; Transform to scrollspace
sta WG_CURSORY
WGSyncGlobalCursor_done:
RESTORE_AY
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; WGScrollX
; Scrolls the current view horizontally
; A: Delta to scroll
; Side effects: Clobbers A
;
WGScrollX:
phy
pha
LDY_ACTIVEVIEW
pla
iny
iny
iny
iny
iny
clc
adc WG_VIEWRECORDS,y
sta WG_VIEWRECORDS,y
WGScrollX_done:
ply
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; WGScrollY
; Scrolls the current view vertically
; A: Delta to scroll
; Side effects: Clobbers A
;
WGScrollY:
phy
pha
LDY_ACTIVEVIEW
pla
iny
iny
iny
iny
iny
iny
clc
adc WG_VIEWRECORDS,y
sta WG_VIEWRECORDS,y
WGScrollY_done:
ply
rts