Code reorg

This commit is contained in:
Rémy GIBERT 2016-01-21 08:05:23 +01:00
parent 71a36fddb0
commit 8ad193c5fd
4 changed files with 62 additions and 54 deletions

View File

@ -55,6 +55,7 @@ BUF.InsertA sta TmpByte
>STYA BufPtrBackup >STYA BufPtrBackup
ldy #0 ldy #0
.1 jsr DecTmpCount .1 jsr DecTmpCount
beq .2 beq .2
lda (BufPtrBackup),y lda (BufPtrBackup),y
@ -110,6 +111,7 @@ BUF.Del ldy #FileLen
bcs .9 bcs .9
>STYA BufPtr >STYA BufPtr
jsr BUF.ComputeCOffset
>LDYA BUF.COffset >LDYA BUF.COffset
>STYA TmpCount >STYA TmpCount
@ -119,6 +121,7 @@ BUF.Del ldy #FileLen
>STYA BufPtrBackup >STYA BufPtrBackup
ldy #0 ldy #0
.1 jsr DecTmpCount .1 jsr DecTmpCount
beq .2 beq .2
lda (BufPtrBackup),y lda (BufPtrBackup),y
@ -152,7 +155,7 @@ BUF.Del ldy #FileLen
sbc #0 sbc #0
sta (pData),y sta (pData),y
.8 clc clc
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
* Out : Y = Line Length * Out : Y = Line Length

View File

@ -68,7 +68,7 @@ Ctrl.A ldy #PromptMode
bcs .9 bcs .9
bra .1 bra .1
.8 jsr UpdateStatusBar .8 jsr SCRN.UpdateStatusBar
bcs .9 bcs .9
rts rts
.9 jmp Ctrl.Q .9 jmp Ctrl.Q
@ -80,7 +80,7 @@ Ctrl.B jsr BUF.ComputeCOffset
lda BUF.COffset+1 lda BUF.COffset+1
iny iny
sta (pData),y sta (pData),y
jsr UpdateMain jsr SCRN.UpdateMain
bcs .9 bcs .9
rts rts
.9 jmp Ctrl.Q .9 jmp Ctrl.Q
@ -124,7 +124,7 @@ Ctrl.E jsr BUF.ComputeCOffset
lda BUF.COffset+1 lda BUF.COffset+1
iny iny
sta (pData),y sta (pData),y
jsr UpdateMain jsr SCRN.UpdateMain
bcs .9 bcs .9
rts rts
.9 jmp Ctrl.Q .9 jmp Ctrl.Q
@ -133,7 +133,7 @@ Ctrl.F lda #PromptModeFind
ldy #PromptMode ldy #PromptMode
sta (pData),y sta (pData),y
jsr UpdateStatusBar jsr SCRN.UpdateStatusBar
bcs .9 bcs .9
rts rts
.9 jmp Ctrl.Q .9 jmp Ctrl.Q
@ -143,7 +143,7 @@ Ctrl.G ldy #FileX
beq .8 beq .8
lda #0 lda #0
sta (pData),y sta (pData),y
jsr UpdateViewPort jsr SCRN.UpdateViewPort
bcs .9 bcs .9
.8 clc .8 clc
rts rts
@ -184,7 +184,7 @@ Ctrl.BS ldy #FileX
sbc #0 sbc #0
sta (pData),y sta (pData),y
.3 jsr UpdateViewPort .3 jsr SCRN.UpdateViewPort
bcs .9 bcs .9
.8 clc .8 clc
@ -222,7 +222,7 @@ Ctrl.LF ldy #FileY+1
inc inc
sta (pData),y sta (pData),y
.3 jsr UpdateViewPort .3 jsr SCRN.UpdateViewPort
bcs .9 bcs .9
.8 clc .8 clc
@ -260,7 +260,7 @@ Ctrl.VT ldy #FileY+1
sbc #0 sbc #0
sta (pData),y sta (pData),y
jsr UpdateViewPort jsr SCRN.UpdateViewPort
bcs .9 bcs .9
.8 clc .8 clc
rts rts
@ -277,7 +277,7 @@ Ctrl.L ldy #FileY+1
tya Y = line length tya Y = line length
ldy #FileX ldy #FileX
sta (pData),y sta (pData),y
jsr UpdateViewPort jsr SCRN.UpdateViewPort
bcs .9 bcs .9
.8 clc .8 clc
rts rts
@ -289,7 +289,7 @@ Ctrl.CR lda #13
ldy #FileX ldy #FileX
lda #0 lda #0
sta (pData),y sta (pData),y
jsr UpdateMain jsr SCRN.UpdateMain
bcs .9 bcs .9
clc clc
@ -317,7 +317,7 @@ Ctrl.Q lda #$FF
Ctrl.R lda #PromptModeReplace Ctrl.R lda #PromptModeReplace
ldy #PromptMode ldy #PromptMode
sta (pData),y sta (pData),y
jsr UpdateStatusBar jsr SCRN.UpdateStatusBar
bcs .9 bcs .9
clc clc
@ -343,7 +343,7 @@ Ctrl.S lda #PromptModeSave
dey dey
bpl .1 bpl .1
.2 jsr UpdateStatusBar .2 jsr SCRN.UpdateStatusBar
bcs .9 bcs .9
clc clc
@ -397,7 +397,7 @@ Ctrl.FS ldy #FileY+1
lda #0 lda #0
sta (pData),y sta (pData),y
.3 jsr UpdateViewPort .3 jsr SCRN.UpdateViewPort
bcs .9 bcs .9
.8 clc .8 clc
@ -461,15 +461,15 @@ Prompt.Editor pha
.4 jsr BUF.Del .4 jsr BUF.Del
bcs .9 bcs .9
jsr UpdateCurrentLine jsr SCRN.UpdateCurrentLine
bcs .9 bcs .9
jsr UpdateStatusBar jsr SCRN.UpdateStatusBar
bcs .9 bcs .9
rts rts
.7 jsr BUF.InsertA .7 jsr BUF.InsertA
bcs .9 bcs .9
jsr UpdateCurrentLine jsr SCRN.UpdateCurrentLine
bcs .9 bcs .9
jsr Ctrl.FS jsr Ctrl.FS
bcs .9 bcs .9
@ -480,9 +480,9 @@ Prompt.Editor pha
Prompt.Help ldy #PromptMode Prompt.Help ldy #PromptMode
lda #0 lda #0
sta (pData),y sta (pData),y
jsr UpdateMain jsr SCRN.UpdateMain
bcs .9 bcs .9
jsr UpdateStatusBar jsr SCRN.UpdateStatusBar
bcs .9 bcs .9
rts rts
.9 jmp Ctrl.Q .9 jmp Ctrl.Q
@ -493,7 +493,7 @@ Prompt.Find cmp #3
ldy #PromptMode ldy #PromptMode
lda #0 lda #0
sta (pData),y sta (pData),y
jsr UpdateStatusBar jsr SCRN.UpdateStatusBar
bcs .9 bcs .9
rts rts
@ -512,7 +512,7 @@ Prompt.Replace cmp #3
ldy #PromptMode ldy #PromptMode
lda #0 lda #0
sta (pData),y sta (pData),y
jsr UpdateStatusBar jsr SCRN.UpdateStatusBar
bcs .9 bcs .9
rts rts
@ -555,7 +555,7 @@ Prompt.Save cmp #3
jsr SaveFile jsr SaveFile
bcc .81 bcc .81
jsr UpdateStatusBarErrA jsr SCRN.UpdateStatusBarErrA
bcs .9 bcs .9
rts rts
@ -586,9 +586,9 @@ Prompt.Save cmp #3
.8 clc .8 clc
rts rts
.81 jsr UpdateTopBar .81 jsr SCRN.UpdateTopBar
bcs .9 bcs .9
.80 jsr UpdateStatusBar .80 jsr SCRN.UpdateStatusBar
bcs .9 bcs .9
rts rts

View File

@ -5,7 +5,7 @@ INC 1
AUTO 6 AUTO 6
.LIST OFF .LIST OFF
*-------------------------------------- *--------------------------------------
InitScreen ldy #ScreenH SCRN.Init ldy #ScreenH
lda (pData),y lda (pData),y
dec dec
>PUSHA >PUSHA
@ -34,14 +34,15 @@ InitScreen ldy #ScreenH
iny iny
sta (pData),y sta (pData),y
jsr UpdateTopBar jsr SCRN.UpdateTopBar
bcs .9 bcs .9
jsr UpdateViewPort jsr SCRN.UpdateViewPort
bcs .9 bcs .9
jsr UpdateMain jsr SCRN.UpdateMain
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
UpdateTopBar ldy #hFileName SCRN.UpdateTopBar
ldy #hFileName
lda (pData),y lda (pData),y
beq .1 beq .1
>SYSCALL SYS.GetMemPtrA >SYSCALL SYS.GetMemPtrA
@ -59,7 +60,7 @@ UpdateTopBar ldy #hFileName
clc clc
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
UpdateMain ldy #ScreenY SCRN.UpdateMain ldy #ScreenY
lda (pData),y lda (pData),y
sta TmpIndex sta TmpIndex
iny iny
@ -80,7 +81,7 @@ UpdateMain ldy #ScreenY
bcs .5 bcs .5
lda TmpByte lda TmpByte
jsr UpdateLineAtALenY jsr SCRN.UpdateLineAtALenY
bcs .9 bcs .9
.3 inc TmpByte .3 inc TmpByte
@ -90,7 +91,7 @@ UpdateMain ldy #ScreenY
.4 dec TmpCount .4 dec TmpCount
bne .1 bne .1
jmp GotoCurXCurY jmp SCRN.GotoCurXCurY
.5 ldx #0 .5 ldx #0
ldy TmpByte ldy TmpByte
@ -105,11 +106,11 @@ UpdateMain ldy #ScreenY
dec TmpCount dec TmpCount
bne .5 bne .5
jmp GotoCurXCurY jmp SCRN.GotoCurXCurY
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
UpdateCurrentLine SCRN.UpdateCurrentLine
ldy #ScreenY+1 ldy #ScreenY+1
lda (pData),y lda (pData),y
tax tax
@ -127,10 +128,10 @@ UpdateCurrentLine
ldy #CurY ldy #CurY
lda (pData),y lda (pData),y
ply ply
jsr UpdateLineAtALenY jsr SCRN.UpdateLineAtALenY
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
UpdateLineAtALenY SCRN.UpdateLineAtALenY
stz bSelected stz bSelected
sty TmpLen sty TmpLen
ldx #0 ldx #0
@ -157,7 +158,7 @@ UpdateLineAtALenY
phy phy
pha pha
jsr BUF.CheckSelected jsr BUF.CheckSelected
jsr UpdateAttrC jsr SCRN.UpdateAttrC
pla pla
bcs .11 bcs .11
@ -171,7 +172,7 @@ UpdateLineAtALenY
bne .1 bne .1
.3 sec .3 sec
jsr UpdateAttrC jsr SCRN.UpdateAttrC
bcs .9 bcs .9
>LDYA L.SEQ.CEOL >LDYA L.SEQ.CEOL
@ -183,7 +184,8 @@ UpdateLineAtALenY
*-------------------------------------- *--------------------------------------
* CC = set INV, CS = set NORM * CC = set INV, CS = set NORM
*-------------------------------------- *--------------------------------------
UpdateAttrC bcc .1 SCRN.UpdateAttrC
bcc .1
bit bSelected bit bSelected
bpl .8 bpl .8
@ -205,7 +207,8 @@ UpdateAttrC bcc .1
.8 clc .8 clc
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
UpdateStatusBar ldy #PromptMode SCRN.UpdateStatusBar
ldy #PromptMode
lda (pData),y lda (pData),y
tax tax
bne .2 bne .2
@ -236,7 +239,7 @@ UpdateStatusBar ldy #PromptMode
>LDYA L.MSG.STATUSBAR >LDYA L.MSG.STATUSBAR
>SYSCALL SYS.PSTRoutYA >SYSCALL SYS.PSTRoutYA
bcs .9 bcs .9
jmp GotoCurXCurY jmp SCRN.GotoCurXCurY
.2 cmp #PromptModeHelp .2 cmp #PromptModeHelp
beq .3 beq .3
@ -248,7 +251,7 @@ UpdateStatusBar ldy #PromptMode
>SYSCALL SYS.PSTRoutYA >SYSCALL SYS.PSTRoutYA
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
UpdateStatusBarErrA SCRN.UpdateStatusBarErrA
>PUSHA >PUSHA
ldy #ScreenH ldy #ScreenH
lda (pData),y lda (pData),y
@ -257,7 +260,8 @@ UpdateStatusBarErrA
>SYSCALL SYS.PSTRoutYA >SYSCALL SYS.PSTRoutYA
rts rts
*-------------------------------------- *--------------------------------------
GotoCurXCurY ldy #CurX SCRN.GotoCurXCurY
ldy #CurX
lda (pData),y lda (pData),y
tax tax
ldy #CurY ldy #CurY
@ -276,7 +280,8 @@ GotoXY txa
>SYSCALL SYS.PSTRoutYA >SYSCALL SYS.PSTRoutYA
rts rts
*-------------------------------------- *--------------------------------------
UpdateViewPort lda #$ff SCRN.UpdateViewPort
lda #$ff
sta bNotRepaint sta bNotRepaint
.1 ldy #FileX .1 ldy #FileX
@ -331,7 +336,7 @@ UpdateViewPort lda #$ff
sta (pData),y sta (pData),y
bit bNotRepaint bit bNotRepaint
bpl .3 bpl .3
jsr scrollDn jsr SCRN.scrollDn
bcc .3 bcc .3
rts rts
@ -371,7 +376,7 @@ UpdateViewPort lda #$ff
sta (pData),y sta (pData),y
bit bNotRepaint bit bNotRepaint
bpl .4 bpl .4
jsr scrollUp jsr SCRN.scrollUp
bcc .4 bcc .4
rts rts
@ -393,14 +398,14 @@ UpdateViewPort lda #$ff
bit bNotRepaint bit bNotRepaint
bmi .6 bmi .6
jsr UpdateMain jsr SCRN.UpdateMain
bcs .9 bcs .9
.6 jsr UpdateStatusBar .6 jsr SCRN.UpdateStatusBar
bcs .9 bcs .9
jsr GotoCurXCurY jsr SCRN.GotoCurXCurY
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
scrollUp lda #$1B SCRN.scrollUp lda #$1B
>SYSCALL SYS.CoutA >SYSCALL SYS.CoutA
bcs .9 bcs .9
lda #'M' lda #'M'
@ -420,14 +425,14 @@ scrollUp lda #$1B
bcs .9 bcs .9
lda #21 lda #21
jsr UpdateLineAtALenY jsr SCRN.UpdateLineAtALenY
bcs .9 bcs .9
clc clc
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
scrollDn lda #$1B SCRN.scrollDn lda #$1B
>SYSCALL SYS.CoutA >SYSCALL SYS.CoutA
bcs .9 bcs .9
lda #'D' lda #'D'
@ -443,7 +448,7 @@ scrollDn lda #$1B
bcs .9 bcs .9
lda #0 lda #0
jsr UpdateLineAtALenY jsr SCRN.UpdateLineAtALenY
bcs .9 bcs .9

View File

@ -214,7 +214,7 @@ CS.RUN ldy #bCancel
lda (pData),y for W & H lda (pData),y for W & H
beq .1 beq .1
jsr InitScreen jsr SCRN.Init
bcs .9 bcs .9
ldy #bInit ldy #bInit