Kernel 0.92 : EDIT, DNSINFO, REN

This commit is contained in:
Rémy GIBERT 2018-11-15 16:04:14 +01:00
parent 11cf7334f8
commit 09812b03e6
13 changed files with 150 additions and 136 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -72,14 +72,13 @@ CS.RUN.ADD >PUSHEA.G DST.IP+3
>PUSHEA.G DST.IP
>PUSHBI 8 4 PTRs
>PUSHW L.SSCANF.IP
lda #1
lda #2
>SYSCALL ArgV
>SYSCALL sscanf
bcs .9
>PUSHEA.G DST.IP
lda #2
lda #1
>SYSCALL ArgV
>PUSHYA
>LIBCALL hLIBTCPIP,LIBTCPIP.DNS.ADD
@ -167,7 +166,7 @@ SSCANF.IP .AZ "%d.%d.%d.%d"
MSG0 .AZ "STS TR.ID Hostname IP Address TTL"
MSG1 .AZ "$%h $%H %32s %03d.%03d.%03d.%03d %u\r\n"
MSG.USAGE .AS "Usage : Add a static entry, DNSINFO <host> <IP>\r\n"
.AZ " Dump DNS Cache, DNSINFO \r\n"
.AZ " Dump DNS Cache, DNSINFO\r\n"
*--------------------------------------
DS.START
DST.IP .BS 4

View File

@ -92,16 +92,8 @@ BUF.InsertA sta TmpByte
.3 jsr BUF.CopyTail
.4 ldy #FileLen
lda (pData),y
inc
sta (pData),y
bne .8
iny
lda (pData),y
inc
sta (pData),y
.4 >INCW.G FileLen
.8 clc
.9 rts
*--------------------------------------
@ -317,27 +309,34 @@ BUF.CopyClipboard
*--------------------------------------
BUF.CopyCount jsr DecTmpCount
beq .9
lda (BufPtrBackup)
sta (BufPtr)
inc BufPtrBackup
bne .1
inc BufPtrBackup+1
.1 inc BufPtr
bne BUF.CopyCount
inc BufPtr+1
bra BUF.CopyCount
.9 rts
*--------------------------------------
BUF.CopyTail lda (BufPtrBackup)
beq .9
sta (BufPtr)
beq .9
inc BufPtrBackup
bne .1
inc BufPtrBackup+1
.1 inc BufPtr
bne BUF.CopyTail
inc BufPtr+1
bra BUF.CopyTail
.9 rts
*--------------------------------------
* Out : Y = Line Length
@ -440,15 +439,14 @@ BUF.GetCharAtY tya
rts
*--------------------------------------
BUF.GetNewYA >STYA TmpLen
ldy #hBufferBackup
lda (pData),y
>LDA.G hBufferBackup
beq .1
>SYSCALL FreeMem
.1 ldy #hBuffer
lda (pData),y
ldy #hBufferBackup
sta (pData),y
.1 >LDA.G hBuffer
>STA.G hBufferBackup
>SYSCALL GetMemPtr
>STYA BufPtrBackup
@ -458,20 +456,12 @@ BUF.GetNewYA >STYA TmpLen
>STYA BufPtr
txa
ldy #hBuffer
sta (pData),y
>STA.G hBuffer
.9 rts
*--------------------------------------
BUF.ResetSel lda #0
ldy #SelStart
sta (pData),y
iny
sta (pData),y
ldy #SelEnd
sta (pData),y
iny
sta (pData),y
BUF.ResetSel >STZW.G SelStart
>STZW.G SelEnd
rts
*--------------------------------------
BUF.CheckSelected

View File

@ -33,9 +33,8 @@ Ctrl.Invalid
clc
rts
*--------------------------------------
Ctrl.A ldy #PromptMode
lda #PromptModeHelp
sta (pData),y
Ctrl.A lda #PromptModeHelp
>STA.G PromptMode
>LDYA L.MSG.HELP
>STYA ZPPTR1
@ -101,8 +100,7 @@ Ctrl.E jsr BUF.ComputeCOffset
.9 jmp Ctrl.Q
*--------------------------------------
Ctrl.F lda #PromptModeFind
ldy #PromptMode
sta (pData),y
>STA.G PromptMode
jsr SCRN.UpdateStatusBar
bcs .9
@ -249,9 +247,10 @@ Ctrl.L jsr BUF.GetLine
rts
.9 jmp Ctrl.Q
*--------------------------------------
Ctrl.CR lda #13
Ctrl.CR lda #C.CR
jsr BUF.InsertA
bcs .9
ldy #FileX
lda #0
sta (pData),y
@ -339,14 +338,40 @@ Ctrl.P ldy #FileY+1
jmp Ctrl.Y
*--------------------------------------
Ctrl.Q lda #$FF
ldy #bCANCEL
sta (pData),y
>STA.G bCANCEL
clc
rts
*--------------------------------------
Ctrl.R lda #PromptModeReplace
ldy #PromptMode
>STA.G PromptMode
jsr SCRN.UpdateStatusBar
bcs .9
rts
.9 jmp Ctrl.Q
*--------------------------------------
Ctrl.S lda #PromptModeSave
>STA.G PromptMode
>LDA.G hFileName
beq .2
>SYSCALL GetMemPtr
>STYA ZPPTR1
ldy #$ff
.1 iny
lda (ZPPTR1),y
sta (pData),y
bne .1
tya
.2 >STA.G PromptBufPtr
jsr SCRN.UpdateStatusBar
bcs .9
@ -354,39 +379,9 @@ Ctrl.R lda #PromptModeReplace
rts
.9 jmp Ctrl.Q
*--------------------------------------
Ctrl.S lda #PromptModeSave
ldy #PromptMode
sta (pData),y
Ctrl.T >STZ.G FileX
>STZW.G FileY
ldy #hFileName
lda (pData),y
beq .2
>SYSCALL GetMemPtr
>STYA ZPPTR1
lda (ZPPTR1)
tay
.1 lda (ZPPTR1),y
sta (pData),y
dey
bpl .1
.2 jsr SCRN.UpdateStatusBar
bcs .9
clc
rts
.9 jmp Ctrl.Q
*--------------------------------------
Ctrl.T lda #0
ldy #FileX
sta (pData),y
ldy #FileY
sta (pData),y
iny
sta (pData),y
jsr SCRN.UpdateViewPort
bcs .9
rts
@ -509,8 +504,7 @@ Ctrl.Y ldy #FileY+1
.2 jsr BUF.GetLine Y=linelen
tya Y = line length
ldy #FileX
sta (pData),y
>STA.G FileX
jsr SCRN.UpdateViewPort
bcs .9
@ -523,10 +517,10 @@ Ctrl.Z clc
Ctrl.ESC clc
rts
*--------------------------------------
Prompt.Editor cmp #127
Prompt.Editor cmp #C.DEL
beq .4
cmp #$20
cmp #C.SPACE
bcs .7
asl
@ -535,14 +529,18 @@ Prompt.Editor cmp #127
.4 jsr BUF.Del
bcs .9
cmp #13
cmp #C.CR did we DEL a CR ?
bne .5
jsr SCRN.UpdateMain
bcs .9
bra .6
.5 jsr SCRN.UpdateCurrentLine
bcs .9
.6 jsr SCRN.UpdateStatusBar
bcs .9
rts
@ -557,22 +555,21 @@ Prompt.Editor cmp #127
.9 jmp Ctrl.Q
*--------------------------------------
Prompt.Help ldy #PromptMode
lda #0
sta (pData),y
Prompt.Help >STZ.G PromptMode
jsr SCRN.UpdateMain
bcs .9
jsr SCRN.UpdateStatusBar
bcs .9
rts
.9 jmp Ctrl.Q
*--------------------------------------
Prompt.Find cmp #3
bne .1
ldy #PromptMode
lda #0
sta (pData),y
>STZ.G PromptMode
jsr SCRN.UpdateStatusBar
bcs .9
rts
@ -589,9 +586,8 @@ Prompt.Find cmp #3
Prompt.Replace cmp #3
bne .1
ldy #PromptMode
lda #0
sta (pData),y
>STZ.G PromptMode
jsr SCRN.UpdateStatusBar
bcs .9
rts
@ -606,64 +602,69 @@ Prompt.Replace cmp #3
rts
.9 jmp Ctrl.Q
*--------------------------------------
Prompt.Save cmp #3
Prompt.Save cmp #3 Ctrl-C
bne .1
ldy #PromptMode
lda #0
sta (pData),y
>STZ.G PromptMode
bra .80
.1 cmp #13
.1 cmp #C.CR
bne .2
lda (pData)
>LDA.G PromptBufPtr
beq .8
ldy #hFileName
lda (pData),y
>LDYA pData
>SYSCALL RealPath
bcs .12
phx
>LDA.G hFileName
beq .11
>SYSCALL FreeMem
.11 pla
>STA.G hFileName
.11 >LDYA pData
>SYSCALL NewStr
txa
ldy #hFileName
sta (pData),y
ldy #PromptMode
lda #0
sta (pData),y
>STZ.G PromptMode
jsr SaveFile
bcc .81
jsr SCRN.UpdateStatusBarErrA
.12 jsr SCRN.UpdateStatusBarErrA
bcs .9
rts
.2 cmp #127
bne .3
lda (pData)
>LDA.G PromptBufPtr
beq .8
dec
sta (pData)
sta (pData),y
tay
lda #0
sta (pData),y
bra .80
.3 cmp #$20
.3 cmp #C.SPACE
bcc .8
pha
lda (pData)
>LDA.G PromptBufPtr
tay
pla
cpy #PromptBufferMax
cpy #PromptBufMax
beq .8
sta (pData),y
iny
lda #0
sta (pData),y
tya
sta (pData)
>STA.G PromptBufPtr
bra .80
.8 clc

View File

@ -145,8 +145,10 @@ SCRN.UpdateLineAtALenY
jsr BUF.GetCharAtY
beq .3
cmp #13
cmp #C.CR
beq .3
phx
phy
pha
@ -456,6 +458,7 @@ SCRN.UpdateViewPort
lda (pData),y
adc #0
sta (pData),y
bit bNotRepaint
bpl .4

View File

@ -16,7 +16,7 @@ BufPtr .EQ ZPBIN+4
BufPtrBackup .EQ ZPBIN+6
ClipboardPtr .EQ ZPBIN+8
*--------------------------------------
PromptBufferMax .EQ 64
PromptBufMax .EQ 64
PromptModeHelp .EQ 2
PromptModeFind .EQ 4
PromptModeReplace .EQ 6
@ -144,9 +144,12 @@ CS.RUN >PUSHBI 0
CS.RUN.LOOP >SLEEP
>SYSCALL GetChar
bcs CS.RUN.LOOP
bcc .1
tay
beq CS.RUN.LOOP no char
bra .9 I/O eror
jsr CharIn
.1 jsr CharIn
>LDA.G bCancel
bpl CS.RUN.LOOP
@ -156,7 +159,7 @@ CS.RUN.LOOP >SLEEP
>SYSCALL printf
lda #0
sec
.9 sec
CS.RUN.RTS rts
*--------------------------------------
CS.DOEVENT sec
@ -180,8 +183,8 @@ CS.QUIT ldy #hBuffer
*--------------------------------------
CharIn tax
ldy #bEscMode
lda (pData),y
>LDA.G bEscMode
asl
txa
bcc .1 Not in ESC mode
@ -206,29 +209,24 @@ CharIn tax
jsr CharIn.Esc
bcs .8 Not translated, exit
.1 cmp #27 Esc ?
.1 cmp #C.ESC
bne .2
ldy #bEscMode
lda #$ff
sta (pData),y
>STA.G bEscMode
inc
ldy #EscBuffer
sta (pData),y
>STA.G EscBuffer
.8 clc
rts
.2 pha
ldy #PromptMode
lda (pData),y
>LDA.G PromptMode
tax
pla
jmp (J.PROMPT,x)
*--------------------------------------
CharIn.Esc ldy #bEscMode
lda #0
sta (pData),y
CharIn.Esc >STZ.G bEscMode
ldy #EscBuffer
lda (pData),y
@ -486,7 +484,7 @@ MSG.HELP >PSTR "All commands: (* = Not yet implemented)"
>PSTR " Ctrl-Z : * Undo previous change"
.HS 00
*--------------------------------------
MSG.NEWFILE >PSTR "(new file)"
MSG.NEWFILE .AZ "(new file)"
EscChars >PSTR "DBAC"
EscAscii .HS 04080A0B15
hMem .BS 1
@ -506,7 +504,8 @@ bSelected .BS 1
.DUMMY
.OR 0
DS.START
PromptBuffer .BS PromptBufferMax+1
PromptBuf .BS PromptBufMax+1
PromptBufPtr .BS 1
PromptMode .BS 1
bCancel .BS 1
bSaved .BS 1

View File

@ -236,6 +236,12 @@ AUTO 4,1
inc
sta (pData),y
.EM
*--------------------------------------
.MA STZW.G
>STZ.G ]1
iny
sta (pData),y
.EM
*--------------------------------------
.MA INCW.G
>INC.G ]1

View File

@ -263,6 +263,7 @@ OApple+1,OApple+2,OApple+3 to switch between screens : Kernel Log, text, DHGR.
| Name | Status | Comment |
| ---- | ------ | ------- |
| CD | Working | Improved syntax : now, 'CD ../BIN' works |
| REN | Working | Rename a file, directorey or volume |
| MD | Working | Create a directory |
| RD | Working | Delete an empty directory |
| PWD | Working | Print Working Directory |

View File

@ -428,6 +428,18 @@ Cmd.INT.MD ldx #1
>SYSCALL MKDir
rts
.9 jmp Cmd.Exec.ERRSYN
*--------------------------------------
Cmd.INT.REN ldx #2
jsr Cmd.GetArgX
bcs .9
>PUSHYA
ldx #1
jsr Cmd.GetArgX
>SYSCALL Rename
rts
.9 jmp Cmd.Exec.ERRSYN
*--------------------------------------
Cmd.INT.RD ldx #1

View File

@ -23,12 +23,13 @@ C.PAUSE .EQ 14
C.PWD .EQ 16
C.RD .EQ 18
C.READ .EQ 20
C.SET .EQ 22
C.SLEEP .EQ 24
C.TIME .EQ 26
C.REN .EQ 22
C.SET .EQ 24
C.SLEEP .EQ 26
C.TIME .EQ 28
*--------------------------------------
C.ELSE .EQ 28
C.FI .EQ 30
C.ELSE .EQ 30
C.FI .EQ 32
*--------------------------------------
.INB INC/MACROS.I
.INB INC/A2OSX.I
@ -114,6 +115,7 @@ J.CMD.INT .DA Cmd.INT.STARTPROC
.DA Cmd.INT.PWD
.DA Cmd.INT.RD
.DA Cmd.INT.READ
.DA Cmd.INT.REN
.DA Cmd.INT.SET
.DA Cmd.INT.SLEEP
.DA Cmd.INT.TIME
@ -506,6 +508,7 @@ CMD.INT .AZ "STARTPROC"
.AZ "PWD"
.AZ "RD"
.AZ "READ"
.AZ "REN"
.AZ "SET"
.AZ "SLEEP"
.AZ "TIME"