This commit is contained in:
4am 2017-01-23 14:00:25 -05:00
commit 1b8e0e3083
2 changed files with 44 additions and 26 deletions

Binary file not shown.

View File

@ -73,7 +73,7 @@
WIDTH = 40 WIDTH = 40
HEIGHT = 24 HEIGHT = 24
LDRBASE = $2E9 LDRBASE = $2E9
INSTALLBUFFER = $23B ; yes, the overlay overwrites the loader... INSTALLBUFFER = $232 ; yes, the overlay overwrites the loader...
; see also "warning!" below ; see also "warning!" below
SWAPBUFFER = $900 ; (LoadSaveEnd - LoadSaveStart) size SWAPBUFFER = $900 ; (LoadSaveEnd - LoadSaveStart) size
; needed by Diversi-DOS, must be page-aligned ; needed by Diversi-DOS, must be page-aligned
@ -351,14 +351,15 @@ InstallStart
bcs + bcs +
lda SaveCH lda SaveCH
sta Pages + 1 sta Pages + 1
sta OrgPages + 1
ldx SaveCV ldx SaveCV
stx CurPage + 1 stx CurPage + 1
stx OrgPage + 1
jsr SeekReadWrite jsr SeekReadWrite
dec ClearOnFirstKeypress + 1
dec PreventAddPage + 1 ;tri-state flag because Diversi-DOS
inc HeaderExists + 1
+ +
;set to true if no data file found (carry is set)
rol ClearOnFirstKeypress + 1
rol PreventAddPage + 1 ;tri-state flag because Diversi-DOS
jsr SetTextCoords1 jsr SetTextCoords1
@ -776,7 +777,7 @@ EditorMode
;we require this trigger to allow us to work around a bug in Diversi-DOS ;we require this trigger to allow us to work around a bug in Diversi-DOS
ClearOnFirstKeypress ClearOnFirstKeypress
ldy #0 ;self-modified ldy #1 ;self-modified
beq + beq +
dec ClearOnFirstKeypress + 1 dec ClearOnFirstKeypress + 1
php ;save carry (don't care about the rest) php ;save carry (don't care about the rest)
@ -894,9 +895,9 @@ ClearScreen ; does not clear status line
;copy from virtual buffer to real screen ;copy from virtual buffer to real screen
;;todo: add camera flash and click effect ;-) ;;todo: add camera flash and click effect ;-)
HandleKeyImportScreen ;called with carry set HandleKeyImportScreen ;called with carry set
lda #<(LoadSaveEnd - WIDTH) lda #<LoadSaveEnd
sta OPSRC1L sta OPSRC1L
lda #>(LoadSaveEnd - WIDTH) lda #>LoadSaveEnd
sta OPSRC1H sta OPSRC1H
ldx #(HEIGHT - 2) ldx #(HEIGHT - 2)
@ -927,7 +928,7 @@ PageReturn
HandleKeyAddPage HandleKeyAddPage
PreventAddPage PreventAddPage
lda #0 ;self-modified lda #1 ;self-modified
beq + ;page 1 exists already, go directly to add beq + ;page 1 exists already, go directly to add
bpl PageReturn ;page 1 doesn't exist and nothing to write bpl PageReturn ;page 1 doesn't exist and nothing to write
@ -961,6 +962,7 @@ PreventAddPage
lda MyCV + 1 lda MyCV + 1
pha pha
lda #0 lda #0
sta PreventAddPage + 1
sta MyCH + 1 sta MyCH + 1
sta MyCV + 1 sta MyCV + 1
jsr SeekReadWrite jsr SeekReadWrite
@ -1007,17 +1009,7 @@ HandleKeyPrevPage
++ php ;save carry (don't care about the rest) ++ php ;save carry (don't care about the rest)
jsr ExchangeVirtualBuffer jsr ExchangeVirtualBuffer
;update header to specify new page count and current page +++ jsr OpenDataFile
+++ jsr LoadSaveHeader
;Diversi-DOS has a critical bug when reading from a just-written sector
;IT RETURNS THE ORIGINAL DATA UNLESS YOU CLOSE THE FILE AND RE-OPEN IT
;so that's what we do
jsr CloseFile
jsr OpenDataFile
dec ReadWriteCmd ;lda #CMDREAD / sta ReadWriteCmd dec ReadWriteCmd ;lda #CMDREAD / sta ReadWriteCmd
lda ReadBuffer lda ReadBuffer
pha pha
@ -1027,7 +1019,7 @@ HandleKeyPrevPage
pha pha
adc #0 adc #0
sta ReadBuffer + 1 sta ReadBuffer + 1
ldx SaveCV ldx CurPage + 1
jsr SeekReadWrite jsr SeekReadWrite
pla pla
sta ReadBuffer + 1 sta ReadBuffer + 1
@ -1189,13 +1181,9 @@ ScrollEditPatch2
inc OPDST1H inc OPDST1H
+ dex + dex
bpl - bpl -
;animation delay
jsr Delay ;returns A=0
plp ;restore carry plp ;restore carry
bcc + ;the ScrollRight path bcc + ;the ScrollRight path
tay ldy #0
inc SCROLLLINE inc SCROLLLINE
bne -- bne --
rts rts
@ -1241,6 +1229,36 @@ CopyColumnPatch2
WriteIfDirty1 WriteIfDirty1
jsr SetPrevPage jsr SetPrevPage
;update header if number of pages changed, or if current page changed
OrgPages
cmp #0 ;self-modified
bne UpdateHeader
lda CurPage + 1
OrgPage
cmp #0 ;self-modified
bne UpdateHeader
;or if the page is dirty and we've never written the header before
lda WriteIfDirty2 + 1
beq OpenReturn
HeaderExists
lda #0 ;self-modified
bne WriteIfDirty2
;update header to specify new page count and current page
UpdateHeader
jsr LoadSaveHeader
;Diversi-DOS has a critical bug when reading from a just-written sector
;IT RETURNS THE ORIGINAL DATA UNLESS YOU CLOSE THE FILE AND RE-OPEN IT
;so that's what we do
jsr CloseFile
WriteIfDirty2 WriteIfDirty2
lda #"Q" ;self-modified lda #"Q" ;self-modified
beq OpenReturn beq OpenReturn