Perfect Color Palette

45 views
Skip to first unread message

zhong zhao

unread,
Jul 6, 2022, 10:59:11 PMJul 6
to SemWare TSE Pro text editor
I have a good idea: the background color of the marker block is green, the background color of the current line is cyan, and the synhi foreground color is maintained in all cases.

How did I do it?
Refer to attachment:
(^_^)marked_synhi.pngpalette.png
and TSE_default.s:
proc TSE_default()                   //new RGB      // color name     old RGB
    SetColorTableValue(_FOREGROUND_, 0,0x000000)    // black          0x000000
    SetColorTableValue(_FOREGROUND_, 1,0x000080)    // blue           0x800000
    SetColorTableValue(_FOREGROUND_, 2,0x004000)    // green          0x008000
    SetColorTableValue(_FOREGROUND_, 3,0x004040)    // cyan           0x808000
    SetColorTableValue(_FOREGROUND_, 4,0x800000)    // red            0x000080
    SetColorTableValue(_FOREGROUND_, 5,0x800080)    // magenta        0x800080
    SetColorTableValue(_FOREGROUND_, 6,0x804000)    // brown          0x008080
    SetColorTableValue(_FOREGROUND_, 7,0xfeddbc)    // light gray     0xc0c0c0
    SetColorTableValue(_FOREGROUND_, 8,0x404040)    // dark gray      0x808080
    SetColorTableValue(_FOREGROUND_, 9,0x0000ff)    // light blue     0xff0000
    SetColorTableValue(_FOREGROUND_,10,0x86fc86)    // light green    0x00ff00
    SetColorTableValue(_FOREGROUND_,11,0x9ffafa)    // light cyan     0xffff00
    SetColorTableValue(_FOREGROUND_,12,0xffbfbf)    // light red      0x0000ff
    SetColorTableValue(_FOREGROUND_,13,0xfecbfe)    // light magenta  0xff00ff
    SetColorTableValue(_FOREGROUND_,14,0xffffa0)    // yellow         0x00ffff
    SetColorTableValue(_FOREGROUND_,15,0xffffff)    // white          0xffffff

    SetColorTableValue(_BACKGROUND_, 0,0x000000)    // black          0x000000
    SetColorTableValue(_BACKGROUND_, 1,0x000080)    // blue           0x800000
    SetColorTableValue(_BACKGROUND_, 2,0x548c54)    // green          0x008000
    SetColorTableValue(_BACKGROUND_, 3,0x548c87)    // cyan           0x808000
    SetColorTableValue(_BACKGROUND_, 4,0x800000)    // red            0x000080
    SetColorTableValue(_BACKGROUND_, 5,0x800080)    // magenta        0x800080
    SetColorTableValue(_BACKGROUND_, 6,0x4c8065)    // brown          0x008080
    SetColorTableValue(_BACKGROUND_, 7,0xa0a0a0)    // light gray     0xc0c0c0
    SetColorTableValue(_BACKGROUND_, 8,0x808080)    // dark gray      0x808080
    SetColorTableValue(_BACKGROUND_, 9,0x0000ff)    // light blue     0xff0000
    SetColorTableValue(_BACKGROUND_,10,0x00ff00)    // light green    0x00ff00
    SetColorTableValue(_BACKGROUND_,11,0x00ffff)    // light cyan     0xffff00
    SetColorTableValue(_BACKGROUND_,12,0xff0000)    // light red      0x0000ff
    SetColorTableValue(_BACKGROUND_,13,0xff00ff)    // light magenta  0xff00ff
    SetColorTableValue(_BACKGROUND_,14,0xffff00)    // yellow         0x00ffff
    SetColorTableValue(_BACKGROUND_,15,0xffffff)    // white          0xffffff
end

knud van eeden

unread,
Jul 7, 2022, 4:32:59 AMJul 7
to sem...@googlegroups.com
That looks very interesting.

with friendly greetings
Knud van Eeden

Sent from Yahoo Mail on Samsung Galaxy Note 9 black 512 gigabytes

--

---
You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/semware/d887c5b5-3c2d-430b-a2b2-fd7d6db78030n%40googlegroups.com.

nkor...@gmail.com

unread,
Jul 7, 2022, 9:07:39 PMJul 7
to sem...@googlegroups.com

 

Indeed.  Now, for the beginners, once the provided block is copied and saved to “TSE_default.s”, how does one get these nice new colors into our TSE?

image001.png
image002.png

S.E. Mitchell

unread,
Jul 8, 2022, 8:50:32 AMJul 8
to TSEPro Support
It looks pretty good!
But, look at SetColorTableValue() - it is unreadable :(

image.png





--

zhong zhao

unread,
Jul 19, 2022, 10:28:47 PMJul 19
to SemWare TSE Pro text editor
This is how I achieve the perfect color palette by hex/asm patch on the g32.exe(in tse4.44):
zz_tse.rar(need password "zhao4zhong1" to extract it),
tsepro\ui\zz_tse.cfg --note the synhi color config in it
tsepro\ui\zz_tse.ui --related part of tse.ui
tsepro\zz_tsestart.s --when tse start set color palette
tsepro\zz_transparent_mark_asm_patch.bat --use zz_lr.exe hex/asm patch g32.exe (in tse4.44)
tsepro\src\zz_lr.c --c source code of zz_lr.exe
tsepro\zz_g32.asm --explain of hex/asm patch. Note the line containing ";~"
Hope to be useful to S.E.Michell (^_^)

link of zz_tse.rar:  https://pan.baidu.com/s/1ylB6-IeDJbDkwdMN7BkfEw
need code:  rg27

zhao4zhong1

unread,
Jul 19, 2022, 10:29:21 PMJul 19
to sem...@googlegroups.com

This is how I achieve the perfect color palette by hex/asm patch on the g32.exe(in tse4.44):

zz_tse.rar(need password "zhao4zhong1" to extract it),

tsepro\ui\zz_tse.cfg --note the synhi color config in it

tsepro\ui\zz_tse.ui --related part of tse.ui

tsepro\zz_tsestart.s --when tse start set color palette

tsepro\zz_transparent_mark_asm_patch.bat --use zz_lr.exe hex/asm patch g32.exe (in tse4.44)

tsepro\src\zz_lr.c --c source code of zz_lr.exe

tsepro\zz_g32.asm --explain of hex/asm patch. Note the line containing ";~"

Hope to be useful to S.E.Michell (^_^)


link of zz_tse.rar:  https://pan.baidu.com/s/1ylB6-IeDJbDkwdMN7BkfEw

need code:  rg27






You received this message because you are subscribed to a topic in the Google Groups "SemWare TSE Pro text editor" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/semware/KOokvz23qKc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to semware+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/semware/CA%2BgEvkYFc9muTzHOH5gThhRpmDZrxiA4tWCxAKamoEX%2BJa%2BikA%40mail.gmail.com.

zhong zhao

unread,
Jul 19, 2022, 10:29:44 PMJul 19
to SemWare TSE Pro text editor

This is how I achieve the perfect color palette by hex/asm patch on the g32.exe(in tse4.44):

zz_tse.rar(need password "zhao4zhong1" to extract it),

tsepro\ui\zz_tse.cfg --note the synhi color config in it

tsepro\ui\zz_tse.ui --related part of tse.ui

tsepro\zz_tsestart.s --when tse start set color palette

tsepro\zz_transparent_mark_asm_patch.bat --use zz_lr.exe hex/asm patch g32.exe (in tse4.44)

tsepro\src\zz_lr.c --c source code of zz_lr.exe

tsepro\zz_g32.asm --explain of hex/asm patch. Note the line containing ";~"

Hope to be useful to S.E.Michell (^_^)


link of zz_tse.rar:  https://pan.baidu.com/s/1ylB6-IeDJbDkwdMN7BkfEw

need code:  rg27



在2022年7月8日星期五 UTC+8 20:50:32<S.E.Mitchell> 写道:

zhong zhao

unread,
Jul 19, 2022, 10:30:11 PMJul 19
to SemWare TSE Pro text editor
This is how I achieve the perfect color palette by hex/asm patch on the g32.exe(in tse4.44):
zz_tse.rar(need password "zhao4zhong1" to extract it),
tsepro\ui\zz_tse.cfg --note the synhi color config in it
tsepro\ui\zz_tse.ui --related part of tse.ui
tsepro\zz_tsestart.s --when tse start set color palette
tsepro\zz_transparent_mark_asm_patch.bat --use zz_lr.exe hex/asm patch g32.exe (in tse4.44)
tsepro\src\zz_lr.c --c source code of zz_lr.exe
tsepro\zz_g32.asm --explain of hex/asm patch. Note the line containing ";~"
Hope to be useful to S.E.Michell (^_^)

link of zz_tse.rar:  https://pan.baidu.com/s/1ylB6-IeDJbDkwdMN7BkfEw
need code:  rg27

在2022年7月8日星期五 UTC+8 20:50:32<S.E.Mitchell> 写道:

Carlo Hogeveen

unread,
Jul 20, 2022, 2:42:58 AMJul 20
to sem...@googlegroups.com

If I understand correctly, what you say your TSE patch does, is to also apply the foreground colors of TSE's syntax highlighting inside a marked block. I can see how that could be a nice capability.

But to do that by hacking TSE using downloaded executables? That scares me away. I also notice a few potential red flags, so just to be cautious I am not even going to click on any of those links.

Carlo



zhong zhao

unread,
Jul 20, 2022, 6:29:01 AMJul 20
to SemWare TSE Pro text editor
zz_tse.ui:
integer fc,ctab,cl,cv_c_h=1
proc Tab2Spc()
    ctab=0 cl=CurrLineLen() fc=FileChanged() ExpandTabsToSpaces() FileChanged(fc) if cl<>CurrLineLen() ctab=1 endif
end
proc Spc2Tab()
    if ctab==1 fc=FileChanged() EnTabCurrLine() FileChanged(fc) endif
end
proc OnAfterUpdateDisplay()
    integer i,x,from_where,c,w
    integer flag
    integer xx,yy,att,atl,xl,xe,ln,ye
    string s[1]=" ",a[1]=" "
    integer OldCursor
    integer xoff
    string synfn[8]

    OldCursor = Set(Cursor, OFF)
    //In addition to the found string (white character on red background 0x47), set the background color of the current line (green background 0x30) in the marker block (green background 0x20) to (green background 0x60)
    ln=0
    if Query(ShowLineNumbers)
        ln=Length(Str(NumLines()))+1
    endif
    flag=IsCurrLineInBlock()
    if flag<>0
        if flag==_LINE_
        LINE:
            xe = Query(WindowCols)
            xx=1
            yy=CurrRow()
            VGotoXY(xx+ln,yy)
            GetStrAttr(s,a,1)
            atl=iif(Asc(a)==0x47,0x47,(Asc(a)&0x0F|iif(IsCursorInBlock(),0x60,0x30)))
            xl=xx
            while xx<=xe
                VGotoXY(xx+ln,yy)
                GetStrAttr(s,a,1)
                att=iif(Asc(a)==0x47,0x47,(Asc(a)&0x0F|iif(IsCursorInBlock(),0x60,0x30)))
                if att<>atl
                    VGotoXY(xl+ln,yy)
                    PutAttr(atl,xx-xl)
                    VGotoXY(xx+ln,yy)
                    atl=att
                    xl=xx
                endif
                xx = xx + 1
            endwhile
            VGotoXY(xl+ln,yy)
            PutAttr(atl,xx-xl)
        elseif flag==_COLUMN_
            xoff=CurrXoffset()
            xe = Min(Query(BlockEndCol)-xoff,Query(WindowCols))
            xx= Max(1,Query(BlockBegCol)-xoff)
            if xx<=Query(WindowCols) and xe>=1
                yy=CurrRow()
                VGotoXY(xx+ln,yy)
                GetStrAttr(s,a,1)
                atl=iif(Asc(a)==0x47,0x47,(Asc(a)&0x0F|0x60))
                xl=xx
                while xx<=xe
                    VGotoXY(xx+ln,yy)
                    GetStrAttr(s,a,1)
                    att=iif(Asc(a)==0x47,0x47,(Asc(a)&0x0F|0x60))
                    if att<>atl
                        VGotoXY(xl+ln,yy)
                        PutAttr(atl,xx-xl)
                        VGotoXY(xx+ln,yy)
                        atl=att
                        xl=xx
                    endif
                    xx = xx + 1
                endwhile
                VGotoXY(xl+ln,yy)
                PutAttr(atl,xx-xl)
            endif
        else
            yy=CurrLine()
            //Warn("BL=",Query(BlockBegLine),"EL=",Query(BlockEndLine),"EC=",Query(BlockEndCol))
            if (yy==Query(BlockBegLine) and yy==Query(BlockEndLine))
                Tab2Spc()
                xoff=CurrXoffset()
                xe = Min(Query(BlockEndCol)-xoff,Query(WindowCols))
                xx= Max(1,Query(BlockBegCol)-xoff)
                if xx<=Query(WindowCols) and xe>=1
                    yy=CurrRow()
                    VGotoXY(xx+ln,yy)
                    GetStrAttr(s,a,1)
                    atl=iif(Asc(a)==0x47,0x47,(Asc(a)&0x0F|0x60))
                    xl=xx
                    while xx<=xe
                        VGotoXY(xx+ln,yy)
                        GetStrAttr(s,a,1)
                        att=iif(Asc(a)==0x47,0x47,(Asc(a)&0x0F|0x60))
                        if att<>atl
                            VGotoXY(xl+ln,yy)
                            PutAttr(atl,xx-xl)
                            VGotoXY(xx+ln,yy)
                            atl=att
                            xl=xx
                        endif
                        xx = xx + 1
                    endwhile
                    VGotoXY(xl+ln,yy)
                    PutAttr(atl,xx-xl)
                endif
                Spc2Tab()
            elseif yy==Query(BlockBegLine)
                Tab2Spc()
                xoff=CurrXoffset()
                xe = Query(WindowCols)
                xx= Max(1,Query(BlockBegCol)-xoff)
                if xx<=Query(WindowCols)
                    yy=CurrRow()
                    VGotoXY(xx+ln,yy)
                    GetStrAttr(s,a,1)
                    atl=iif(Asc(a)==0x47,0x47,(Asc(a)&0x0F|0x60))
                    xl=xx
                    while xx<=xe
                        VGotoXY(xx+ln,yy)
                        GetStrAttr(s,a,1)
                        att=iif(Asc(a)==0x47,0x47,(Asc(a)&0x0F|0x60))
                        if att<>atl
                            VGotoXY(xl+ln,yy)
                            PutAttr(atl,xx-xl)
                            VGotoXY(xx+ln,yy)
                            atl=att
                            xl=xx
                        endif
                        xx = xx + 1
                    endwhile
                    VGotoXY(xl+ln,yy)
                    PutAttr(atl,xx-xl)
                endif
                Spc2Tab()
            elseif yy==Query(BlockEndLine)
                Tab2Spc()
                xoff=CurrXoffset()
                xe = Min(Query(BlockEndCol)-xoff,Query(WindowCols))
                xx= 1
                if xe>=1
                    yy=CurrRow()
                    VGotoXY(xx+ln,yy)
                    GetStrAttr(s,a,1)
                    atl=iif(Asc(a)==0x47,0x47,(Asc(a)&0x0F|0x60))
                    xl=xx
                    while xx<=xe
                        VGotoXY(xx+ln,yy)
                        GetStrAttr(s,a,1)
                        att=iif(Asc(a)==0x47,0x47,(Asc(a)&0x0F|0x60))
                        if att<>atl
                            VGotoXY(xl+ln,yy)
                            PutAttr(atl,xx-xl)
                            VGotoXY(xx+ln,yy)
                            atl=att
                            xl=xx
                        endif
                        xx = xx + 1
                    endwhile
                    VGotoXY(xl+ln,yy)
                    PutAttr(atl,xx-xl)
                endif
                Spc2Tab()
            elseif yy<=Query(BlockEndLine)
                goto LINE
            endif
        endif
    endif
    Set(Cursor, OldCursor)
end
proc WhenLoaded()
    //...
    Hook(_AFTER_UPDATEDISPLAY_    , OnAfterUpdateDisplay   )
    //...
end

zhong zhao

unread,
Jul 20, 2022, 6:29:01 AMJul 20
to SemWare TSE Pro text editor
zz_tse.cfg:
//
// Options created by IConfig on 2022-06-10 at 11:40:36
//

Config

// System/File Options

TSEPath                 = ""
KbdPath                 = ""
StartUpFlags            = _STARTUP_PROMPT_
GUIStartUpFlags         = _USE_LAST_SAVED_WIN_POS_|_USE_LAST_SAVED_FONT_|_USE_LAST_SAVED_WIN_SIZE_
SingleInstance          = Off
DefaultExt              = "ui s si c cpp h java pas inc bat prg txt doc html asm vs fun frm"
FileLocking             = _NONE_
LoadWildFromDos         = On
LoadWildFromInside      = On
PickFileChangesDir      = Off
PickFileFlags           = _ADD_DIRS_ | _ADD_SLASH_ | _DIRS_AT_TOP_
PickFileSortOrder       = "DTF"
EOLType                 = 0         // 0=As Loaded, 1=^M (CR), 2=^J (LF), 3=^M^J (CR/LF)
EOFType                 = 2         // 0=nothing, 1=^Z, 2=EOLType, 3=EOLType+^Z
MakeBackups             = Off
ProtectedSaves          = On
BackupExt               = ".bak"
BackupPath              = ""
SaveState               = Off
UseCommonDialogs        = Off

// Keyboard/Mouse Options

EquateEnhancedKBD       = On
MouseHoldTime           = 9         // 18 approx 1 sec
MouseRepeatDelay        = 0
MouseBlockType          = _INCLUSIVE_

// Command/Format Options

MaxHistoryPerList       = 1000
MaxHistorySize          = 10000
PersistentHistory       = On
MaxRecentFiles          = 5000
PersistentRecentFiles   = On
WordSet                 = ChrSet("0-9A-Z_a-z")
FindOptions             = "I"
ReplaceOptions          = ""
CenterFinds             = On
Beep                    = Off
ChangeShellPrompt       = On
QuitToPrompt            = Off
KeepUndoBeyondSave      = On
DateFormat              = 6         // 1=MM/DD/YY, 2=DD/MM/YY, 3=YY/MM/DD, 4=MM/DD/YYYY, 5=DD/MM/YYYY, 6=YYYY/MM/DD
DateSeparator           = Asc('-')
TimeFormat              = 1         // 1=24 hr (HH:MM:SS), 2=12 hr (HH:MM am/pm)
TimeSeparator           = Asc(':')

// Text Entry/Block Options

Insert                  = On
AutoIndent              = On
WordWrap                = Off
TemplateExpansion       = Off
ParaEndStyle            = 0
ReturnEqNextLine        = Off
RemoveTrailingWhite     = On
LineDrawType            = 7         // 1=谀? 2=胀? 3=帜? 4=赏? 5=ASCII, 6=Eraser, 7=User
LineDrawChar            = Asc('#')  // used when LineDrawType == 7
InsertLineBlocksAbove   = Off
UseCurrLineIfNoBlock    = Off
UnMarkAfterPaste        = Off
TabShiftsBlock          = Off

// Tab/Margin Options

TabType                 = _SOFT_
TabWidth                = 4
CursorTabWidth          = 0
ZeroBasedTab            = Off
VarTabs                 = TabSet("4 8 16 24 40")
ExpandTabs              = On
DetabOnLoad             = Off
EntabOnSave             = Off
LeftMargin              = 0
RightMargin             = 32000

// Display/Color Options

StatusLineAtTop         = On
StatusLineFillChar      = Asc(' ')
ShowMainMenu            = Off
ShowHelpLine            = Off
HelpLineDelay           = 6
CurrWinBorderType       = 8         // 1=谀? 2=胀? 3=帜? 4=赏? 5=捱? 6=圻?7=ASCII 8=3D
OtherWinBorderType      = 8         // 1=谀? 2=胀? 3=帜? 4=赏? 5=捱? 6=圻?7=ASCII 8=3D
DisplayBoxed            = 0         // 0=Never, 1=Mouse, 2=Always
SpecialEffects          = _NONE_
Transparency            = 0
KeepWinOnTop            = Off
InsertCursorSize        = 4         // 0=no cursor, 1..8=cursor size, 9=vertical bar
OverwriteCursorSize     = 8         // 0=no cursor, 1..8=cursor size, 9=vertical bar
ShowEOFMarker           = On
ShowLineNumbers         = Off
StartupVideoMode        = _MAXIMIZED_
WinPosLeft              = 65532
WinPosTop               = 65532
ShowSyntaxHilite        = On
FontName                = "Fixedsys"
FontSize                = 10/*10:HighDPI|12:LowDPI*/        // Point Size
FontFlags               = _NONE_

// Attributes

CurrWinBorderAttr       = Color(Bright White on Blue)
OtherWinBorderAttr      = Color(Bright White on Cyan)
MenuTextAttr            = Color(Bright White on Cyan)
MenuTextLtrAttr         = Color(Bright Cyan on Cyan)
MenuGrayAttr            = Color(Bright Black on Cyan)
MenuSelectGrayAttr      = Color(Bright Black on Blue)
MenuBorderAttr          = Color(Bright White on Cyan)
MenuSelectAttr          = Color(Bright White on Blue)
MenuSelectLtrAttr       = Color(Bright Cyan on Blue)
BlockAttr               = Color(Blue on Green)
CursorInBlockAttr       = Color(Blue on Green)
CursorAttr              = Color(Blue on Cyan)
HiLiteAttr              = Color(White on Red)
TextAttr                = Color(Blue on White)
EOFMarkerAttr           = Color(Bright Yellow on White)
MsgAttr                 = Color(Bright White on Cyan)
StatusLineAttr          = Color(Bright White on Blue)
LineNumbersAttr         = Color(Black on White)

// Help Attributes

HelpInfoAttr            = Color(Bright Green on Blue)
HelpLinkAttr            = Color(Bright Yellow on Blue)
HelpSelectAttr          = Color(Blue on White)
HelpBoldAttr            = Color(Bright White on Blue)
HelpItalicsAttr         = Color(Bright Magenta on Blue)
HelpTextAttr            = Color(White on Blue)

// SyntaxHilite Attributes

IncompleteQuoteAttr     = Color(Bright White on White)
NumberAttr              = Color(Red on White)
Directive1Attr          = Color(Green on White)
Directive2Attr          = Color(White on White)
Directive3Attr          = Color(Bright Red on White)
MultiLnDlmt1Attr        = Color(Bright Black on White)
MultiLnDlmt2Attr        = Color(Bright Yellow on White)
MultiLnDlmt3Attr        = Color(Bright White on White)
SingleLnDlmt1Attr       = Color(Bright Black on White)
SingleLnDlmt2Attr       = Color(Bright Yellow on White)
SingleLnDlmt3Attr       = Color(Bright White on White)
Quote1Attr              = Color(Bright Blue on White)
Quote2Attr              = Color(Bright Blue on White)
Quote3Attr              = Color(Bright Blue on White)
ToEOL1Attr              = Color(Bright Black on White)
ToEOL2Attr              = Color(Bright Yellow on White)
ToEOL3Attr              = Color(Bright White on White)
KeyWords1Attr           = Color(Black on White)
KeyWords2Attr           = Color(Magenta on White)
KeyWords3Attr           = Color(Bright Cyan on White)
KeyWords4Attr           = Color(White on White)
KeyWords5Attr           = Color(Bright Green on White)
KeyWords6Attr           = Color(Bright White on White)
KeyWords7Attr           = Color(Bright Red on White)
KeyWords8Attr           = Color(Bright Magenta on White)
KeyWords9Attr           = Color(Yellow on White)

// Print Output Options

PrintLeftMargin         = 0
PrintRightMargin        = 0
PrintLinesPerPage       = 0
PrintTopMargin          = 0
PrintBotMargin          = 0
PrintLineSpacing        = 1         // 1=Single, 2=Double, 3=Triple, etc...
PrintLineNumbers        = Off
PrintHeader             = ""        // F=FileName, D=Date, T=Time, P=Page
PrintFooter             = ""        // F=FileName, D=Date, T=Time, P=Page
PrintFirstPage          = 0
PrintLastPage           = 0
PrintCopies             = 1
PrintPause              = Off
PrintUseScreenFont      = On
PrinterFontName         = "Courier New"
PrinterFontSize         = 10        // Point Size
PrinterFontFlags        = _NONE_

EndConfig

在2022年7月20日星期三 UTC+8 14:42:58<Carlo Hogeveen> 写道:

zhong zhao

unread,
Jul 20, 2022, 6:29:01 AMJul 20
to SemWare TSE Pro text editor
zz_tsestart.s:
proc TSE_default()
    SetColorTableValue(_BACKGROUND_, 0,0x000000 )    // black          0x000000
    SetColorTableValue(_BACKGROUND_, 1,0x000080 )    // blue           0x000080
    SetColorTableValue(_BACKGROUND_, 2,0x548c54 )    // green          0x008000
    SetColorTableValue(_BACKGROUND_, 3,0x548c87 )    // cyan           0x008080
    SetColorTableValue(_BACKGROUND_, 4,0x800000 )    // red            0x800000
    SetColorTableValue(_BACKGROUND_, 5,0x800080 )    // magenta        0x800080
    SetColorTableValue(_BACKGROUND_, 6,0x4c8065 )    // brown          0x808000
    SetColorTableValue(_BACKGROUND_, 7,0xa0a0a0 )    // light gray     0xc0c0c0
    SetColorTableValue(_BACKGROUND_, 8,0x808080 )    // dark gray      0x808080
    SetColorTableValue(_BACKGROUND_, 9,0x0000ff )    // light blue     0x0000ff
    SetColorTableValue(_BACKGROUND_,10,0x00ff00 )    // light green    0x00ff00
    SetColorTableValue(_BACKGROUND_,11,0x00ffff )    // light cyan     0x00ffff
    SetColorTableValue(_BACKGROUND_,12,0xff0000 )    // light red      0xff0000
    SetColorTableValue(_BACKGROUND_,13,0xff00ff )    // light magenta  0xff00ff
    SetColorTableValue(_BACKGROUND_,14,0xffff00 )    // yellow         0xffff00
    SetColorTableValue(_BACKGROUND_,15,0xffffff )    // white          0xffffff

    SetColorTableValue(_FOREGROUND_, 0,0x000000 )    // black          0x000000
    SetColorTableValue(_FOREGROUND_, 1,0x000080 )    // blue           0x000080
    SetColorTableValue(_FOREGROUND_, 2,0x004000 )    // green          0x008000
    SetColorTableValue(_FOREGROUND_, 3,0x004040 )    // cyan           0x008080
    SetColorTableValue(_FOREGROUND_, 4,0x800000 )    // red            0x800000
    SetColorTableValue(_FOREGROUND_, 5,0x800080 )    // magenta        0x800080
    SetColorTableValue(_FOREGROUND_, 6,0x804000 )    // brown          0x808000
    SetColorTableValue(_FOREGROUND_, 7,0xfeddbc )    // light gray     0xc0c0c0
    SetColorTableValue(_FOREGROUND_, 8,0x404040 )    // dark gray      0x808080
    SetColorTableValue(_FOREGROUND_, 9,0x0000ff )    // light blue     0x0000ff
    SetColorTableValue(_FOREGROUND_,10,0x86fc86 )    // light green    0x00ff00
    SetColorTableValue(_FOREGROUND_,11,0x9ffafa )    // light cyan     0x00ffff
    SetColorTableValue(_FOREGROUND_,12,0xffbfbf )    // light red      0xff0000
    SetColorTableValue(_FOREGROUND_,13,0xfecbfe )    // light magenta  0xff00ff
    SetColorTableValue(_FOREGROUND_,14,0xffffa0 )    // yellow         0xffff00
    SetColorTableValue(_FOREGROUND_,15,0xffffff )    // white          0xffffff
end
proc main()
    TSE_default()
end

在2022年7月20日星期三 UTC+8 14:42:58<Carlo Hogeveen> 写道:

zhong zhao

unread,
Jul 20, 2022, 6:29:01 AMJul 20
to SemWare TSE Pro text editor
zz_transparent_mark_asm_patch.bat:
 zz_lr.exe g32.exe 3213c 8b 7d 08 8a 45 0c 56 89 FE 8B 4D 10 8A 65 04 66
 zz_lr.exe g32.exe 3214c 3D 21 EF 74 04 F3 AA EB 09 AC 24 0F 0C 20 AA 49
 zz_lr.exe g32.exe 3215c 7f f7 8B 45 08 5E 5F 5D C3
rem Transparent Mark

在2022年7月20日星期三 UTC+8 14:42:58<Carlo Hogeveen> 写道:

zhong zhao

unread,
Jul 20, 2022, 6:29:01 AMJul 20
to SemWare TSE Pro text editor
zz_lr.c:
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <io.h>
FILE *f;
char ln[64+1];//Because sscanf(argv[66],"%hx",&ln[66-3]); modify ln[63] and ln[64] !
int i;
__int64 hexoffset64;
void main(int argc,char *argv[]) {
    if (argc<=3) {
        cprintf("Locate & Replace, designed by zhao4...@163.com\n\r");
    HELP:
        cprintf("Usage: LR filename.ext hexoffset64 byte1 byte2 byte3 ...");
        return;
    }
    if (argc>64+3) {
        cprintf("Up to 64 bytes\a");
        return;
    }
    if ((f=fopen(argv[1],"r+b"))==NULL) {
        cprintf("Can not open %s\a",argv[1]);
        return;
    }
    if (1!=sscanf(argv[2],"%I64x",&hexoffset64)) {fclose(f);goto HELP;}
    if (hexoffset64>=_filelengthi64(_fileno(f))) {
        cprintf("hexoffset64==%016I64x >= %016I64x==_filelengthi64 of file %s\a",hexoffset64,_filelengthi64(_fileno(f)),argv[1]);
        fclose(f);
        return;
    }
    for (i=3;i<argc;i++) {
        if (1!=sscanf(argv[i],"%hx",&ln[i-3])) {fclose(f);goto HELP;}
    }
    if (hexoffset64!=_lseeki64(_fileno(f),hexoffset64,SEEK_SET)) {
        cprintf("_lseeki64 to %I64x fail\a",hexoffset64);
        fclose(f);
        return;
    }
    if ((int)fwrite(ln,1,argc-3,f)!=argc-3) {
        cprintf("fwrite %d bytes fail\a",argc-3);
        fclose(f);
        return;
    }
    fclose(f);
}

在2022年7月20日星期三 UTC+8 14:42:58<Carlo Hogeveen> 写道:

zhong zhao

unread,
Jul 20, 2022, 6:29:37 AMJul 20
to SemWare TSE Pro text editor
part of zz_g32.asm:
File: c:\TSEPro\zz_g32.asm 29 occurrences found on 29 lines
   15514: .text:00408AEA 568 E8 49 A0 02 00          call    _memset                  ;~update marked text color
   15515: .text:00408AEF 568 83 C4 0C                add     esp, 0Ch                 ;~0xEF is lo byte of return address
   97453: .text:00432B3C 008 8A 45 0C                mov     al, byte ptr [ebp+c]     ;~ .text:00432B3C 008 8B 7D 08                mov     edi, [ebp+arg_0]  ;Transparent Mark Patch begin here. edi is address of old attrs
   97454: .text:00432B3F 008 8B 55 10                mov     edx, [ebp+n]             ;~ .text:00432B3F 008 8A 45 0C                mov     al, [ebp+arg_4]   ;get attr of to set,0x21 is green background and blue foreground
   97455: .text:00432B42 008 8B 7D 08                mov     edi, [ebp+s]             ;~ .text:00432B42 008 56                      push    esi
   97456: .text:00432B45 008 8A E0                   mov     ah, al                   ;~ .text:00432B43 00C 89 FE                   mov     esi, edi          ;esi is address of old attrs
   97457: .text:00432B47 008 F7 C2 FC FF FF FF       test    edx, 0FFFFFFFCh          ;~ .text:00432B45 00C 8B 4D 10                mov     ecx, [ebp+arg_8]  ;n bytes to set
   97458: .text:00432B4D 008 74 5D                   jz      short loc_432BAC         ;~ .text:00432B48 00C 8A 65 04                mov     ah, [ebp+4]       ;lo byte of return address
   97459: .text:00432B4F 008 66 89 07                mov     [edi], ax                ;~ .text:00432B4B 00C 66 3D 21 EF             cmp     ax, 0EF21h        ;is called from update marked text color and attr of to set,0x21 is green background and blue foreground
   97460: .text:00432B52 008 8D 4C 17 FC             lea     ecx, [edi+edx-4]         ;~ .text:00432B4F 00C 74 04                   jz      short loc_432B55  ;yes, patch it!
   97461: .text:00432B56 008 66 89 47 02             mov     [edi+2], ax              ;~ .text:00432B51 00C F3 AA                   rep stosb                 ;no, set ecx(n bytes) new attr
   97462: .text:00432B5A 008 8B 07                   mov     eax, [edi]               ;~ .text:00432B53 00C EB 09                   jmp     short loc_432B5E
   97463: .text:00432B5C 008 C1 EA 03                shr     edx, 3                   ;~ .text:00432B55
   97464: .text:00432B5F 008 74 43                   jz      short loc_432BA4         ;~ .text:00432B55                             loc_432B55:
   97465: .text:00432B61                                                              ;~ .text:00432B55 00C AC                      lodsb                     ;get old attr
   97466: .text:00432B61                             loc_432B61:                      ;~ .text:00432B56 00C 24 0F                   and     al, 0Fh           ;get foreground color of old attr
   97467: .text:00432B61 008 89 07                   mov     [edi], eax               ;~ .text:00432B58 00C 0C 20                   or      al, 20h           ;set background to green
   97468: .text:00432B63 008 89 47 04                mov     [edi+4], eax             ;~ .text:00432B5A 00C AA                      stosb                     ;save new attr
   97469: .text:00432B66 008 4A                      dec     edx                      ;~ .text:00432B5B 00C 49                      dec     ecx               ;next byte
   97470: .text:00432B67 008 74 30                   jz      short loc_432B99         ;~ .text:00432B5C 00C 7F F7                   jg      short loc_432B55  ;loop
   97471: .text:00432B69 008 89 47 08                mov     [edi+8], eax             ;~ .text:00432B5E
   97472: .text:00432B6C 008 89 47 0C                mov     [edi+0Ch], eax           ;~ .text:00432B5E                             loc_432B5E:
   97473: .text:00432B6F 008 4A                      dec     edx                      ;~ .text:00432B5E 00C 8B 45 08                mov     eax, [ebp+arg_0]
   97474: .text:00432B70 008 74 27                   jz      short loc_432B99         ;~ .text:00432B61
   97475: .text:00432B72 008 89 47 10                mov     [edi+10h], eax           ;~ .text:00432B61                             loc_432B61:
   97476: .text:00432B75 008 89 47 14                mov     [edi+14h], eax           ;~ .text:00432B61 00C 5E                      pop     esi
   97477: .text:00432B78 008 4A                      dec     edx                      ;~ .text:00432B62 008 5F                      pop     edi
   97478: .text:00432B79 008 74 1E                   jz      short loc_432B99         ;~ .text:00432B63 004 5D                      pop     ebp
   97479: .text:00432B7B 008 89 47 18                mov     [edi+18h], eax           ;~ .text:00432B64 000 C3                      retn

在2022年7月20日星期三 UTC+8 14:42:58<Carlo Hogeveen> 写道:

zhong zhao

unread,
Jul 20, 2022, 6:29:37 AMJul 20
to SemWare TSE Pro text editor
zz_transparent_mark_asm_patch_FOR_TSE443.bat:
 zz_lr.exe g32.exe 32088 8b 7d 08 8a 45 0c 56 89 FE 8B 4D 10 8A 65 04 66
 zz_lr.exe g32.exe 32098 3D 21 EF 74 04 F3 AA EB 09 AC 24 0F 0C 20 AA 49
 zz_lr.exe g32.exe 320a8 7f f7 8B 45 08 5E 5F 5D C3
rem Transparent Mark

在2022年7月20日星期三 UTC+8 14:42:58<Carlo Hogeveen> 写道:

Carlo Hogeveen

unread,
Jul 20, 2022, 6:46:55 AMJul 20
to sem...@googlegroups.com

Thank you for understanding.
From your code I can see you are obviously a skilled programmer.
To each their own: I have already started on a macro-only solution.
Thank you for sharing your code,
Carlo



zhong zhao

unread,
Jul 25, 2022, 1:14:51 AMJul 25
to SemWare TSE Pro text editor
Why perfect?
currline in line block:
marked_synhi.png
currline:
currline_synhi.png
currline in column block:
currline_incolumnblock.png
currline in character block begin:
currline_incharacterblockbegin.png
currline in character block end:
currline_incharacterblockend.png
23.gif
Reply all
Reply to author
Forward
0 new messages