Save mode working (but not create new file yet)

This commit is contained in:
Rémy GIBERT 2016-01-06 23:07:28 +01:00
parent ab46cb81e6
commit 73aee6eb49
3 changed files with 79 additions and 24 deletions

View File

@ -538,9 +538,22 @@ Prompt.Save cmp #3
lda (pData)
beq .8
ldy #hFileName
lda (pData),y
beq .11
>SYSCALL SYS.FreeMemA
.11 >LDYA pData
>SYSCALL SYS.NewPStrYA
ldy #hFileName
sta (pData),y
ldy #PromptMode
lda #0
sta (pData),y
jsr SaveFile
bcc .81
jsr UpdateStatusBarErrA
bra .80
.2 cmp #127
@ -553,8 +566,7 @@ Prompt.Save cmp #3
sta (pData)
bra .80
.3 >DEBUG
cmp #$20
.3 cmp #$20
bcc .8
pha
lda (pData)
@ -571,6 +583,7 @@ Prompt.Save cmp #3
.8 clc
rts
.81 jsr UpdateTopBar
.80 jsr UpdateStatusBar
bcs .9
rts

View File

@ -235,14 +235,23 @@ UpdateStatusBar ldy #PromptMode
>PUSHA
>LDYA L.MSG.STATUSBAR
>SYSCALL SYS.PSTRoutYA
rts
bcs .9
jmp GotoCurXCurY
.2 >PUSHW pData
ldy #ScreenH
.2 cmp #PromptModeHelp
beq .3
>PUSHW pData
.3 ldy #ScreenH
lda (pData),y
>PUSHA
>LDYA L.MSG.STATUSBAR,x
>SYSCALL SYS.PSTRoutYA
.9 rts
*--------------------------------------
UpdateStatusBarErrA
>PUSHA
>LDYA L.MSG.STATUSBAR.E
>SYSCALL SYS.PSTRoutYA
rts
*--------------------------------------
GotoCurXCurY ldy #CurX

View File

@ -52,6 +52,7 @@ L.MSG.STATUSBAR.H .DA MSG.STATUSBAR.H
L.MSG.STATUSBAR.F .DA MSG.STATUSBAR.F
L.MSG.STATUSBAR.R .DA MSG.STATUSBAR.R
L.MSG.STATUSBAR.S .DA MSG.STATUSBAR.S
L.MSG.STATUSBAR.E .DA MSG.STATUSBAR.E
L.MSG.NEWFILE .DA MSG.NEWFILE
L.MSG.GOTOXY .DA MSG.GOTOXY
L.MSG.HELP .DA MSG.HELP
@ -130,10 +131,9 @@ CS.INIT stz hFile
sta (pData),y
>SYSCALL SYS.LoadFileA
bcc .21
jmp .99
bcs .3
.21 stx hFile
stx hFile
>STYA TmpLen
.3 >LDYA TmpLen
@ -400,6 +400,38 @@ CS.QUIT ldy #hBuffer
>SYSCALL SYS.CoutA
.9 rts
*--------------------------------------
SaveFile ldy #hFileName
lda (pData),y
>SYSCALL SYS.MLIOpenA
bcs .9
sta hFile
stx TmpByte
ldy #FileLen+1
>PUSHB (pData),y
dey
>PUSHB (pData),y
ldy #hBuffer
lda (pData),y
>SYSCALL SYS.GetMemPtrA
>PUSHYA
>PUSHB hFile
>SYSCALL SYS.MLIWrite
bcs .99
jsr .99
clc
rts
.99 lda hFile
>SYSCALL SYS.MLICloseA
lda TmpByte
>SYSCALL SYS.FreeMemA
sec
.9 rts
*--------------------------------------
DecTmpCount lda TmpCount
bne .1
lda TmpCount+1
@ -421,35 +453,36 @@ SEQ.INV >PSTRING "\e[7m"
SEQ.NORM >PSTRING "\e[0m"
SEQ.CEOL >PSTRING "\e[K"
MSG.TOPBAR >PSTRING "\e[1;1H\e[7mA2osX Edit:%S\e[K\e[0m"
MSG.STATUSBAR >PSTRING "\e[%d;1H\e[7mPress Ctrl-A For Help Length:%D Col:%d Line:%D\e[K\e[0m"
MSG.STATUSBAR.H >PSTRING "\e[%d;1H\e[7mPress any key to exit this screen%S\e[K\e[0m"
MSG.STATUSBAR >PSTRING "\e[%d;1H\e[7mPress Ctrl-A For Help Length:%D Col:%d Line:%D\e[K\e[0m"
MSG.STATUSBAR.H >PSTRING "\e[%d;1H\e[7mPress any key to exit this screen:\e[K\e[0m"
MSG.STATUSBAR.F >PSTRING "\e[%d;1H\e[7mFind:%S\e[K\e[0m"
MSG.STATUSBAR.R >PSTRING "\e[%d;1H\e[7mReplace:%S\e[K\e[0m"
MSG.STATUSBAR.S >PSTRING "\e[%d;1H\e[7mSave:%S\e[K\e[0m"
MSG.STATUSBAR.E >PSTRING "\e[%d;1H\e[7mError:%h\e[K\e[0m"
MSG.NEWFILE >PSTRING "(new file)"
MSG.GOTOXY >PSTRING "\e[%d;%dH"
MSG.HELP >PSTRING "Commands:"
>PSTRING "---------"
MSG.HELP >PSTRING "All commands:"
>PSTRING "(* = Not yet implemented)"
>PSTRING " Ctrl-A : This help screen"
>PSTRING " Ctrl-B : Mark begining of block"
>PSTRING " Ctrl-C : Copy block to clipboard"
>PSTRING " Ctrl-D : Delete marked block"
>PSTRING " Ctrl-C : * Copy block to clipboard"
>PSTRING " Ctrl-D : * Delete marked block"
>PSTRING " Ctrl-E : Mark end of block"
>PSTRING " Ctrl-F : Find a string..."
>PSTRING " Ctrl-F : * Find a string..."
>PSTRING " Ctrl-G : Go to start of current line"
>PSTRING " Ctrl-L : Go to end of current line"
>PSTRING " Ctrl-N : Find next"
>PSTRING " Ctrl-O : Page up"
>PSTRING " Ctrl-P : Page down"
>PSTRING " Ctrl-N : * Find next"
>PSTRING " Ctrl-O : * Page up"
>PSTRING " Ctrl-P : * Page down"
>PSTRING " Ctrl-Q : Quit"
>PSTRING " Ctrl-R : Replace found string with..."
>PSTRING " Ctrl-S : Save file to disk"
>PSTRING " Ctrl-T : Go to top of file"
>PSTRING " Ctrl-V : Past clipboard"
>PSTRING " Ctrl-R : * Replace found string with..."
>PSTRING " Ctrl-S : Save file to disk..."
>PSTRING " Ctrl-T : * Go to top of file"
>PSTRING " Ctrl-V : * Past clipboard"
>PSTRING " Ctrl-W : "
>PSTRING " Ctrl-X : Cut block to clipboard"
>PSTRING " Ctrl-X : * Cut block to clipboard"
>PSTRING " Ctrl-Y : "
>PSTRING " Ctrl-Z : Undo previous change"
>PSTRING " Ctrl-Z : * Undo previous change"
.HS 00
EscChars >PSTRING "DBAC"
EscAscii .HS 04080A0B15