News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Another ASM editor

Started by NoCforMe, September 03, 2022, 06:54:23 AM

Previous topic - Next topic

jj2007

DLG_Find.inc is still missing.

; Get replacement text to start:
   INVOKE   GetDlgItemText, hWin, $replaceEdit, OFFSET ReplTextBuffer, SIZEOF $findReplBufferSize

I get an error with UAsm ("Error A2230: Invalid operand for SIZEOF" - correct), but ML version 15 has no problem with SIZEOF $findReplBufferSize. It firmly believes that the size of an equate can be 256 :rolleyes:

tmp$ CATSTR <TheSize=>, %(SIZEOF $findReplBufferSize)
% echo tmp$

NoCforMe

Quote from: jj2007 on October 01, 2022, 08:49:00 AM
DLG_Find.inc is still missing.

Updated version in post above.

Quote
; Get replacement text to start:
   INVOKE   GetDlgItemText, hWin, $replaceEdit, OFFSET ReplTextBuffer, SIZEOF $findReplBufferSize

Interesting. Assembles fine here with ML.exe, but it sure looks wrong. Fixed in zip in post above.
Assembly language programming should be fun. That's why I do it.

jj2007

Line 1316, INVOKE InitmcLB, InstanceHandle, produces a linker error: Unresolved external symbol '_InitmcLB@4'

I commented it out, and it works now. It seems you are using a library somewhere that contains InitmcLB :rolleyes:

mcLB.inc: InitmcLB PROTO hInst:HINSTANCE

NoCforMe

Oy.

That's the initialization routine for my mcListbox custom control, which is in mcLB.obj (and there's a PROTO in mcLB.inc). Dunno why you're getting a link error. I'll have to look into this.

The program will work without that, but you won't be able to open the Goodies dialog.
Assembly language programming should be fun. That's why I do it.

jj2007

Quote from: NoCforMe on October 01, 2022, 09:25:39 AM
Oy.

That's the initialization routine for my mcListbox custom control, which is in mcLB.obj (and there's a PROTO in mcLB.inc). Dunno why you're getting a link error. I'll have to look into this.

The program will work without that, but you won't be able to open the Goodies dialog.

Problem solved:
INVOKE   InitmcLB, InstanceHandle   ; OPT_DebugL mcLB.obj

I hit F6, and that works in 99% of all cases - but RichMasm didn't know that an object file should be linked.

WinMain PROC
LOCAL msg:MSG, brush:HBRUSH, wX:DWORD, wY:DWORD, gpRect:RECT
LOCAL xPos:DWORD, ncm:NONCLIENTMETRICS, buffer[256]:BYTE

INVOKE InitmcLB, InstanceHandle ; OPT_DebugL mcLB.obj
INVOKE LoadLibrary, OFFSET RichEditDLLname ; OPT_Arg1 EdAsm.ini

NoCforMe

Aha. That's why I included my "make" file, makeEdAsm.bat.
Assembly language programming should be fun. That's why I do it.

NoCforMe

Executable only attached below (source available if anyone wants it).

It's getting closer. Added an "about" window which has a version #, couple other small refinements.

Still need:

  • Popup context menu for editing (copy/paste, etc.)
  • Finish printing stuff (setting margins: ugh!, footer)
  • Finally get word wrap on/off put in (JJ's shaking his head ...)
  • And when I do that I could put in line #s, which would help with tracking down assembly errors

Like they say: 90% done, with 90% to go ...
Assembly language programming should be fun. That's why I do it.

NoCforMe

... a few months later ...

Lots more stuff in this program now. But there's something that's got me mystified: a hotkey that doesn't work.

I've put in a bunch of hotkeys that do work: Ctrl-O for open, Ctrl-S for save, Ctrl-P for print, etc.

But I just added a feature that lets you view "extra" files in a separate window, handy for looking at other source files. It works from the menu, AND the hotkey works BUT ONLY IF the cursor is over some non-client part of the window, like the title bar: it never works if the cursor is in the edit window. The other ones work no matter where the cursor is.

Here's my hotkey structure:

;***** Keyboard accelerators:  *****
KBaccelerators LABEL DWORD
ACCEL <FCONTROL or FVIRTKEY, 'N', $menuNewFile>
ACCEL <FCONTROL or FVIRTKEY, 'O', $menuOpenFile>
ACCEL <FCONTROL or FVIRTKEY, 'S', $menuSaveFile>
ACCEL <FCONTROL or FVIRTKEY, 'P', $menuPrint>
ACCEL <FCONTROL or FVIRTKEY, 'F', $menuFindText>
ACCEL <FCONTROL or FVIRTKEY, 'R', $menuReplaceText>
ACCEL <FCONTROL or FVIRTKEY, 'T', $menuViewExtraFile>
ACCEL <FVIRTKEY, VK_F3, $menuFindAgain>

$numKBaccels EQU ($ - KBaccelerators) / SIZEOF ACCEL


Like I say, they ALL work, EXCEPT the "$menuViewExtraFile" one, and I just can't figure out why.

I've tried every letter in the alphabet, of course avoiding the ones that are used by RichEdit (this page of José Roca's was helpful in finding all the RichEdit shortcut keys). Makes no difference what letter I use, it just doesn't trigger a response.

It's not a big deal, but it's quite annoying. I guess I'll just put another button on the menu bar or something ...

Assembly language programming should be fun. That's why I do it.

jj2007

You are right, it doesn't work with RichEd, and that is strange, because even a single "a" works fine, see attached testbed.

QuoteSetAccels Alt F4, F1: MyHelp
  SetAccels Ctrl F1, Ctrl F2, Ctrl F3, Ctrl T, Alt T, Ctrl B
  SetAccels Alt F1
  SetAccels Shift F1
  SetAccels a, B, c, D
  SetAccels Ctrl O: CtrlOpen
  SetAccels Ctrl VK_SPACE: MyConSpace, x: LowercaseX, X: UppercaseX
  SetAccels Ctrl Z: NoUndo

All work fine, except Ctrl T and Alt T. You will have to subclass the control to catch WM_CHAR & friends. I made a quick test with WM_KEYDOWN, and that works fine :cool:

Btw the normal edit control behaves exactly the same.

NoCforMe

Sorry, a basic mistake on my end. Had nothing whatever to do with accelerators at all.

The problem was in my wrapper routine for GetOpenFileName(). One of the elements of the OPENFILENAME structure, lpstrFile, is suppposed to either contain a null-terminated filename for initializing the dialog or a NULL. Since the routine I was calling from used a local variable to set that element (I usually use a global, and it's always initialized) that wasn't initialized, it contained garbage. Hence GetOpenFileName() never fired.

It was weird: It would work maybe one out of ten times, when it just happened that there was a NULL in that local variable.

I found the problem by putting MessageBeep() in various places.

Someday maybe I'll have made all these mistakes at least once ...
Assembly language programming should be fun. That's why I do it.

NoCforMe

Here's the current version. It's stable, has most (not all, of course) of the features I want, and has been tested by daily use by me for the last couple months.

Latest addition is an "extra file" viewer that pops up a file (any type, could even be binary) in a window for quick reference (can be multiple instances). These windows are "always on top", so if they get in the way you can minimize (or close) them.

it comes with both .cfg and .ini files; the .cfg sets up some features of the interface ("cubbyholes" and "goodies"--you'll see what those are), can be edited by hand (ASCII text file) and is only read by the editor. The .ini contains things like window sizes and is both read and written by the program. If for some reason the program comes up at a crazy size or location on your screen, just delete the .ini file so it'll use its default size and position, which are reasonable. (You can also edit this file if need be, but only when the program isn't running.)

I'll post the source package later. Not feeling at all proprietary about this, but the source .asm file is now 193KB, so it's getting a bit hefty.

As always, let me know what you think.
Assembly language programming should be fun. That's why I do it.

jj2007

Works fine :thumbsup:

I like the inserts. What's the difference to "goodies"?

What I would miss most: the build button that feeds the current text to a batch file.

Minor suggestion: F3 for next match down, Shift F3 for next match up.

HSE

 :thumbsup:

Font color don't work, and there is no way to change background.
Equations in Assembly: SmplMath

NoCforMe

Quote from: jj2007 on January 16, 2023, 09:34:44 PM
Works fine :thumbsup:

I like the inserts. What's the difference to "goodies"?

Thanks. They're just an extension of the inserts shown in the listbox out front. You can add lots more of them here, since they appear in a "mcListbox" (my custom control). All of them are easily customizable by editing the .cfg file.

Quote
What I would miss most: the build button that feeds the current text to a batch file.

I've been thinking about that, moving closer to becoming an IDE. Working on parsing batch files ...

Quote
Minor suggestion: F3 for next match down, Shift F3 for next match up.

That'll go on the to-do list. Along with word wrap ...

Oh, and I'm thinking of maybe chucking bookmarks, since they don't work any near as nicely as yours do, since you're actually using the RichEdit control to store them. They're still useful in my editor, but they move around if you add text before them.
Assembly language programming should be fun. That's why I do it.

NoCforMe

Quote from: HSE on January 16, 2023, 10:24:16 PM
:thumbsup:

Font color don't work, and there is no way to change background.

I've put in no such options. What font and background colors do you want to change, the edit control? I could do that.
Assembly language programming should be fun. That's why I do it.