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

View File

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

View File

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

View File

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