2014-08-29 19:19:19 +00:00
|
|
|
;
|
|
|
|
; gui.s
|
2014-09-10 03:34:14 +00:00
|
|
|
; Top level management routines
|
2014-08-29 19:19:19 +00:00
|
|
|
;
|
|
|
|
; Created by Quinn Dunki on 8/15/14.
|
|
|
|
; Copyright (c) 2014 One Girl, One Laptop Productions. All rights reserved.
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
.org $4000
|
|
|
|
|
|
|
|
; Common definitions
|
|
|
|
|
2014-09-07 23:06:25 +00:00
|
|
|
.include "zeropage.s"
|
2014-08-29 19:19:19 +00:00
|
|
|
.include "switches.s"
|
|
|
|
.include "macros.s"
|
|
|
|
|
|
|
|
|
2014-10-03 19:22:19 +00:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; Main entry point. BRUN will land here.
|
2014-08-29 19:19:19 +00:00
|
|
|
main:
|
2014-09-06 03:32:16 +00:00
|
|
|
jsr WGInit
|
2014-10-03 19:22:19 +00:00
|
|
|
rts ; Don't add any bytes here!
|
|
|
|
|
|
|
|
|
|
|
|
; This is the non-negotiable entry point used by applications Don't move it!
|
|
|
|
; $4004
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; WGDispatch
|
|
|
|
; The dispatcher for calling the assembly-language API from assembly programs
|
|
|
|
; X: API call number
|
|
|
|
; P0-3,Y: Parameters to call, as needed
|
|
|
|
WGDispatch:
|
|
|
|
jmp (WGEntryPointTable,x)
|
|
|
|
|
|
|
|
; Entry point jump table
|
|
|
|
WGEntryPointTable:
|
|
|
|
.addr WGClearScreen
|
|
|
|
.addr WGDesktop
|
|
|
|
.addr WGPlot
|
|
|
|
.addr WGSetCursor
|
|
|
|
.addr WGSetGlobalCursor
|
2014-09-07 18:15:59 +00:00
|
|
|
|
2014-08-29 19:19:19 +00:00
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2014-09-06 03:32:16 +00:00
|
|
|
; WGInit
|
|
|
|
; Initialization. Should be called once at app startup
|
|
|
|
WGInit:
|
2014-09-18 23:24:17 +00:00
|
|
|
SAVE_AXY
|
2014-09-06 03:32:16 +00:00
|
|
|
|
2014-10-03 19:22:19 +00:00
|
|
|
jsr WG80
|
2014-09-10 03:34:14 +00:00
|
|
|
jsr WGInitApplesoft
|
2014-09-06 03:32:16 +00:00
|
|
|
|
2014-09-18 23:24:17 +00:00
|
|
|
ldy #15 ; Clear our block allocators
|
|
|
|
WGInit_clearMemLoop:
|
|
|
|
tya
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
asl
|
|
|
|
tax
|
|
|
|
lda #0
|
|
|
|
sta WG_STRINGS,x
|
|
|
|
dey
|
|
|
|
bpl WGInit_clearMemLoop
|
|
|
|
|
2014-09-29 20:45:46 +00:00
|
|
|
lda #$ff
|
|
|
|
sta WG_PENDINGACTIONVIEW
|
|
|
|
sta WG_FOCUSVIEW
|
|
|
|
|
2014-09-18 23:24:17 +00:00
|
|
|
RESTORE_AXY
|
2014-09-06 03:32:16 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
; WG80
|
2014-08-29 19:19:19 +00:00
|
|
|
; Enables 80 column mode (and enhanced video firmware)
|
2014-09-06 03:32:16 +00:00
|
|
|
WG80:
|
2014-09-19 23:04:36 +00:00
|
|
|
pha
|
|
|
|
|
2014-08-29 19:19:19 +00:00
|
|
|
lda #$a0
|
|
|
|
jsr $c300
|
2014-09-19 23:04:36 +00:00
|
|
|
|
2014-08-29 19:19:19 +00:00
|
|
|
SETSWITCH TEXTON
|
|
|
|
SETSWITCH PAGE2OFF
|
|
|
|
SETSWITCH COL80ON
|
|
|
|
SETSWITCH STORE80ON
|
2014-09-19 23:04:36 +00:00
|
|
|
|
|
|
|
pla
|
2014-08-29 19:19:19 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
; Code modules
|
|
|
|
.include "utility.s"
|
|
|
|
.include "painting.s"
|
2014-09-07 23:06:25 +00:00
|
|
|
.include "rects.s"
|
2014-08-29 19:19:19 +00:00
|
|
|
.include "views.s"
|
2014-09-28 00:52:57 +00:00
|
|
|
.include "mouse.s"
|
2014-09-10 03:34:14 +00:00
|
|
|
.include "applesoft.s"
|
2014-10-02 21:59:13 +00:00
|
|
|
;.include "unit_test.s"
|
2014-08-29 19:19:19 +00:00
|
|
|
.include "memory.s"
|
|
|
|
|
|
|
|
|
2014-09-07 23:06:25 +00:00
|
|
|
|
|
|
|
; Suppress some linker warnings - Must be the last thing in the file
|
|
|
|
.SEGMENT "ZPSAVE"
|
|
|
|
.SEGMENT "EXEHDR"
|
|
|
|
.SEGMENT "STARTUP"
|
|
|
|
.SEGMENT "INIT"
|
|
|
|
.SEGMENT "LOWCODE"
|
|
|
|
|