Kernel 0.94

This commit is contained in:
Rémy GIBERT 2020-09-29 17:37:26 +02:00
parent 0de3db36dd
commit e146c6086d
8 changed files with 303 additions and 107 deletions

Binary file not shown.

View File

@ -213,7 +213,7 @@ OSD.GETTEXTSIZE clc
lda CBX.Cache+S.CB.SrcW
ldx CBX.Cache+S.CB.SrcW+1
ldy CBX.Cache+S.CB.SrcH
bcc OSD.DRAWTEXT.RTS
bcc OSD.GETRECTBUFSIZE.RTS
sta DstBM.Cache+S.BM.W
stx DstBM.Cache+S.BM.W+1
@ -224,7 +224,7 @@ OSD.GETTEXTSIZE clc
sta DstBM.Cache+S.BM.F
jsr OSD.BM.Create
bcs OSD.DRAWTEXT.RTS
bcs OSD.GETRECTBUFSIZE.RTS
sta OSD.DRAWTEXT.END+1 save hBM, ZPDstBMPtr=BMData
>LDYA CBX.Cache+S.CB.TxtPtr
@ -263,7 +263,7 @@ OSD.DRAWTEXT.LOOP
adc GWORD Update Col Index in BM
sta GWORD
bra OSD.DRAWTEXT.LOOP
OSD.DRAWTEXT.RTS
OSD.DRAWTEXT.END
lda #$FF SELF MODIFIED
sta CBX.Cache+S.CB.SrcPtr Save hBM in Src CB

View File

@ -104,9 +104,9 @@ S.WND.F.BORDER .EQ %00100000
S.WND.F.MODAL .EQ %01000000
S.WND.F.SYSMODAL .EQ %10000000
*
S.WND.S.HASTOPBAR .EQ %00000001
S.WND.S.HASMENUBAR .EQ %00000010
S.WND.S.HASSTATUSBAR .EQ %00000100
S.WND.S.HASTBAR .EQ %00000001
S.WND.S.HASMBAR .EQ %00000010
S.WND.S.HASSBAR .EQ %00000100
S.WND.S.MAXIMIZED .EQ %00001000
S.WND.S.MINIMIZED .EQ %00010000
S.WND.S.ACTIVE .EQ %01000000
@ -114,7 +114,7 @@ S.WND.S.ACTIVE .EQ %01000000
S.WND.MinW .EQ S.OBJ
S.WND.MinH .EQ S.OBJ+2
S.WND.TITLE .EQ S.OBJ+4
S.WND.MENUBAR .EQ S.OBJ+6
S.WND.MBAR .EQ S.OBJ+6
S.WND.STATUS .EQ S.OBJ+8
S.WND.ICON .EQ S.OBJ+10
S.WND.BGCOLOR .EQ S.OBJ+12
@ -122,17 +122,25 @@ S.WND.BGBM .EQ S.OBJ+14
S.WND.hCUR .EQ S.OBJ+16
S.WND.TitleX1 .EQ S.OBJ+18
S.WND.TitleX2 .EQ S.OBJ+20
S.WND.InnerW .EQ S.OBJ+22
S.WND.InnerH .EQ S.OBJ+24
S.WND.DocW .EQ S.OBJ+26
S.WND.DocH .EQ S.OBJ+28
S.WND.DocX .EQ S.OBJ+30
S.WND.DocY .EQ S.OBJ+32
S.WND.TBAR.Y2 .EQ S.OBJ+22
S.WND.MBAR.Y2 .EQ S.OBJ+24
S.WND.SBAR.Y1 .EQ S.OBJ+26
S.WND.InnerW .EQ S.OBJ+28
S.WND.InnerH .EQ S.OBJ+30
S.WND.DocW .EQ S.OBJ+32
S.WND.DocH .EQ S.OBJ+34
S.WND.DocX .EQ S.OBJ+36
S.WND.DocY .EQ S.OBJ+38
*
S.WND .EQ S.OBJ+34
S.WND .EQ S.OBJ+40
*--------------------------------------
S.MBAR.MENULIST .EQ S.OBJ
* ... S.MENUs...
S.MBAR.NEXT .EQ 0
S.MBAR.S .EQ 1
S.MBAR.X1 .EQ 2
S.MBAR.XT .EQ 4
S.MBAR.X2 .EQ 6
S.MBAR.MENU .EQ 8
S.MBAR.TEXT .EQ 10
*--------------------------------------
S.MENU.hSAVEBUF .EQ S.OBJ
S.MENU.ITEMLIST .EQ S.OBJ+2

View File

@ -33,6 +33,13 @@ FON.Load >PUSHYA
>SYSCALL2 LoadStkObj
rts
*--------------------------------------
FON.GetTextSize >STYA CB.CACHE+S.CB.TxtPtr
stx CB.CACHE+S.CB.hFont
lda #S.CB.CMD.GETTEXTSIZE+S.CB.CMD.OSD
sta CB.CACHE+S.CB.CMD
jmp GFXWrite.CB
*--------------------------------------
MAN
SAVE usr/src/lib/libgui.s.fon
LOAD usr/src/lib/libgui.s

View File

@ -16,23 +16,98 @@ MENU.New >STYA ZPPtr1
MENU.Paint
MENU.Close
*--------------------------------------
MENU.MenubarInit
>STYA ZPPtr1
MENU.MBarInit >STYA ZPPtr1
stz DX
stz DX+1
.1 lda (ZPPtr1)
beq .8
ldy #S.MBAR.TEXT
lda (ZPPtr1),y
pha
iny
lda (ZPPtr1),y
ply
ldx hSYSFONB
jsr FON.GetTextSize
ldy #S.MBAR.X1
lda DX
sta (ZPPtr1),y
iny
lda DX+1
sta (ZPPtr1),y
iny #S.MBAR.XT
lda DX
clc
adc #PREFS.MBARXMARGIN
sta DX
sta (ZPPtr1),y
iny
lda DX+1
adc #0
sta DX+1
sta (ZPPtr1),y
lda DX
clc
adc CB.CACHE+S.CB.SrcX
sta DX
lda DX+1
adc CB.CACHE+S.CB.SrcX+1
sta DX+1
iny #S.MBAR.X2
lda DX
clc
adc #PREFS.MBARXMARGIN
sta DX
sta (ZPPtr1),y
iny
lda DX+1
adc #0
sta DX+1
sta (ZPPtr1),y
lda (ZPPtr1)
sec
adc ZPPtr1
sta ZPPtr1
bcc .1
inc ZPPtr1+1
bra .1
.8 lda #$80
ldy #S.MBAR.S
sta (ZPMENUPtr),y
clc
rts
*--------------------------------------
MENUBAR.New
MENUBAR.Paint
MENUBAR.Close
MBAR.New
MBAR.Paint
MBAR.Close
*--------------------------------------
MENUITEM.New
MENUITEM.Paint
MENUITEM.Close
MITEM.New
MITEM.Paint
MITEM.Close
clc
rts

View File

@ -186,7 +186,7 @@ WND.GetProp >PULLA
lda (ZPWNDPtr),y
ply
rts
WND.GetProp.RTS rts
*--------------------------------------
* A = hWND
*--------------------------------------
@ -196,7 +196,19 @@ WND.Show >SYSCALL2 GetMemPtr
jsr OBJ.SetX2Y2
jsr GetCBBuf
bcs .9
bcs WND.GetProp.RTS
ldy #S.OBJ.Y1
lda (ZPWNDPtr),y
tax
iny
lda (ZPWNDPtr),y
ldy #S.WND.TBAR.Y2+1
sta (ZPWNDPtr),y
txa
dey
sta (ZPWNDPtr),y
stz Counter X
stz Counter+1 Y
@ -222,13 +234,23 @@ WND.Show >SYSCALL2 GetMemPtr
adc SYSFON.Hp2
sta Counter+1
lda #S.WND.S.HASTOPBAR
ldy #S.WND.TBAR.Y2
lda (ZPWNDPtr),y
clc
adc SYSFON.Hp2
sta (ZPWNDPtr),y
iny
lda (ZPWNDPtr),y
adc #0
sta (ZPWNDPtr),y
lda #S.WND.S.HASTBAR
jsr WND.SetStatus
jsr WND.PaintTopBar
bcs .9
.3 ldy #S.WND.MENUBAR+1
.3 ldy #S.WND.MBAR+1
lda (ZPWNDPtr),y
beq .7
@ -237,10 +259,25 @@ WND.Show >SYSCALL2 GetMemPtr
adc SYSFON.Hp2
sta Counter+1
lda #S.WND.S.HASMENUBAR
ldy #S.WND.TBAR.Y2
lda (ZPWNDPtr),y
clc
adc SYSFON.Hp2
tax
iny
lda (ZPWNDPtr),y
adc #0
ldy #S.WND.MBAR.Y2+1
sta (ZPWNDPtr),y
txa
dey
sta (ZPWNDPtr),y
lda #S.WND.S.HASMBAR
jsr WND.SetStatus
jsr WND.PaintMenuBar
jsr WND.PaintMBar
.7 ldy #S.WND.STATUS+1
lda (ZPWNDPtr),y
@ -251,10 +288,10 @@ WND.Show >SYSCALL2 GetMemPtr
adc SYSFON.Hp2
sta Counter+1
lda #S.WND.S.HASSTATUSBAR
lda #S.WND.S.HASSBAR
jsr WND.SetStatus
jsr WND.PaintStatusBar
jsr WND.PaintSBar
.8 lda #0
jsr PutA2CBBuf
@ -377,14 +414,14 @@ WND.PaintTopBar lda #S.CB.CMD.FILLRECT
lda #S.CB.M.C16
jsr PutA2CBBuf
ldx PREFS.TOPBARCOLORI
ldx PREFS.TBARCOLORI
ldy #S.OBJ.S
lda (ZPWNDPtr),y
and #S.WND.S.ACTIVE
beq .10
ldx PREFS.TOPBARCOLORA
ldx PREFS.TBARCOLORA
.10 txa
jsr PutA2CBBuf
@ -661,28 +698,72 @@ WND.PaintTopBarTitle
.9 rts
*--------------------------------------
WND.PaintMenuBar
ldy #S.WND.MENUBAR
WND.PaintMBar ldy #S.WND.MBAR
lda (ZPWNDPtr),y
sta ZPMENUPtr
iny
lda (ZPWNDPtr),y
sta ZPMENUPtr+1
lda (ZPMENUPtr)
bne .1
ldy #S.MBAR.S
lda (ZPMENUPtr),y
bmi .1
>LDYA ZPMENUPtr
jsr MENU.MenubarInit
jsr MENU.MBarInit
.1 jsr CB.Clear
lda #S.CB.CMD.FILLRECT
sta CB.Cache+S.CB.CMD
lda #S.CB.OP.SET
sta CB.Cache+S.CB.OP
lda #S.CB.M.MONO
sta CB.Cache+S.CB.M
lda PREFS.MBARCOLOR
sta CB.Cache+S.CB.OP.COLOR
ldy #S.OBJ.X1
lda (ZPWNDPtr),y
sta CB.Cache+S.CB.X1
iny
lda (ZPWNDPtr),y
sta CB.Cache+S.CB.X1+1
ldy #S.OBJ.X2
lda (ZPWNDPtr),y
sta CB.Cache+S.CB.X2
iny
lda (ZPWNDPtr),y
sta CB.Cache+S.CB.X2+1
ldy #S.WND.TBAR.Y2
lda (ZPWNDPtr),y
sta CB.Cache+S.CB.Y1
iny
lda (ZPWNDPtr),y
sta CB.Cache+S.CB.Y1+1
iny #S.WND.MBAR.Y2
lda (ZPWNDPtr),y
sta CB.Cache+S.CB.Y2
iny
lda (ZPWNDPtr),y
sta CB.Cache+S.CB.Y2+1
jsr PutCBCache2CBBuf
.1
clc
.8 clc
.9 rts
*--------------------------------------
WND.PaintStatusBar
lda #S.CB.CMD.HLINE
WND.PaintSBar lda #S.CB.CMD.HLINE
jsr WND.PaintBorders.H
ldy #S.OBJ.X1
@ -760,7 +841,7 @@ WND.PaintStatusBar
sta CB.Cache+S.CB.OP
lda #S.CB.M.MONO
sta CB.Cache+S.CB.M
lda #C.WHITE
lda PREFS.SBARCOLOR
sta CB.Cache+S.CB.OP.COLOR
lda CB.Cache+S.CB.X1

View File

@ -130,7 +130,7 @@ J.Cmds .DA DrawLine
.DA DrawText2
*--------------------------------------
J.OBJ .DA J.WND
.DA J.MENUBAR
.DA J.MBAR
.DA J.MENU
.DA J.MENUITEM
.DA J.BUT
@ -140,17 +140,17 @@ J.WND .DA WND.New
.DA WND.Paint
.DA WND.Close
*--------------------------------------
J.MENUBAR .DA MENUBAR.New
.DA MENUBAR.Paint
.DA MENUBAR.Close
J.MBAR .DA MBAR.New
.DA MBAR.Paint
.DA MBAR.Close
*--------------------------------------
J.MENU .DA MENU.New
.DA MENU.Paint
.DA MENU.Close
*--------------------------------------
J.MENUITEM .DA MENUITEM.New
.DA MENUITEM.Paint
.DA MENUITEM.Close
J.MENUITEM .DA MITEM.New
.DA MITEM.Paint
.DA MITEM.Close
*--------------------------------------
J.BUT .DA BUT.New
.DA BUT.Paint
@ -457,9 +457,12 @@ MENU.Sys .DA #2 ID
.DA #0
*--------------------------------------
PREFS.BESTVIEWEDX .DA #$FC
PREFS.MBARXMARGIN .DA #10
PREFS.BORDERCOLOR .DA #C.BLACK
PREFS.TOPBARCOLORA .DA #C16.D.BLUE
PREFS.TOPBARCOLORI .DA #C16.L.BLUE
PREFS.TBARCOLORA .DA #C16.D.BLUE
PREFS.TBARCOLORI .DA #C16.L.BLUE
PREFS.MBARCOLOR .DA #C.WHITE
PREFS.SBARCOLOR .DA #C.WHITE
*--------------------------------------
MAN
SAVE usr/src/lib/libgui.s

View File

@ -44,7 +44,7 @@ CS.START cld
L.LIBGUI .DA LIBGUI
L.MouseData .DA MouseData
L.WND.TITLE .DA WND.TITLE
L.WND.MENUBAR .DA WND.MENUBAR
L.WND.MBAR .DA WND.MBAR
L.WND.STATUS .DA WND.STATUS
.DA 0
*--------------------------------------
@ -128,8 +128,8 @@ WND.Test >PUSHBI S.WND.F.RESIZE+S.WND.F.MOVE+S.WND.F.CLOSE+S.WND.F.MAX+S.WND.F.
lda hWND
>PUSHA
>PUSHBI S.WND.MENUBAR
>PUSHW L.WND.MENUBAR
>PUSHBI S.WND.MBAR
>PUSHW L.WND.MBAR
>LIBCALL hLIBGUI,LIBGUI.WND.SetProp
lda hWND
@ -155,63 +155,85 @@ MouseData .BS S.MOUSE
hWND .BS 1
WND.TITLE .AZ "Window Title"
*--------------------------------------
WND.MENUBAR .DA #0
.DA #0
.DA #.1-*
.AZ "File"
.DA #02 ID
.DA #S.MITEM.KEYMOD.CTRL
.DA #'N'
.AZ "New"
.DA #04 ID
.DA #S.MITEM.KEYMOD.CTRL
.DA #'O'
.AZ "Open..."
.DA #06 ID
.DA #S.MITEM.KEYMOD.CTRL
.DA #'S'
.AZ "Save"
.DA #08 ID
.DA #S.MITEM.KEYMOD.OA+S.MITEM.KEYMOD.CTRL
.DA #'S'
.AZ "Save As..."
.DA #10 ID
.DA #S.MITEM.KEYMOD.CTRL
.DA #'Q'
.AZ "Quit"
.DA #0
.1 .DA #.2-*
WND.MBAR .DA #.1-* next
.DA #0 status
.DA 0 X1
.DA 0 XT
.DA 0 X2
.DA 0 MENU
.AZ "File"
.1 .DA #.2-* next
.DA #0 status
.DA 0 X1
.DA 0 XT
.DA 0 X2
.DA 0 MENU
.AZ "Edit"
.DA #12 ID
.DA #S.MITEM.KEYMOD.OA
.DA #'X'
.AZ "Cut"
.DA #14 ID
.DA #S.MITEM.KEYMOD.OA
.DA #'C'
.AZ "Copy"
.DA #16 ID
.DA #S.MITEM.KEYMOD.OA
.DA #'V'
.AZ "Paste"
.DA #0
.2 .DA #.3-*
.2 .DA #.3-* next
.DA #0 status
.DA 0 X1
.DA 0 XT
.DA 0 X2
.DA 0 MENU
.AZ "Options"
.DA #18 ID
.DA #0
.DA #0
.AZ "Check Me"
.DA #0
.3 .DA #.4-*
.3 .DA #.4-* next
.DA #0 status
.DA 0 X1
.DA 0 XT
.DA 0 X2
.DA 0 MENU
.AZ "?"
.DA #20 ID
.DA #0
.DA #0
.AZ "About..."
.DA #0
.4 .DA #0
*--------------------------------------
WND.STATUS .AZ "Window status bar message"
*--------------------------------------
WND.MENU.FILE .DA #02 ID
.DA #S.MITEM.KEYMOD.CTRL
.DA #'N'
.AZ "New"
.DA #04 ID
.DA #S.MITEM.KEYMOD.CTRL
.DA #'O'
.AZ "Open..."
.DA #06 ID
.DA #S.MITEM.KEYMOD.CTRL
.DA #'S'
.AZ "Save"
.DA #08 ID
.DA #S.MITEM.KEYMOD.OA+S.MITEM.KEYMOD.CTRL
.DA #'S'
.AZ "Save As..."
.DA #10 ID
.DA #S.MITEM.KEYMOD.CTRL
.DA #'Q'
.AZ "Quit"
.DA #0
*--------------------------------------
WND.MENU.EDIT .DA #12 ID
.DA #S.MITEM.KEYMOD.OA
.DA #'X'
.AZ "Cut"
.DA #14 ID
.DA #S.MITEM.KEYMOD.OA
.DA #'C'
.AZ "Copy"
.DA #16 ID
.DA #S.MITEM.KEYMOD.OA
.DA #'V'
.AZ "Paste"
.DA #0
*--------------------------------------
WND.MENU.OPTIONS .DA #18 ID
.DA #0
.DA #0
.AZ "Check Me"
.DA #0
*--------------------------------------
WND.MENU.HELP .DA #20 ID
.DA #0
.DA #0
.AZ "About..."
.DA #0
*--------------------------------------
.DUMMY
.OR 0