pitch-dark/src/pitchdark.a

70 lines
2.1 KiB
Plaintext

;license:MIT
;(c) 2018 by 4am
!cpu 65c02
!ct "src/lcase.ct"
!to "build/PITCH.DARK",plain
*=$6000
lda #0 ; set Z flag always
!cpu 65816
rep #2 ; clear Z flag on 65816 only
!cpu 65c02
beq + ; skip GS-specific code on non-GS machines (required, will crash on //c, grr)
lda $C029
and #$1F
sta $C029 ; set GS NEWVIDEO mode to turn off linearize
+ jmp Start
.weeguiFilename
!byte 6
!raw "WEEGUI"
!source "src/WeeGUI_MLI.s"
!source "src/memory.a"
!source "src/prodos.a"
!source "src/ramdisk.a"
!source "src/path.a"
!source "src/prefs.a"
!source "src/config.a"
!source "src/action.a"
!source "src/paint.a"
Start
lda MACHID
and #$30
cmp #$30 ; 128K?
beq + ; yes, continue
jmp QuitToProDOS
+ jsr DisconnectRAM32 ; disconnect /RAM in S3,D2 so we can use DHGR
bit $C010
jsr LoadFile ; load WEEGUI binary at $4000
!word .weeguiFilename
!word $4000
!word $2000
!word kProDOSFileBuffer
jsr $4000 ; initialize WeeGUI
jsr LoadGlobalPreferences ; get current game
jsr LoadGameInfo ; load and parse game description text
jsr CreateViews ; create all WeeGUI views (UI elements)
ldx #WGClearScreen ; clear screen
jsr WeeGUI
jsr PaintAllViews ; draw all UI elements
ldx #WGEnableMouse ; enable mouse support
jsr WeeGUI
.runLoop
ldx #WGPendingViewAction
jsr WeeGUI
lda $c000
bpl .runLoop
bit $c010
jsr HandleKey
bra .runLoop
ExitWeeGUI
ldx #WGDisableMouse ; disable mouse support before quitting
jsr WeeGUI
ldx #WGExit ; clean up WeeGUI
jmp WeeGUI