pitch-dark/src/pitchdark.a

307 lines
8.1 KiB
Plaintext
Raw Normal View History

2018-02-01 03:04:10 +00:00
;license:MIT
2018-02-01 00:07:35 +00:00
;(c) 2018 by 4am
!cpu 65c02
2018-02-01 20:27:33 +00:00
!ct "lcase.ct"
!to "../build/PITCHDRK.SYSTEM#FF2000",plain
2018-02-01 00:07:35 +00:00
*=$2000
2018-02-01 03:04:10 +00:00
; ROM routines
INVERSE = $FE80
NORMAL = $FE84
2018-02-03 16:45:41 +00:00
MAGICRTS = $FF58
2018-02-01 03:04:10 +00:00
2018-02-01 20:27:33 +00:00
; application constants
RAW = 1
2018-02-01 00:07:35 +00:00
jmp Init
!source "WeeGUI_MLI.s"
!source "prodos.a"
2018-02-03 16:45:41 +00:00
!source "config.a"
2018-02-01 00:07:35 +00:00
Init
lda MACHID
and #$30
cmp #$30 ; 128K?
beq + ; yes, continue
jmp QuitToProDOS
+
bit $c010
jsr LoadFile ; load WEEGUI binary at $4000
2018-02-03 16:45:41 +00:00
!word weeguifilename
2018-02-01 00:07:35 +00:00
!word $4000
!word $2000
!word $1C00
2018-02-01 20:27:33 +00:00
jsr $4000 ; initialize WeeGUI
lda #22
sta gCurrentGame
jsr LoadGameInfo
ldx #WGEnableMouse ; enable mouse support
jsr WeeGUI
2018-02-01 20:27:33 +00:00
ldx #WGClearScreen ; clear screen
2018-02-01 00:07:35 +00:00
jsr WeeGUI
2018-02-01 03:04:10 +00:00
2018-02-01 20:27:33 +00:00
ldx #WGCreateView ; create title bar on top line
lda #<view_title
2018-02-01 03:04:10 +00:00
sta PARAM0
2018-02-01 20:27:33 +00:00
lda #>view_title
2018-02-01 03:04:10 +00:00
sta PARAM1
jsr WeeGUI
jsr INVERSE
ldx #WGPrint
2018-02-01 20:27:33 +00:00
lda #<string_title
2018-02-01 03:04:10 +00:00
sta PARAM0
2018-02-01 20:27:33 +00:00
lda #>string_title
2018-02-01 03:04:10 +00:00
sta PARAM1
jsr WeeGUI
jsr NORMAL
jsr _create_button ; create buttons
2018-02-01 20:27:33 +00:00
!word view_previous
jsr _create_button
!word view_next
jsr _create_button
!word view_play
jsr _create_button
!word view_clues
jsr _create_button
!word view_boxart
jsr _create_button
!word view_options
ldx #WGCreateView ; create borderless frame for game title and info
2018-02-01 20:27:33 +00:00
lda #<view_info
sta PARAM0
lda #>view_info
sta PARAM1
jsr WeeGUI
ldx #WGCreateView ; create scrollable frame for game description text
lda #<view_description
sta PARAM0
lda #>view_description
2018-02-03 16:45:41 +00:00
sta PARAM1
jsr WeeGUI
ldx #WGViewSetAction
lda #<PaintDescription
2018-02-03 16:45:41 +00:00
sta PARAM0
lda #>PaintDescription
2018-02-03 16:45:41 +00:00
sta PARAM1
jsr WeeGUI
ldx #WGPaintView
jsr WeeGUI
jsr PaintInfo
jsr PaintDescription
2018-02-03 16:45:41 +00:00
runloop
ldx #WGPendingViewAction
jsr WeeGUI
lda $c000
bpl runloop
2018-02-01 03:04:10 +00:00
bit $c010
ldx #WGDisableMouse ; disable mouse support before quitting
2018-02-01 03:04:10 +00:00
jsr WeeGUI
ldx #WGExit ; clean up WeeGUI
jsr WeeGUI
jmp QuitToProDOS ; quit via ProDOS MLI
2018-02-01 00:07:35 +00:00
2018-02-01 20:27:33 +00:00
callback_previous
callback_next
callback_play
callback_clues
callback_boxart
callback_options
rts
_create_button
pla
sta $00
pla
sta $01
tax
lda #$02
clc
adc $00
bcc +
inx
+ phx
pha
ldy #$01
lda ($00),y
sta PARAM0
iny
lda ($00),y
sta PARAM1
ldx #WGCreateButton
jsr WeeGUI
ldx #WGViewSetRawTitle
lda #RAW
sta PARAM0
jsr WeeGUI
ldx #WGPaintView
jmp WeeGUI
PaintInfo
ldx #WGSelectView
lda #12
jsr WeeGUI
ldx #WGEraseViewContents
jsr WeeGUI
lda addrInfo
ldy addrInfo+1
ldx #0
bra MultiPrint
PaintDescription
ldx #WGSelectView
lda #13
jsr WeeGUI
ldx #WGEraseViewContents
jsr WeeGUI
lda addrDescription
ldy addrDescription+1
ldx #1
MultiPrint
sta $00
sty $01
stx .htab+1
stx .vtab+1
printloop
ldx #WGSetCursor
.htab lda #$FD ; set at runtime
sta PARAM0
.vtab lda #$FD ; set at runtime
sta PARAM1
jsr WeeGUI
ldx #WGPrint
lda $00
sta PARAM0
lda $01
sta PARAM1
bit MAGICRTS ; set overflow bit
jsr WeeGUI
bit #%00000000
- lda ($00)
bne +
bit MAGICRTS
+ inc $00
bne +
inc $01
+ bvc -
inc .vtab+1
lda .vtab+1
cmp #$06
bne printloop
rts
2018-02-03 16:45:41 +00:00
weeguifilename
!byte 6
!raw "WEEGUI"
2018-02-01 03:04:10 +00:00
2018-02-01 20:27:33 +00:00
view_title
!byte 0 ; view ID
2018-02-01 03:04:10 +00:00
!byte 0 ; style
!byte 0 ; left
!byte 0 ; top
2018-02-01 20:27:33 +00:00
!byte 80 ; visible width
2018-02-01 03:04:10 +00:00
!byte 1 ; visible height
2018-02-01 20:27:33 +00:00
!byte 80 ; width
2018-02-01 03:04:10 +00:00
!byte 1 ; height
2018-02-01 20:27:33 +00:00
string_title
!raw "Pitch Dark ",0
view_previous
!byte 14 ; view ID
!byte 1 ; left
!byte 2 ; top
!byte 12 ; width
!word callback_previous ; callback
!word string_previous ; caption
string_previous
!text "< Pre"
!byte $76 ; 'v' inverse
!text "ious",0
view_next
!byte 15 ; view ID
!byte 65 ; left
!byte 2 ; top
!byte 13 ; width
!word callback_next ; callback
!word string_next ; caption
string_next
!byte $0E ; 'N' inverse
!text "ext game >",0
view_play
!byte 1 ; view ID
!byte 34 ; left
!byte 10 ; top
!byte 13 ; width
!word callback_play ; callback
!word string_play ; caption
string_play
!byte $10 ; 'P' inverse
!text "lay game",0
2018-02-01 03:04:10 +00:00
2018-02-01 20:27:33 +00:00
view_clues
!byte 2 ; view ID
!byte 66 ; left
!byte 7 ; top
!byte 11 ; width
!word callback_clues ; callback
!word string_clues ; caption
string_clues
!byte $03 ; 'C' inverse
!text "lues",0
view_boxart
!byte 3 ; view ID
!byte 66 ; left
!byte 9 ; top
!byte 11 ; width
!word callback_boxart ; callback
!word string_boxart ; caption
string_boxart
!byte $02 ; 'B' inverse
!text "ox art",0
view_options
!byte 4 ; view ID
!byte 66 ; left
!byte 11 ; top
!byte 11 ; width
!word callback_options ; callback
!word string_options ; caption
string_options
!byte $0F ; 'O' inverse
!text "ptions",0
view_info
!byte 12 ; view ID
!byte 0 ; style
2018-02-03 16:45:41 +00:00
!byte 30 ; left
2018-02-01 20:27:33 +00:00
!byte 2 ; top
2018-02-03 16:45:41 +00:00
!byte 20 ; visible width
2018-02-01 20:27:33 +00:00
!byte 7 ; visible height
2018-02-03 16:45:41 +00:00
!byte 20 ; width
2018-02-01 20:27:33 +00:00
!byte 7 ; height
2018-02-03 16:45:41 +00:00
view_description
!byte 13 ; view ID
!byte 2 ; style
!byte 1 ; left
!byte 15 ; top
!byte 77 ; visible width
!byte 8 ; visible height
!byte 77 ; width
!byte 17 ; height