mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-22 16:31:07 +00:00
907 lines
12 KiB
Plaintext
907 lines
12 KiB
Plaintext
NEW
|
||
AUTO 3,1
|
||
.LIST OFF
|
||
*--------------------------------------
|
||
DLG.Open >STYA ZPPTR2
|
||
lda (ZPPTR2)
|
||
tay
|
||
lda #0
|
||
>SYSCALL GetMem
|
||
bcs .99
|
||
|
||
>STYA ZPPTR1
|
||
txa
|
||
>STA.G hDLG
|
||
|
||
ldy #0
|
||
|
||
.1 lda (ZPPTR2),y
|
||
sta (ZPPTR1),y
|
||
iny
|
||
tya
|
||
cmp (ZPPTR2)
|
||
bne .1
|
||
|
||
jsr DLG.SetOrigin
|
||
|
||
sty TmpByte
|
||
|
||
jsr SCRN.GotoXY
|
||
bcs .9
|
||
|
||
jsr DLG.DrawTBar
|
||
.99 bcs .9
|
||
|
||
jsr SCRN.LineBufInitDLG
|
||
|
||
ldy #S.DLG.W
|
||
lda (ZPPTR1),y
|
||
dec
|
||
dec
|
||
tax
|
||
|
||
lda #C.SPACE
|
||
|
||
.3 jsr SCRN.ToLineBuf
|
||
dex
|
||
bne .3
|
||
|
||
jsr DLG.VBarToLineBuf
|
||
|
||
ldy #S.DLG.H
|
||
lda (ZPPTR1),y
|
||
dec
|
||
dec
|
||
tax
|
||
|
||
.4 phx
|
||
inc TmpByte
|
||
|
||
ldy #S.DLG.X
|
||
lda (ZPPTR1),y
|
||
tax
|
||
ldy TmpByte
|
||
jsr SCRN.GotoXY
|
||
bcs .9
|
||
|
||
jsr SCRN.LineBufOut
|
||
bcs .9
|
||
|
||
plx
|
||
dex
|
||
bne .4
|
||
|
||
inc TmpByte
|
||
|
||
ldy #S.DLG.X
|
||
lda (ZPPTR1),y
|
||
tax
|
||
|
||
ldy TmpByte
|
||
jsr SCRN.GotoXY
|
||
bcs .9
|
||
|
||
jsr DLG.DrawSBar
|
||
bcs .9
|
||
|
||
jmp DLG.CTRL.DrawAll
|
||
|
||
.9 rts
|
||
*--------------------------------------
|
||
DLG.Run jsr IO.GetCh
|
||
bcs .9
|
||
|
||
cmp #3
|
||
beq .8
|
||
|
||
cmp #C.CR
|
||
beq .8
|
||
|
||
cmp #C.TAB
|
||
beq DLG.NextFocus
|
||
|
||
pha
|
||
|
||
ldy #S.DLG.Focus
|
||
lda (ZPPTR1),y get actual focused Ctrl
|
||
|
||
tay
|
||
|
||
pla
|
||
jsr DLG.CTRL.CharIn
|
||
|
||
bra DLG.Run
|
||
|
||
.8 clc
|
||
.9 rts
|
||
*--------------------------------------
|
||
DLG.NextFocus ldy #S.DLG.Focus
|
||
lda (ZPPTR1),y get actual focused Ctrl
|
||
|
||
pha save it...
|
||
tax
|
||
|
||
.1 inx next one
|
||
|
||
.2 txa
|
||
tay
|
||
lda (ZPPTR1),y Get Ctrl
|
||
bne .3 end of list, get first
|
||
|
||
ldx #S.DLG.Ctrls
|
||
bra .2
|
||
|
||
.3 tay
|
||
lda (ZPPTR1),y Get Ctrl Type
|
||
beq .1 LBL
|
||
|
||
txa
|
||
ldy #S.DLG.Focus
|
||
sta (ZPPTR1),y
|
||
|
||
pla get old focused
|
||
|
||
phx save new focused
|
||
jsr DLG.CTRL.Focus
|
||
|
||
pla
|
||
jsr DLG.CTRL.Focus
|
||
jmp DLG.Run
|
||
*--------------------------------------
|
||
DLG.Close ldy #S.DLG.Y
|
||
lda (ZPPTR1),y
|
||
|
||
sta TmpByte
|
||
|
||
>LDA.G ScreenY
|
||
clc
|
||
ldy #S.DLG.Y
|
||
adc (ZPPTR1),y
|
||
sta TmpIndex
|
||
|
||
>LDA.G ScreenY+1
|
||
adc #0
|
||
sta TmpIndex+1
|
||
|
||
ldy #S.DLG.H
|
||
lda (ZPPTR1),y
|
||
|
||
jsr SCRN.UpdateMain.1
|
||
bcs .9
|
||
|
||
>LDA.G hDLG
|
||
>SYSCALL FreeMem
|
||
|
||
>STZ.G hDLG
|
||
clc
|
||
.9 rts
|
||
*--------------------------------------
|
||
DLG.CTRL.DrawAll
|
||
ldy #S.DLG.Ctrls
|
||
|
||
.5 lda (ZPPTR1),y
|
||
beq .8
|
||
|
||
phy
|
||
jsr DLG.CTRL.Draw
|
||
ply
|
||
bcs .9
|
||
|
||
iny
|
||
bra .5
|
||
|
||
.8 ldy #S.DLG.Focus
|
||
lda (ZPPTR1),y
|
||
jmp DLG.CTRL.Focus
|
||
|
||
.9 rts
|
||
*--------------------------------------
|
||
DLG.CTRL.Draw sty TmpByte Y=CtrlID
|
||
|
||
lda (ZPPTR1),y Ctrl Definition
|
||
tay
|
||
lda (ZPPTR1),y Ctrl Type
|
||
tax
|
||
jmp (J.DLG.CTRL.Draw,x)
|
||
*--------------------------------------
|
||
DLG.CTRL.Draw.LBL
|
||
jsr SCRN.LineBufInitLBL
|
||
|
||
jsr DLG.CTRL.GotoOrg
|
||
bcs .9
|
||
|
||
ldy TmpByte CtrlID
|
||
lda (ZPPTR1),y
|
||
tay
|
||
|
||
iny
|
||
iny
|
||
iny
|
||
|
||
.1 lda (ZPPTR1),y
|
||
beq .8
|
||
|
||
jsr SCRN.ToLineBuf
|
||
iny
|
||
bra .1
|
||
|
||
.8 jmp SCRN.LineBufOut
|
||
|
||
.9 rts
|
||
*--------------------------------------
|
||
DLG.CTRL.Draw.TB
|
||
jsr SCRN.LineBufInitTB
|
||
|
||
jsr DLG.CTRL.GotoOrg
|
||
bcs .9
|
||
|
||
ldy TmpByte
|
||
lda (ZPPTR1),y
|
||
tay
|
||
|
||
iny
|
||
iny
|
||
iny
|
||
|
||
iny
|
||
|
||
iny
|
||
|
||
lda (ZPPTR1),y
|
||
tay
|
||
lda (pData),y
|
||
|
||
>SYSCALL GetMemPtr
|
||
>STYA ZPPTR2
|
||
|
||
lda #C.SPACE
|
||
jsr SCRN.ToLineBuf
|
||
|
||
ldy #0
|
||
|
||
.1 lda (ZPPTR2),y
|
||
beq .2
|
||
|
||
jsr SCRN.ToLineBuf
|
||
iny
|
||
bra .1
|
||
|
||
.2 tya
|
||
tax
|
||
|
||
ldy TmpByte
|
||
lda (ZPPTR1),y
|
||
tay
|
||
|
||
iny
|
||
iny
|
||
iny
|
||
|
||
txa
|
||
sta (ZPPTR1),y CURPOS
|
||
iny
|
||
|
||
.3 txa
|
||
eor (ZPPTR1),y MAXCHAR
|
||
beq .8
|
||
|
||
lda #C.SPACE
|
||
jsr SCRN.ToLineBuf
|
||
inx
|
||
bra .3
|
||
|
||
.8 lda #C.SPACE
|
||
jsr SCRN.ToLineBuf
|
||
|
||
jmp SCRN.LineBufOut
|
||
.9 rts
|
||
*--------------------------------------
|
||
DLG.CTRL.Draw.OL
|
||
jsr SCRN.LineBufInitLBL
|
||
|
||
jsr DLG.CTRL.GotoOrg
|
||
bcs .9
|
||
|
||
ldy TmpByte
|
||
lda (ZPPTR1),y
|
||
tay S.DLG.Ctrl.OL
|
||
|
||
iny X
|
||
iny Y
|
||
iny shortcut
|
||
|
||
iny varptr
|
||
lda (ZPPTR1),y
|
||
phy
|
||
tay
|
||
lda (pData),y
|
||
ply
|
||
|
||
iny value
|
||
|
||
eor (ZPPTR1),y
|
||
tax
|
||
|
||
iny label
|
||
|
||
lda #'('
|
||
jsr SCRN.ToLineBuf
|
||
|
||
lda #C.SO
|
||
jsr SCRN.ToLineBuf
|
||
|
||
lda #'`'
|
||
cpx #0
|
||
beq .2
|
||
|
||
lda #C.SPACE
|
||
|
||
.2 jsr SCRN.ToLineBuf
|
||
|
||
lda #C.SI
|
||
jsr SCRN.ToLineBuf
|
||
|
||
lda #')'
|
||
jsr SCRN.ToLineBuf
|
||
|
||
lda #C.SPACE
|
||
jsr SCRN.ToLineBuf
|
||
|
||
.3 lda (ZPPTR1),y
|
||
beq .4
|
||
|
||
jsr SCRN.ToLineBuf
|
||
iny
|
||
bra .3
|
||
|
||
.4 lda #C.SPACE
|
||
jsr SCRN.ToLineBuf
|
||
|
||
.8 jmp SCRN.LineBufOut
|
||
|
||
.9 rts
|
||
*--------------------------------------
|
||
DLG.CTRL.Draw.BUT
|
||
jsr SCRN.LineBufInitBut
|
||
|
||
jsr DLG.CTRL.GotoOrg
|
||
bcs .9
|
||
|
||
ldy TmpByte CtrlID
|
||
lda (ZPPTR1),y
|
||
tay
|
||
|
||
iny
|
||
iny
|
||
iny
|
||
|
||
iny
|
||
|
||
lda #C.SPACE
|
||
jsr SCRN.ToLineBuf
|
||
|
||
.1 lda (ZPPTR1),y
|
||
beq .8
|
||
|
||
jsr SCRN.ToLineBuf
|
||
iny
|
||
bra .1
|
||
|
||
.8 lda #C.SPACE
|
||
jsr SCRN.ToLineBuf
|
||
|
||
jmp SCRN.LineBufOut
|
||
.9 rts
|
||
*--------------------------------------
|
||
DLG.CTRL.Focus sta TmpByte A=CtrlID
|
||
|
||
tay
|
||
lda (ZPPTR1),y Ctrl Definition
|
||
tay
|
||
lda (ZPPTR1),y Ctrl Type
|
||
tax
|
||
|
||
jmp (J.DLG.CTRL.Focus,x)
|
||
*--------------------------------------
|
||
DLG.CTRL.Focus.LBL
|
||
clc
|
||
rts
|
||
DLG.CTRL.Focus.TB
|
||
jsr SCRN.LineBufInitTB
|
||
|
||
jsr DLG.CTRL.GotoOrg
|
||
|
||
ldy #S.DLG.Focus
|
||
lda (ZPPTR1),y
|
||
eor TmpByte
|
||
bne .1
|
||
sec
|
||
|
||
.1 lda #C.SPACE
|
||
bcc .2
|
||
lda #'['
|
||
.2 jsr SCRN.ToLineBuf
|
||
|
||
jsr DLG.CTRL.GotoEnd
|
||
|
||
ldy #S.DLG.Focus
|
||
lda (ZPPTR1),y
|
||
eor TmpByte
|
||
bne .3
|
||
sec
|
||
|
||
.3 lda #C.SPACE
|
||
bcc .4
|
||
lda #']'
|
||
.4 jsr SCRN.ToLineBuf
|
||
|
||
jsr SCRN.LineBufOut
|
||
|
||
ldy TmpByte CtrlID
|
||
lda (ZPPTR1),y
|
||
tay
|
||
|
||
iny skip Ctrl Type
|
||
lda (ZPPTR1),y
|
||
clc
|
||
|
||
ldy #S.DLG.X
|
||
adc (ZPPTR1),y
|
||
pha
|
||
|
||
ldy TmpByte CtrlID
|
||
lda (ZPPTR1),y
|
||
tay
|
||
|
||
iny
|
||
iny
|
||
iny
|
||
pla
|
||
|
||
sec +1
|
||
adc (ZPPTR1),y
|
||
tax
|
||
|
||
ldy TmpByte CtrlID
|
||
lda (ZPPTR1),y
|
||
tay
|
||
|
||
iny skip Ctrl Type
|
||
iny skip X
|
||
|
||
lda (ZPPTR1),y
|
||
clc
|
||
ldy #S.DLG.Y
|
||
adc (ZPPTR1),y
|
||
|
||
tay
|
||
|
||
jmp SCRN.GotoXY
|
||
|
||
DLG.CTRL.Focus.OL
|
||
jsr SCRN.LineBufInitLBL
|
||
|
||
jsr DLG.CTRL.GotoOrg
|
||
|
||
ldy #S.DLG.Focus
|
||
lda (ZPPTR1),y
|
||
eor TmpByte
|
||
bne .1
|
||
sec
|
||
|
||
.1 lda #'('
|
||
bcc .2
|
||
lda #'['
|
||
.2 jsr SCRN.ToLineBuf
|
||
|
||
jsr DLG.CTRL.GotoEnd
|
||
|
||
ldy #S.DLG.Focus
|
||
lda (ZPPTR1),y
|
||
eor TmpByte
|
||
bne .3
|
||
sec
|
||
|
||
.3 lda #')'
|
||
bcc .4
|
||
lda #']'
|
||
.4 jsr SCRN.ToLineBuf
|
||
|
||
lda #C.BS
|
||
jsr SCRN.ToLineBuf
|
||
jsr SCRN.ToLineBuf
|
||
jmp SCRN.LineBufOut
|
||
|
||
DLG.CTRL.Focus.BUT
|
||
jsr SCRN.LineBufInitBut
|
||
|
||
jsr DLG.CTRL.GotoOrg
|
||
|
||
ldy #S.DLG.Focus
|
||
lda (ZPPTR1),y
|
||
eor TmpByte
|
||
bne .1
|
||
sec
|
||
|
||
.1 lda #C.SPACE
|
||
bcc .2
|
||
lda #'['
|
||
.2 jsr SCRN.ToLineBuf
|
||
|
||
jsr DLG.CTRL.GotoEnd
|
||
|
||
ldy #S.DLG.Focus
|
||
lda (ZPPTR1),y
|
||
eor TmpByte
|
||
bne .3
|
||
sec
|
||
|
||
.3 lda #C.SPACE
|
||
bcc .4
|
||
lda #']'
|
||
.4 jsr SCRN.ToLineBuf
|
||
|
||
jmp SCRN.LineBufOut
|
||
*--------------------------------------
|
||
DLG.CTRL.GotoOrg
|
||
clc
|
||
.HS B0 BCS
|
||
DLG.CTRL.GotoEnd
|
||
sec
|
||
php
|
||
|
||
ldy TmpByte CtrlID
|
||
lda (ZPPTR1),y
|
||
tay
|
||
|
||
iny skip Ctrl Type
|
||
lda (ZPPTR1),y
|
||
clc
|
||
|
||
ldy #S.DLG.X
|
||
adc (ZPPTR1),y
|
||
plp
|
||
bcc .1
|
||
|
||
>PUSHA
|
||
jsr DLG.CTRL.GetWitdh
|
||
clc
|
||
adc (pStack)
|
||
inc pStack
|
||
|
||
.1 tax
|
||
|
||
ldy TmpByte CtrlID
|
||
lda (ZPPTR1),y
|
||
tay
|
||
|
||
iny skip Ctrl Type
|
||
iny skip X
|
||
|
||
lda (ZPPTR1),y
|
||
clc
|
||
ldy #S.DLG.Y
|
||
adc (ZPPTR1),y
|
||
|
||
tay
|
||
|
||
DLG.CTRL.GotoXY >PUSHW LineBufPtr
|
||
>PUSHW L.MSG.GOTOXY
|
||
tya
|
||
inc
|
||
inc
|
||
>PUSHA
|
||
txa
|
||
inc
|
||
>PUSHA
|
||
>PUSHBI 2
|
||
>SYSCALL SPrintF
|
||
|
||
.2 lda (LineBufPtr)
|
||
beq .8
|
||
inc LineBufPtr
|
||
bne .2
|
||
inc LineBufPtr+1
|
||
bra .2
|
||
|
||
.8 rts
|
||
*--------------------------------------
|
||
DLG.SetOrigin ldy #S.DLG.X
|
||
lda (ZPPTR1),y
|
||
bne .1
|
||
|
||
>LDA.G ScreenW
|
||
ldy #S.DLG.W
|
||
sec
|
||
sbc (ZPPTR1),y
|
||
|
||
lsr
|
||
|
||
ldy #S.DLG.X
|
||
sta (ZPPTR1),y
|
||
|
||
.1 tax
|
||
|
||
ldy #S.DLG.Y
|
||
lda (ZPPTR1),y
|
||
bne .2
|
||
|
||
>LDA.G ViewPortHm1
|
||
ldy #S.DLG.H
|
||
sec
|
||
sbc (ZPPTR1),y
|
||
|
||
lsr
|
||
ldy #S.DLG.Y
|
||
sta (ZPPTR1),y
|
||
|
||
.2 tay
|
||
|
||
rts
|
||
*--------------------------------------
|
||
DLG.CTRL.GetWitdh
|
||
ldy TmpByte CtrlID
|
||
lda (ZPPTR1),y
|
||
tay
|
||
|
||
lda (ZPPTR1),y
|
||
tax
|
||
|
||
jmp (J.DLG.CTRL.GetWitdh,x)
|
||
*--------------------------------------
|
||
DLG.CTRL.GetWitdh.LBL
|
||
clc
|
||
rts
|
||
DLG.CTRL.GetWitdh.TB
|
||
iny
|
||
iny
|
||
iny
|
||
iny
|
||
lda (ZPPTR1),y
|
||
inc
|
||
rts
|
||
|
||
DLG.CTRL.GetWitdh.OL
|
||
lda #2
|
||
rts
|
||
|
||
iny
|
||
iny
|
||
iny
|
||
iny
|
||
|
||
ldx #0
|
||
|
||
.1 inx
|
||
iny
|
||
lda (ZPPTR1),y
|
||
bne .1
|
||
|
||
txa
|
||
rts
|
||
|
||
DLG.CTRL.GetWitdh.BUT
|
||
iny
|
||
iny
|
||
iny
|
||
|
||
ldx #0
|
||
|
||
.1 inx
|
||
iny
|
||
lda (ZPPTR1),y
|
||
bne .1
|
||
|
||
txa
|
||
rts
|
||
*--------------------------------------
|
||
DLG.CTRL.CharIn sty TmpByte A=CtrlID
|
||
pha
|
||
|
||
lda (ZPPTR1),y Ctrl Definition
|
||
tay
|
||
lda (ZPPTR1),y Ctrl Type
|
||
tax
|
||
pla
|
||
jmp (J.DLG.CTRL.CharIn,x)
|
||
*--------------------------------------
|
||
DLG.CTRL.CharIn.LBL
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
DLG.CTRL.CharIn.TB
|
||
cmp #C.DEL
|
||
beq .5
|
||
|
||
cmp #C.SPACE
|
||
bcc .9
|
||
|
||
pha
|
||
|
||
iny
|
||
iny
|
||
iny
|
||
lda (ZPPTR1),y CURPOS
|
||
iny
|
||
cmp (ZPPTR1),y MAXCHAR
|
||
beq .7
|
||
|
||
pha
|
||
|
||
inc
|
||
dey
|
||
sta (ZPPTR1),y CURPOS
|
||
|
||
iny
|
||
iny
|
||
|
||
lda (ZPPTR1),y hMem
|
||
tay
|
||
lda (pData),y
|
||
>SYSCALL GetMemPtr
|
||
>STYA ZPPTR2
|
||
|
||
ply
|
||
|
||
pla
|
||
pha
|
||
|
||
sta (ZPPTR2),y
|
||
iny
|
||
lda #0
|
||
sta (ZPPTR2),y
|
||
|
||
pla
|
||
>SYSCALL PutChar
|
||
clc
|
||
rts
|
||
|
||
.5 iny
|
||
iny
|
||
iny
|
||
lda (ZPPTR1),y CURPOS
|
||
beq .8
|
||
|
||
dec
|
||
sta (ZPPTR1),y
|
||
pha
|
||
|
||
iny
|
||
iny
|
||
|
||
lda (ZPPTR1),y hMem
|
||
tay
|
||
lda (pData),y
|
||
>SYSCALL GetMemPtr
|
||
>STYA ZPPTR2
|
||
|
||
ply
|
||
lda #0
|
||
sta (ZPPTR2),y
|
||
|
||
lda #C.DEL
|
||
>SYSCALL PutChar
|
||
clc
|
||
rts
|
||
|
||
.7 pla
|
||
|
||
.8 clc
|
||
rts
|
||
|
||
.9 sec
|
||
rts
|
||
*--------------------------------------
|
||
DLG.CTRL.CharIn.OL
|
||
cmp #C.SPACE
|
||
bne .8
|
||
|
||
iny X
|
||
iny Y
|
||
iny shortcut
|
||
|
||
iny varptr
|
||
|
||
lda (ZPPTR1),y
|
||
pha
|
||
|
||
iny value
|
||
lda (ZPPTR1),y
|
||
|
||
ply
|
||
sta (pData),y
|
||
|
||
jmp DLG.CTRL.DrawAll
|
||
|
||
.8 clc
|
||
rts
|
||
*--------------------------------------
|
||
DLG.CTRL.CharIn.BUT
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
DLG.DrawTBar ldx #SEQ.DLG.TBAR-SEQS
|
||
jsr SCRN.LineBufInit
|
||
|
||
ldy #S.DLG.W
|
||
lda (ZPPTR1),y
|
||
dec
|
||
dec
|
||
tax
|
||
|
||
ldy #S.DLG.Title
|
||
lda (ZPPTR1),y
|
||
tay
|
||
|
||
.1 lda (ZPPTR1),y
|
||
beq .11
|
||
|
||
jsr SCRN.ToLineBuf
|
||
dex
|
||
beq .3
|
||
|
||
iny
|
||
bra .1
|
||
|
||
.11 lda #C.SPACE
|
||
|
||
.2 jsr SCRN.ToLineBuf
|
||
dex
|
||
bne .2
|
||
|
||
.3 ldx #SEQ.DLG.TBAR.E-SEQS
|
||
jsr SCRN.SEQS.ToLineBuf
|
||
|
||
.4 jmp SCRN.LineBufOut
|
||
*--------------------------------------
|
||
DLG.DrawSBar ldx #SEQ.DLG.SBAR-SEQS
|
||
jsr SCRN.LineBufInit
|
||
|
||
ldy #S.DLG.W
|
||
lda (ZPPTR1),y
|
||
dec
|
||
dec
|
||
tax
|
||
|
||
ldy #S.DLG.Status
|
||
lda (ZPPTR1),y
|
||
tay
|
||
|
||
.1 lda (ZPPTR1),y
|
||
beq .11
|
||
|
||
jsr SCRN.ToLineBuf
|
||
dex
|
||
beq .3
|
||
|
||
iny
|
||
bra .1
|
||
|
||
.11 lda #C.SPACE
|
||
|
||
.2 jsr SCRN.ToLineBuf
|
||
dex
|
||
bne .2
|
||
|
||
.3 ldx #SEQ.DLG.SBAR.E-SEQS
|
||
jsr SCRN.SEQS.ToLineBuf
|
||
|
||
.4 jmp SCRN.LineBufOut
|
||
*--------------------------------------
|
||
DLG.VBarToLineBuf
|
||
ldy #0
|
||
|
||
.1 lda SEQ.DLG.VBAR,y
|
||
beq .8
|
||
|
||
jsr SCRN.ToLineBuf
|
||
iny
|
||
bra .1
|
||
|
||
.8 rts
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE usr/src/bin/edit.s.dlg
|
||
LOAD usr/src/bin/edit.s
|
||
ASM
|