From 3bdedd887e79d4c58d930a47b017892770b4dd49 Mon Sep 17 00:00:00 2001 From: 4am Date: Mon, 31 Oct 2016 09:51:00 -0400 Subject: [PATCH] save and restore X register so DOS doesn't lose track of how long the current input buffer command is --- src/4live.a | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/4live.a b/src/4live.a index 7cc6eb1..ab44930 100644 --- a/src/4live.a +++ b/src/4live.a @@ -38,7 +38,6 @@ !addr COUT = $FDED ;private arbitrary addresses -!addr LINE = $40 !addr ZMANPARML = $40 !addr ZMANPARMH = $41 !addr DOSBUFL = $42 @@ -205,19 +204,28 @@ GlobalKeyboardHook ;no -> return to DOS rts + + txa + pha + ;first, scroll the edit buffer onto the screen ;(this also swaps the current screen contents out so we can restore it later) jsr ScrollEditBufferIn ;do the thing + lda #0 ;0=false, non-0=true + sta gIsDirty jsr EditorMode ;scroll the edit buffer out and the original screen back in jsr ScrollEditBufferOut - ;save to disk + ;save to disk (if necessary) + lda gIsDirty + beq + jsr SaveFile - ++ + pla + tax ;lather, rinse, repeat jmp GetKey @@ -377,6 +385,8 @@ EditorMode beq _doneEditorMode cmp #ESC beq _doneEditorMode + ldx #1 + stx gIsDirty cmp #IMPORTKEY beq ImportScreen cmp #LTARROW @@ -573,6 +583,10 @@ MyCH !byte 0 MyCV !byte 0 +LINE + !byte 0 +gIsDirty + !byte 0 TextCalcHi !byte $04, $04, $05, $05, $06, $06, $07, $07