add title screen, auto-disappears on first keypress

This commit is contained in:
4am 2016-10-31 11:11:32 -04:00
parent 3bdedd887e
commit 39775ba385
3 changed files with 86 additions and 25 deletions

26
notes/title.txt Normal file
View File

@ -0,0 +1,26 @@
0 1 2
0123456789ABCDEF0123456789ABCDEF01234567
00
1
2
3
4
5
6
7
8
9 4LIVE by 4am & san inc
A Revision 01 / Serial number 161031
B
C
D https://github.com/a2-4am/4live
E
F
10
1
2
3
4
5
6
7***********************************4LIVE

View File

@ -49,7 +49,7 @@
HOTKEY = $80 ; CTRL-@ HOTKEY = $80 ; CTRL-@
IMPORTKEY = $89 ; CTRL-I IMPORTKEY = $89 ; CTRL-I
SAVEKEY = $93 ; CTRL-S CLEARKEY = $8E ; CTRL-N
;constants ;constants
LTARROW = $88 LTARROW = $88
@ -154,7 +154,10 @@ Install
;open source file and read it if available ;open source file and read it if available
jsr OpenReadFile jsr OpenReadFile
lda SaveCH bcs +
lda #0
sta gClearOnFirstKeypress
+ lda SaveCH
sta MyCH sta MyCH
lda SaveCV lda SaveCV
sta MyCV sta MyCV
@ -372,67 +375,72 @@ SwapCoords
bpl - bpl -
jmp BASCALC jmp BASCALC
_doneEditorMode
rts
;print anything that isn't a special key
;wrap around screen position when we hit edges
EditorMode EditorMode
ldy CH ldy CH
lda (BASL), y lda (BASL), y
jsr KEYIN jsr KEYIN
cmp #HOTKEY cmp #HOTKEY
beq _doneEditorMode beq HandleKeyExit
cmp #ESC cmp #ESC
beq _doneEditorMode beq HandleKeyExit
ldx #1 ldx #1
stx gIsDirty stx gIsDirty
cmp #IMPORTKEY cmp #IMPORTKEY
beq ImportScreen beq HandleKeyImportScreen
cmp #CLEARKEY
beq HandleKeyClearScreen
cmp #LTARROW cmp #LTARROW
beq LineLeft beq HandleKeyLineLeft
cmp #UPARROW cmp #UPARROW
beq LineUp beq HandleKeyLineUp
cmp #RTARROW cmp #RTARROW
beq LineRight beq HandleKeyLineRight
OutChar ;print anything that isn't a special key
;wrap around screen position when we hit edges
pha
lda gClearOnFirstKeypress
beq +
jsr ClearScreen
lda #0
sta gClearOnFirstKeypress
+ pla
jsr COUT jsr COUT
lda CV lda CV
eor #(HEIGHT - 1) ;zero on match eor #(HEIGHT - 1) ;zero on match
bne EditorMode bne EditorMode
SetRow SetRow
sta CV sta CV
SetRow1 SetRow1
lda CV lda CV
jsr BASCALC jsr BASCALC
bcc EditorMode ;always bcc EditorMode ;always
LineLeft HandleKeyExit
rts
HandleKeyLineLeft
dec CH dec CH
bpl SetRow1 bpl SetRow1
lda #(WIDTH - 1) lda #(WIDTH - 1)
SetColumn SetColumn
sta CH sta CH
bpl SetRow1 ;always bpl SetRow1 ;always
LineUp HandleKeyLineUp
dec CV dec CV
bpl SetRow1 bpl SetRow1
lda #(HEIGHT - 2) lda #(HEIGHT - 2)
bne SetRow ;always bne SetRow ;always
LineRight HandleKeyLineRight
inc CH inc CH
lda CH lda CH
eor #WIDTH ;zero on match eor #WIDTH ;zero on match
bne SetRow1 bne SetRow1
beq SetColumn ;always beq SetColumn ;always
ImportScreen HandleKeyImportScreen
lda #<(EditBuffer + WIDTH) lda #<(EditBuffer + WIDTH)
sta OPSRCL sta OPSRCL
lda #>(EditBuffer + WIDTH) lda #>(EditBuffer + WIDTH)
@ -456,7 +464,26 @@ ImportScreen
inc OPSRCH inc OPSRCH
+ dex + dex
bpl -- bpl --
bmi EditorMode jmp EditorMode
HandleKeyClearScreen
jsr ClearScreen
jmp EditorMode
ClearScreen ; does not clear status line
ldx #(HEIGHT - 2)
-- lda TextCalcLo, x
sta _c+1
lda TextCalcHi, x
sta _c+2
ldy #(WIDTH - 1)
lda #$A0
_c sta $FFFF, y ; self-modified, above
dey
bpl _c
dex
bpl --
rts
OpenReadFile OpenReadFile
lda LCBANK2 lda LCBANK2
@ -587,6 +614,8 @@ LINE
!byte 0 !byte 0
gIsDirty gIsDirty
!byte 0 !byte 0
gClearOnFirstKeypress
!byte 1
TextCalcHi TextCalcHi
!byte $04, $04, $05, $05, $06, $06, $07, $07 !byte $04, $04, $05, $05, $06, $06, $07, $07
@ -605,13 +634,19 @@ SaveCV
!byte 0 ;loaded from file if exists !byte 0 ;loaded from file if exists
EditBuffer ;lines are stored sequentially, not like text page in memory EditBuffer ;lines are stored sequentially, not like text page in memory
!fill WIDTH * (HEIGHT - 1), $A0 !fill WIDTH * 8, $A0
!scrxor $80, " 4LIVE by 4am & san inc "
!fill WIDTH, $A0
!scrxor $80, " Revision 01 / Serial number 161031 "
!fill WIDTH * 2, $A0
!scrxor $80, " https://github.com/a2-4am/4live "
!fill WIDTH * 9, $A0
LoadSaveEnd LoadSaveEnd
StatusLine ;must be exactly WIDTH bytes StatusLine ;must be exactly WIDTH bytes
;status line ;status line
!fill (WIDTH - 8), $20 !fill (WIDTH - 5), $20
!scrxor $80, "4LIVE V1" !scrxor $80, "4LIVE"
LineBuffer ;used during scrolling LineBuffer ;used during scrolling
!fill WIDTH, 0 !fill WIDTH, 0