A2osX/LIB/LIBGUI.S.txt

537 lines
12 KiB
Plaintext
Raw Normal View History

NEW
2019-07-30 08:57:25 +00:00
AUTO 3,1
2020-09-04 15:21:15 +00:00
.LIST OFF
.OP 65C02
.OR $2000
2019-12-03 15:42:17 +00:00
.TF lib/libgui
*--------------------------------------
2020-06-30 15:32:23 +00:00
.INB inc/macros.i
.INB inc/a2osx.i
.INB inc/io.i
.INB inc/mli.i
2020-06-30 15:32:23 +00:00
.INB inc/gfx.i
.INB inc/xy.i
2020-06-30 15:32:23 +00:00
.INB inc/libgui.i
2018-05-16 06:02:57 +00:00
*--------------------------------------
WND.MAX .EQ 64
2020-10-13 15:54:55 +00:00
MENU.MAX .EQ 4
*--------------------------------------
.MA SWAP16
lda ]1
ldx ]2
stx ]1
sta ]2
lda ]1+1
ldx ]2+1
stx ]1+1
sta ]2+1
.EM
2020-09-04 15:21:15 +00:00
.MA NOT16
sec
lda #0
sbc ]1
sta ]1
lda #0
sbc ]1+1
sta ]1+1
.EM
2020-09-04 15:21:15 +00:00
.MA SCMPAX
sec
sbc ]1
txa
sbc ]1+1
bvc :1
eor #$80
2020-09-04 15:21:15 +00:00
:1 .EQ *
.EM
.MA SCMPYA
cpy ]1
sbc ]1+1
bvc :1
eor #$80
:1 .EQ *
.EM
.MA STYAIFGTR
tax
>SCMPYA ]1
bmi :1
sty ]1
stx ]1+1
:1 .EQ *
.EM
.MA STYAIFLWR
tax
>SCMPYA ]1
bpl :1
sty ]1
stx ]1+1
:1 .EQ *
2019-10-03 06:25:27 +00:00
.EM
*--------------------------------------
2020-09-05 13:38:04 +00:00
.DUMMY
.OR ZPLIB
2020-09-15 14:48:35 +00:00
ZPObjPtr .BS 2
2022-10-25 06:05:54 +00:00
ZPRECTPtr .BS 2
2020-09-05 13:38:04 +00:00
ZPWNDPtr .BS 2
2020-10-12 06:04:19 +00:00
ZPBMPtr .BS 2
2022-10-26 06:12:16 +00:00
ZPCBBufPtr .BS 2
2020-10-15 15:19:13 +00:00
ZPPtr1 .BS 2
2022-10-26 06:12:16 +00:00
ZPPtr2 .BS 2
TmpW .BS 2
2022-10-25 06:05:54 +00:00
2020-09-05 13:38:04 +00:00
DX .BS 2
DY .BS 2
IE .BS 2
INE .BS 2
2020-10-20 06:01:04 +00:00
D .BS 2
2020-09-05 13:38:04 +00:00
Counter .BS 2
2018-05-16 06:02:57 +00:00
2020-10-20 06:01:04 +00:00
CLIP.Line.P1 .BS 1
CLIP.Line.P2 .BS 1
IY .BS 1
2020-09-08 15:31:41 +00:00
hCBBuf .BS 1
2020-09-05 13:38:04 +00:00
.ED
2016-06-15 06:21:42 +00:00
*--------------------------------------
* File Header (16 Bytes)
*--------------------------------------
CS.START cld
jmp (.1,x)
.DA #$61 6502,Level 1 (65c02)
.DA #1 BIN Layout Version 1
.DA 0
.DA CS.END-CS.START
.DA 0
.DA 0
.DA 0
*--------------------------------------
* Relocation Table
*--------------------------------------
.1 .DA LIB.LOAD
.DA LIB.UNLOAD
.DA PTR.Set
.DA PTR.SetPos
.DA PTR.Hide
.DA PTR.Show
.DA PTR.Update
.DA DRAW.Line
2022-11-02 06:54:30 +00:00
.DA DRAW.Fill
.DA DRAW.BitMap
.DA DRAW.Text
2020-10-26 06:38:50 +00:00
.DA OBJ.SetProp
.DA OBJ.GetProp
2020-10-01 15:30:25 +00:00
.DA WND.New
.DA WND.Destroy
2020-09-08 15:31:41 +00:00
.DA WND.Show
2020-10-01 15:30:25 +00:00
.DA WND.Paint
.DA WND.SetMBar
2022-10-11 06:20:24 +00:00
.DA MSG.Get
2022-11-02 06:54:30 +00:00
.DA MBOX.MsgBox
*--------------------------------------
2020-10-01 15:30:25 +00:00
L.WND.fPaint .DA WND.fPaint
2019-01-09 16:42:20 +00:00
*--------------------------------------
L.DEVNAME.GFX .DA DEVNAME.GFX
L.DEVNAME.MOUSE .DA DEVNAME.MOUSE
2018-05-16 06:02:57 +00:00
L.SYSX7 .DA SYSX7
L.SYSX7B .DA SYSX7B
2019-01-09 16:42:20 +00:00
L.IOCTL .DA IOCTL
2019-01-08 16:29:26 +00:00
L.DCB.GFX .DA DCB.GFX
L.MouseClamp .DA MouseClamp
L.MSG .DA MSG
2022-10-26 15:20:15 +00:00
L.MSG.XY .DA MSG+S.MSG.X1
2020-10-06 06:27:35 +00:00
L.CB.PTR .DA CB.PTR
L.CB.Cache .DA CB.Cache CB.GFXWrite
.DA CLIP.Cache CB.GFXWrite
2020-09-06 12:24:04 +00:00
L.WND.Screen .DA WND.Screen
2019-01-10 16:26:58 +00:00
L.WND.Desktop .DA WND.Desktop
L.WND.SysBar .DA WND.SysBar
2020-10-08 15:33:38 +00:00
L.WND.SysBar.2osX .DA WND.SysBar.2osX
2020-10-20 06:01:04 +00:00
L.WND.SysBar.Clk .DA WND.SysBar.Clk
2020-10-15 06:16:45 +00:00
L.RECT.SysBut .DA RECT.SysBut
L.RECT.SysWNDs .DA RECT.SysWNDs
L.RECT.SysClk .DA RECT.SysClk
2020-10-08 15:33:38 +00:00
L.MENU.Sys .DA MENU.Sys
2020-10-23 15:23:19 +00:00
L.MENU.Sys.Programs .DA MENU.Sys.Programs
2020-10-20 06:01:04 +00:00
L.MENU.Sys.Settings .DA MENU.Sys.Settings
L.TEXTBUF .DA TEXTBUF
2019-01-10 16:26:58 +00:00
*--------------------------------------
2020-10-12 06:04:19 +00:00
L.BMs .EQ *-2
2019-01-10 16:26:58 +00:00
L.BM.Apple .DA BM.Apple
2020-09-14 14:31:41 +00:00
L.BM.Close .DA BM.Close
L.BM.Max .DA BM.Max
L.BM.Min .DA BM.Min
2020-10-16 15:25:29 +00:00
L.BM.Left .DA BM.Left
L.BM.Right .DA BM.Right
L.BM.Up .DA BM.Up
L.BM.Down .DA BM.Down
2022-10-27 15:14:06 +00:00
L.BM.Info .DA BM.Info
2019-01-09 16:42:20 +00:00
*--------------------------------------
L.BUT.Labels .DA BUT.L.OK
.DA BUT.L.CANCEL
.DA BUT.L.RETRY
.DA BUT.L.IGNORE
.DA BUT.L.YES
.DA BUT.L.NO
*--------------------------------------
L.PTR.SaveBuf .DA PTR.SaveBuf
L.Cursors .DA PTR.Arrow
.DA PTR.Move
.DA PTR.ResizeX
.DA PTR.ResizeY
.DA PTR.ResizeXY1
.DA PTR.ResizeXY2
.DA PTR.Cross
.DA PTR.Text
.DA PTR.Wait1
.DA PTR.Wait2
.DA PTR.Wait3
.DA PTR.Wait4
.DA PTR.Wait5
.DA PTR.Wait6
*--------------------------------------
J.Clip .DA CLIP.Point SETPIXEL
.DA CLIP.Point GETPIXEL
2020-09-30 15:32:54 +00:00
.DA CLIP.HLine HLINE
.DA CLIP.VLine VLINE
2022-11-03 06:59:03 +00:00
.DA CLIP.Rectangle FILLRECT
2020-09-30 15:32:54 +00:00
.DA CLIP.BitBlt BITBLT
2022-11-03 06:59:03 +00:00
.DA CLIP.Rectangle GETRECTBUFSIZE
2020-09-30 15:32:54 +00:00
.DA CLIP.Text DRAWTEXT
.DA CLIP.Text GETTEXTSIZE
.DA CLIP.Line DRAWLINE
.DA CLIP.BitBlt DRAWTEXT2
*--------------------------------------
J.OBJ.Enter .DA WND.Enter
.DA MBAR.Enter
.DA MENU.Enter
.DA BUT.Enter
.DA TEXT.Enter
.DA BITMAP.Enter
.DA LABEL.Enter
*--------------------------------------
J.OBJ.Leave .DA WND.Leave
.DA MBAR.Leave
.DA MENU.Leave
.DA BUT.Leave
.DA TEXT.Leave
.DA BITMAP.Leave
.DA LABEL.Leave
*--------------------------------------
J.OBJ.fPaintX .DA WND.fPaint
.DA $FFFF MBAR
.DA $FFFF MENU
.DA BUT.fPaint
.DA TEXT.fPaint
.DA BITMAP.fPaint
.DA LABEL.fPaint
.DA 0
*--------------------------------------
2018-05-16 06:02:57 +00:00
LIB.LOAD lda LibCount
bne .8
2019-01-08 16:29:26 +00:00
2018-05-16 06:02:57 +00:00
jsr MOU.Init
2020-09-02 15:47:23 +00:00
* bcs .9
2019-01-09 06:58:19 +00:00
jsr WND.Init
bcs .9
2020-09-02 15:47:23 +00:00
jsr FON.Init
bcs .9
jsr WND.Setup
2019-01-09 06:58:19 +00:00
lda hDevMouse
2020-09-02 15:47:23 +00:00
beq .1
2019-01-09 06:58:19 +00:00
jsr MOU.Setup
.1 lda #PTR.T.ARROW
jsr PTR.Set
jsr PTR.Show
2020-09-03 15:19:25 +00:00
2022-10-25 06:05:54 +00:00
>LDYA L.MENU.Sys.Programs
>STYA MENU.Sys.1
>LDYA L.MENU.Sys.Settings
>STYA MENU.Sys.2
2020-09-02 15:47:23 +00:00
inc LibCount
.8 clc
2019-01-08 16:29:26 +00:00
.9 rts
2018-05-16 06:02:57 +00:00
*--------------------------------------
LIB.UNLOAD dec LibCount
bne .8
2020-09-02 15:47:23 +00:00
2018-05-16 06:02:57 +00:00
jsr MOU.Quit
2020-09-02 15:47:23 +00:00
2018-05-16 06:02:57 +00:00
.8 clc
2016-06-15 06:21:42 +00:00
rts
*--------------------------------------
SkipAPtr1 clc
adc ZPPtr1
sta ZPPtr1
bcc .8
2022-10-25 06:05:54 +00:00
inc ZPPtr1+1
2022-10-25 06:05:54 +00:00
.8 rts
2020-10-06 06:27:35 +00:00
*--------------------------------------
SkipStrZPtr1 ldy #$ff
2020-10-06 06:27:35 +00:00
.1 iny
2020-10-06 06:27:35 +00:00
lda (ZPPtr1),y
bne .1
2022-10-25 06:05:54 +00:00
tya
sec \0
adc ZPPtr1
sta ZPPtr1
bcc .8
2022-10-25 06:05:54 +00:00
inc ZPPtr1+1
2022-10-25 06:05:54 +00:00
.8 rts
2020-10-06 06:27:35 +00:00
*--------------------------------------
SkipAPtr2 clc
adc ZPPtr2
sta ZPPtr2
bcc .8
inc ZPPtr2+1
.8 rts
*--------------------------------------
SkipStrZPtr2 ldy #$ff
.1 iny
lda (ZPPtr2),y
bne .1
tya
sec \0
adc ZPPtr2
sta ZPPtr2
bcc .8
inc ZPPtr1+2
.8 rts
*--------------------------------------
.INB usr/src/lib/libgui.s.bitmap
2020-06-30 15:32:23 +00:00
.INB usr/src/lib/libgui.s.bm
.INB usr/src/lib/libgui.s.but
2022-10-20 06:07:40 +00:00
.INB usr/src/lib/libgui.s.cb
2020-06-30 15:32:23 +00:00
.INB usr/src/lib/libgui.s.clip
.INB usr/src/lib/libgui.s.cur
.INB usr/src/lib/libgui.s.draw
.INB usr/src/lib/libgui.s.fon
.INB usr/src/lib/libgui.s.label
2020-10-23 15:23:19 +00:00
.INB usr/src/lib/libgui.s.mbar
2022-10-25 06:05:54 +00:00
.INB usr/src/lib/libgui.s.mbox
2020-06-30 15:32:23 +00:00
.INB usr/src/lib/libgui.s.menu
.INB usr/src/lib/libgui.s.mou
2022-10-11 06:20:24 +00:00
.INB usr/src/lib/libgui.s.msg
2020-10-26 06:38:50 +00:00
.INB usr/src/lib/libgui.s.obj
* .INB usr/src/lib/libgui.s.pat
.INB usr/src/lib/libgui.s.ptr
2020-10-06 15:23:40 +00:00
.INB usr/src/lib/libgui.s.sysbar
2020-09-07 20:40:50 +00:00
.INB usr/src/lib/libgui.s.text
2020-06-30 15:32:23 +00:00
.INB usr/src/lib/libgui.s.wnd
*--------------------------------------
CS.END
*--------------------------------------
2020-06-30 15:32:23 +00:00
.INB usr/src/lib/libgui.g.bm
.INB usr/src/lib/libgui.g.cur
.INB usr/src/lib/libgui.g.fon
.INB usr/src/lib/libgui.g.ptr
*--------------------------------------
2020-06-30 15:32:23 +00:00
DEVNAME.GFX .AZ "/dev/gfx"
DEVNAME.MOUSE .AZ "/dev/mou1"
*--------------------------------------
2022-10-25 06:05:54 +00:00
SYSX7 .AZ "${ROOT}opt/gui/fonts/sysx7"
SYSX7B .AZ "${ROOT}opt/gui/fonts/sysx7b"
2018-05-16 06:02:57 +00:00
*--------------------------------------
LibCount .BS 1
hDevMouse .BS 1
2016-06-15 06:21:42 +00:00
*--------------------------------------
OBJ.SizeOf .DA S.WND
2022-11-02 06:54:30 +00:00
.DA 0
.DA 0
.DA S.BUT
.DA S.TEXT
.DA S.BITMAP
.DA S.LABEL
*--------------------------------------
BUT.L.OK .AZ "Ok"
BUT.L.CANCEL .AZ "Cancel"
BUT.L.RETRY .AZ "Retry"
BUT.L.IGNORE .AZ "Ignore"
BUT.L.YES .AZ "Yes"
BUT.L.NO .AZ "No"
*--------------------------------------
2020-09-03 15:19:25 +00:00
CB.CmdLen .DA #S.CB.Y1+1 SETPIXEL
.DA #S.CB.Y1+1 GETPIXEL
2020-09-08 15:31:41 +00:00
.DA #S.CB.Y2+1 HLINE
2020-09-03 15:19:25 +00:00
.DA #S.CB.Y2+1 VLINE
.DA #S.CB.Y2+1 FILLRECT
.DA #S.CB.DstPtr+1 BITBLT
.DA #S.CB.DstPtr+1 GETRECTBUFSIZE
.DA #S.CB.TxtPtr+1 DRAWTEXT
.DA #S.CB.TxtPtr+1 GETTEXTSIZE
.DA #S.CB.Y2+1 DRAWLINE
.DA #S.CB.TxtPtr+1 DRAWTEXT2
2017-11-15 16:29:23 +00:00
*--------------------------------------
PAT.Buf .BS 1 S.BM.F
.DA #1 S.BM.RowBytes
.DA 8 S.BM.W
.DA 8 S.BM.H
.DA 0 S.BM.MASK.OFS
.BS 8 (data)
*--------------------------------------
2019-01-09 16:42:20 +00:00
IOCTL .BS S.IOCTL
2019-01-08 16:29:26 +00:00
DCB.GFX .BS S.DCB.GFX
2019-01-09 16:42:20 +00:00
*--------------------------------------
MSG .BS S.MSG
2019-01-10 16:26:58 +00:00
*--------------------------------------
2020-10-06 06:27:35 +00:00
CB.PTR .DA #S.CB.CMD.BITBLT
.BS 1 S.CB.OP
.DA #S.CB.M.MONO
.DA #0
.BS S.CB-4
*--------------------------------------
CB.Cache .BS S.CB CB.GFXWrite:
CLIP.Cache .BS S.CB ,x select Cache
CLIP.Screen .BS S.RECT CLIP.BitBltX:
CLIP.Rect .BS S.RECT ,x select clipping region
2019-01-10 07:00:45 +00:00
*--------------------------------------
2022-11-02 06:54:30 +00:00
MENU.Stack.Owner .BS 1
2022-10-25 06:05:54 +00:00
MENU.Stack.Idx .BS 1
MENU.Stack.Cnt .BS 1
2020-10-13 15:54:55 +00:00
MENU.Stack .BS MENU.MAX
*--------------------------------------
2020-10-26 06:38:50 +00:00
WND.hWND .BS 1
2020-10-23 15:23:19 +00:00
WND.Stack.Idx .BS 1
2020-10-06 06:27:35 +00:00
WND.Stack.Top .BS 1
WND.Stack .BS WND.MAX
*--------------------------------------
2020-09-07 20:40:50 +00:00
WND.Screen .DA #S.OBJ.T.WND
2020-09-06 12:24:04 +00:00
.BS S.WND-1
2020-09-03 15:19:25 +00:00
*--------------------------------------
2019-01-10 16:26:58 +00:00
WND.Desktop .DA #S.OBJ.T.WND
.BS S.WND-1
*--------------------------------------
WND.SysBar .DA #S.OBJ.T.WND
.BS S.WND-1
2022-10-25 06:05:54 +00:00
*--------------------------------------
2020-10-08 15:33:38 +00:00
WND.SysBar.2osX .AZ "2osX"
2020-10-20 06:01:04 +00:00
WND.SysBar.Clk .AZ "00:00"
WND.SysBar.bSysBut .BS 1
2019-01-09 16:42:20 +00:00
*--------------------------------------
2020-10-15 06:16:45 +00:00
RECT.SysBut .BS S.RECT
*--------------------------------------
RECT.SysWNDs .BS S.RECT
*--------------------------------------
RECT.SysClk .BS S.RECT
*--------------------------------------
MENU.Sys .DA #S.MITEM.T.ITEM
2020-10-08 15:33:38 +00:00
.DA #2 ID
.DA #KEYMOD.CTRL+KEYMOD.OA+KEYMOD.CA,#'A'
2020-10-12 06:04:19 +00:00
.DA BM.ID.APPLE pICON
2020-09-08 15:31:41 +00:00
.AZ "About..."
.DA #S.MITEM.T.SEP
.DA #S.MITEM.T.SUBMENU
2022-10-25 06:05:54 +00:00
MENU.Sys.1 .DA MENU.Sys.Programs
2020-10-12 06:04:19 +00:00
.DA 0 pICON
.AZ "Programs"
.DA #S.MITEM.T.SUBMENU
2022-10-25 06:05:54 +00:00
MENU.Sys.2 .DA MENU.Sys.Settings
2020-10-08 15:33:38 +00:00
.DA 0 pICON
.AZ "Settings"
.DA #S.MITEM.T.SEP
.DA #S.MITEM.T.ITEM
2020-10-12 06:04:19 +00:00
.DA #8 ID
.DA #0,#0
2020-10-12 06:04:19 +00:00
.DA 0 pICON
.AZ "Search..."
.DA #S.MITEM.T.ITEM
2020-10-12 06:04:19 +00:00
.DA #10 ID
.DA #KEYMOD.CTRL+KEYMOD.OA,#'R'
2020-10-12 06:04:19 +00:00
.DA 0 pICON
.AZ "Run..."
.DA #0
2020-09-08 15:31:41 +00:00
*--------------------------------------
2020-10-23 15:23:19 +00:00
MENU.Sys.Programs
.DA #S.MITEM.T.ITEM
2020-10-23 15:23:19 +00:00
.DA #42 ID
.DA #0,#0
2020-10-23 15:23:19 +00:00
.DA BM.ID.APPLE pICON
.AZ "Test ASM"
2020-10-23 15:23:19 +00:00
.DA #S.MITEM.t.ITEM
2020-10-23 15:23:19 +00:00
.DA #44 ID
.DA #0,#0
2020-10-23 15:23:19 +00:00
.DA BM.ID.APPLE pICON
.AZ "Test C"
2020-10-23 15:23:19 +00:00
.DA #0
2020-10-23 15:23:19 +00:00
*--------------------------------------
2020-10-20 06:01:04 +00:00
MENU.Sys.Settings
.DA #S.MITEM.T.ITEM
2020-10-20 06:01:04 +00:00
.DA #62 ID
.DA #0,#0
2020-10-20 06:01:04 +00:00
.DA 0 pICON
.AZ "Colors..."
2020-10-20 06:01:04 +00:00
.DA #S.MITEM.T.ITEM
2020-10-20 06:01:04 +00:00
.DA #64 ID
.DA #0,#0
2020-10-20 06:01:04 +00:00
.DA 0 pICON
.AZ "SubItem2..."
2020-10-20 06:01:04 +00:00
.DA #0
*--------------------------------------
KEYMOD.S.CTRL .EQ 0
KEYMOD.S .AZ "Ctrl-"
KEYMOD.S.OA .EQ *-KEYMOD.S
2022-10-25 06:05:54 +00:00
.DA #01,#'-',#0
KEYMOD.S.CA .EQ *-KEYMOD.S
.DA #02,#'-',#0
*--------------------------------------
MouseClamp .EQ * MOU.Setup
TEXTBUF .BS 16 for composing HotKey strings
2020-10-20 06:01:04 +00:00
*--------------------------------------
2022-10-25 06:05:54 +00:00
PREFS.BestViewedX .DA #$FC
PREFS.nBestViewedX .DA #$03
PREFS.XMargin .DA #4
PREFS.XSeparator .DA #4
2022-10-25 06:05:54 +00:00
*
PREFS.MenuColor .DA #C.WHITE
2022-11-02 06:54:30 +00:00
PREFS.SysBarColor .DA #C.WHITE
2022-10-25 06:05:54 +00:00
PREFS.BorderColor .DA #C.BLACK
2022-11-02 06:54:30 +00:00
PREFS.TBarColorA .DA #C16.D.BLUE
PREFS.TBarColorI .DA #C16.L.BLUE
2022-10-25 06:05:54 +00:00
PREFS.MBarColor .DA #C.WHITE
2022-11-02 06:54:30 +00:00
PREFS.SBarColor .DA #C.WHITE
2020-10-20 06:01:04 +00:00
PREFS.DESKTOPCOLOR .DA #C16.D.BLUE
*--------------------------------------
MAN
2020-06-30 15:32:23 +00:00
SAVE usr/src/lib/libgui.s
ASM