The ability to manipulate the memory directly is essential to X86 programmers. For that reason, I've introduced the "memview2" routine, as a small enhancement to current "memview" routine. This routine will also display the offsets, both in hex and decimal format, in addition to the addresses. This will enable a user to see the content of a memory and go to / manipulate a specific offset directly.

Now that the offsets is clearly visible, I've added "mem_insert" routine to enable one to insert any code or data of any size to a specific offset. This is even more effective if used in combination with "mem_load", like for example, you want to load a DLL. But I'm not going to show that here.

Below is a simple example, featuring both "memview2" and "mem_insert" combo, to extend a 0-ended string, past its 0 delimiter.

I just finished creating a minimal "sbase32w.asm" version of Win32 BASELIB source. Well this one is a very basic version (but working), missing many other functions of the original "sbase32w.asm".

Major difference: This one is developed by using high-level features of FASMW (proc, invoke, stdcall, .if etc).

I don't personally like it due to its high-level nature... but I think ignoring FASM's high-level features completely is not 'productive' either. Some day, you'd be required to come up with Line of Code (LOC) "costing" and knowing some of the high-level features would come handy.

But contrary to popular belief, ASM high-level features are actually NOT for beginners no matter how friendly they look. High features are for those who already appreciated how they work at the low-level layer. If you prefer the low-level, just download BASELIB at the first post.

Good luck with this one. Correct the bugs yourself

p/s "bkernel.asm" can be downloaded from "core.zip" on post#1

Last edited by fasmnewbie on 14 Dec 2017, 09:55; edited 18 times in total

But contrary to popular belief, ASM high-level features are actually NOT for beginners no matter how friendly they look. High features are for those who already appreciated how they work at the low-level layer. If you prefer the low-level, just download BASELIB at the first post.

A very wise words. I'd like to emphasize this myself - if you use high level without enough knowledge of what is under the hood, you're going to use it like a whimsical black box that can blow up any minute because you do not really know what it ends up doing in the low level.

Thanks for the support Tomasz. I can see similar trend from the likes of MASM when they dropped some of the high-level features which were once crucial in 32-bit ML. Like "invoke" and .IF/.ENDIF. Microsoft decided to back to the low-level approach.

Just added a new Win64 source file (core64.asm). This source is an equivalent of BASELIB's "base64w.asm", targetted for Win64. The source is in FASM syntax only. File is added in "core.zip" on Page 1.

The differences from "base64w.asm":

1. Partially ABI compliance.
2. Rely only on kernel32 as the main external.
3. Most of the routines now are callable from high-level languages, except those requiring XMM returns and arguments. (This is a future project, if I have time)
4. Routine changes:

Added
----------
mem_alloc2
mem_free2
dble2str
file_delete

Discarded
----------
memview2
memviewb
prnbinf
prndblr
prnfltr

Warning: Still quite ugly and could be buggy. "base64w.asm" and "core64.asm" although similar in functions, are not compatible with each other.

Bug report: I think FASM's proc32 or stdcall scratches EDX when called/used from within a function and addressing local data via "ADDR" operator. Using the library provided above, here's how the issue emerges (observe dumpreg output of EDX);

If the parameter is preceded by the addr word, it means that this value is an address and this address should be passed to procedure, even if it cannot be done directly - like in the case of local variables, which have addresses relative to EBP/RBP register. In 32-bit case the EDX register is used temporarily to calculate the value of address and pass it to the procedure.

I re-uploaded the "bkernel.asm" above to demonstrate the use of "DUP(x)" inside a LOCALS...ENDL instead of plain "RB" (reserve byte). Already has a lot of RB in there, but no DUP. If you know any other high-level features that can be included, do modify and share. Thanks.

Now that all the basic modules are available, you can extend them by building some nice macros on top of it. Below is a demo of creating 2 macro extensions from "bkernel.asm" or any other BASELIB sources.

Updated to Revision 3.0. This is a major and milestone update. With LOTS of bug fixes (fatal and non-fatal). Note that the attachment included in the first post is FASM-only attachments to reduce the load.

For other syntaxes and other things, the full load of BASELIB/CPULIB can be downloaded from Sourceforge or my Google+.

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum