flat assembler
Message board for the users of flat assembler.
![]() Goto page 1, 2 Next |
Author |
|
jeff 29 Dec 2006, 18:36
AsmIDE version 0.9-22 released
This release includes a new debugger, source code generator, disassembler, updated reference tool, library expansion and numerous other changes. AsmIDE is a collection of program to support assembler development on Linux. It runs in a terminal and the library supports terminal programs. Other programs available include, file managers, editors, comment extractor, program timer, project setup, and more. http://members.save-net.com/jko%40save-net.com/asm/ |
|||
![]() |
|
rugxulo 29 Dec 2006, 19:51
Quote: Last Updated: January 4, 2007 Wow, Santa must've brought you a time machine! ![]() |
|||
![]() |
|
vid 31 Dec 2006, 09:01
i will surely look at it when i have time. but isn't it oriented towards NASM?
|
|||
![]() |
|
lsa 31 Dec 2006, 19:01
[quote="vid"]i will surely look at it when i have time. but isn't it oriented towards NASM?[/quote]
See: http://members.save-net.com/jko%40save-net.com/asm/h_asm.htm The default is nasm but any assembler seems to be usable. |
|||
![]() |
|
jeff 01 Jan 2007, 15:48
rugxulo wrote:
Whoops, you are right, missed that. That was the expected release date but I released early so work could begin on a trace program. Today I fixed one link on the opinion page but the date is still Jan 7. all the best, jeff |
|||
![]() |
|
jeff 03 Jan 2007, 15:34
The library can be used with fasm if the source is converted
to include files. This is easy to do. Huh! That is nonsense. The library is in nasm and converting to fasm source would take a little work. Better to just create a object file and link against AsmLib using "ld" jeff (expert at correcting his stupid statements) |
|||
![]() |
|
vid 20 Jan 2007, 13:28
jeff: are you also involved in libasm?
I was looking at it's heap management and discovered this: Code: ;eax = size of block to allocate add eax,_memory_chunk_size ; Usermemory is chunk.size-chunk_size add eax,PAGE_SIZE-1 and eax,PAGE_MASK do i understand it right? smallest allocable block is 4KB (PAGE_SIZE)? That seems pretty wasty to me... |
|||
![]() |
|
jeff 20 Jan 2007, 19:39
vid wrote: jeff: are you also involved in libasm? Hi vid, No I'm not involved with libasm, but AsmLib also has a memory manager that will handle small allocations. It doesn't have a very efficient garbage collection, but works OK for most applications. It does have some advantages: 1. fast and memory efficient 2. all recordkeeping is checksumed and if any memory area overflows (memory leak) an error is reported. There is a new version of AsmLIb on the web page. IIt is included with the AsmRef update at end of download section. This is a snapshot of work in progress, but I don''t know of any errors. I'll be glad t answer any questions. all the best, jeff http://members.save-net.com%40save-net.com/asm/ |
|||
![]() |
|
vid 20 Jan 2007, 21:36
oh, maybe i mixed up the libraries. The library used in this project is AsmLib? Sorry then.
Yes, AsmLib heap management looks nice. As I see it, dword boundary alignment of block size, 12 byte overhead per block, heap corruption checking. My heap manager in FASMLIB will align size of block to higher compile-time value, default 64bytes. This will make small increases slightly faster and hopefully reduce fragmentation of heap. My block header will have 16 or 20 bytes, with heap corruption checking roughly equvilent to yours. I will just have signature at beggining of each block, which is pretty probable to be overwritten on some overflow. However, AsmLib seem to support only Alloc and Free. How about ReAlloc, GetSize etc? by the way, with these two pops out problem with saving only aligned size. GetSize should return size that was passed to Alloc, not aligned (real) size of block. Also Realloc should only preserve data of size passed to alloc, not aligned size. Is there some console input support in AsmLib? I couldn't find one. Something like scanf() in libc. thanks for reply, looking forward to discussions. |
|||
![]() |
|
jeff 21 Jan 2007, 16:50
vid wrote: oh, maybe i mixed up the libraries. The library used in this project is AsmLib? Sorry then. Is FASLIB following the structure of a "c" stdlib format? Where does one find the latest version of FASLIB? Also, I think it is great that you are working on a Linux library. If anything of value is in AsmLib, use it for FASMLIB. AsmLib is a work in process and doesn't try to be pretty or bullet proofl, so use the code with caution. On the other hand, it is used to create many applications for AsmIDE and is functional. all the best, jeff |
|||
![]() |
|
vid 21 Jan 2007, 18:04
Quote: Is FASLIB following the structure of a "c" stdlib format? EVERY! procedure return error status in CF. If CF=1, error happened, and EAX=error code. Error codes are global per library (not always -1, -2). This allows passing error code to parent procedure just by returning. This way you can preserve info about source of error. If CF=0, there was no error, and value is returned in EAX, ZF, OF, SF. This also allows return values in flags for conditional (signed) jumps, for example in memory block or string comparison, for sorting. Quote: Where does one find the latest version of FASMLIB? ![]() Site will be [url]fasmlib.flatassembler.net[/url], but i haven't got no real "site" there. just packed and unpacked fasmlib. Latest version is 0.4, but 0.5 is on the way. It will have much better support for other assemblers than FASM. It will support FASM, MASM, NASM and YASM, with usage docs, includes and examples. My "development thread" is here, you can ask specific questions there. Quote: Also, I think it is great that you are working on a Linux library. Quote: If anything of value is in AsmLib, use it for FASMLIB. AsmLib is a work in process and doesn't try to be pretty or bullet proofl, so Thanks. I use all libs i find in my study, but there is none i would call "bulletproof" - that is what i try to reach. Make 100% working portable library usable in all major x86-32 assemblers and systems. Some kind of "standard" have fun EDIT: here is excerpt from FASMLIB docs, describing what is FASMLIB: Quote: FASMLIB is multiplatform library for 32bit x86 assembly language. It has two main purposes. |
|||
![]() |
|
jeff 22 Jan 2007, 23:30
Hi Vid,
I looked at FASMLIB memory manager. It is using the kernel mmap function, whick allocates 4k blocks (I think). That appears to be the method used by most memory managers. AsmLib uses the kernel "ext" function which extends the end of programs. There are a few programs that use this method. I suspect the mmap is a better approach, but I find using "ext" easy and very memory efficient. As for ReAlloc, I think the name should be "memory_extend" or something like that. That helps un non-"c" programmers remember what it does <grin>. I've never liked this function, because it is error prone and messy to implement. Anyway, it fits the mmap logic better than the "ext" logic. As for scanf. I've had a lot of trouble with input from stdin. One has toworry about character blocking (avoiding splitting multi byte keys) and pipes and handling single escape characters. The "c" libraries often have trouble with single escape characters and Linux tends to avoid them. Using repeat keys (such as holding down the arrow keys) does not work well in some xterminals and often things get worse if you nest terminals on a slow cpu. A few days ago I found a blog that claimed you can't use solitary escape keys in Linux. They had examples and assumed everyone used existing libraries. Wrong!! So... if you look at the AsmLib keyboard handlers and think them strange, they are <grin>. all the best, jeff |
|||
![]() |
|
vid 23 Jan 2007, 07:26
Quote: looked at FASMLIB memory manager. It is using the kernel mmap function, whick allocates 4k blocks (I think). That appears to be the method used by most memory managers. Quote: AsmLib uses the kernel "ext" function which extends the end of programs. There are a few programs that use this method. I suspect the mmap is a better approach, but I find using "ext" easy and very memory efficient. Quote: As for scanf. I've had a lot of trouble with input from stdin. ![]() Quote: One has toworry about character blocking (avoiding splitting multi byte keys) and pipes and handling single escape characters. The "c" libraries often have trouble with single escape characters and Linux tends to avoid them. Using repeat keys (such as holding down the arrow keys) does not work well in some xterminals and often things get worse if you nest terminals on a slow cpu. A few days ago I found a blog that claimed you can't use solitary escape keys in Linux. They had examples and assumed everyone used existing libraries. Wrong!! |
|||
![]() |
|
jeff 23 Jan 2007, 16:56
[/quote]. I didn't know about multi-byte keys. hmmmm... could you point me to more info about them, how they beheave etc? Then I could support them.[/quote]
It has been years since I've seen a discusson of keyboard handlers. This leads to some startling conclusions. It appears most/all of Linux assembler code is not aware of the probelm. If that is true then the code probably isn't being used much. Sad, but probably true. So... here is what I have found. UNIX keypress's can create a string of bytes usually starting with the escape character. The actual string of bytes for a key may vary between Linux terminals. Normally, if the program reads stdin it gets all the bytes associated with a keypress. Problems start when keys stack up in the buffer or the program can not keep up with keyboard activity. A program can have other programs looking at stdin first and passing the data on. The other programs may send partial key sequences and we can't not make any assumpitons about how characters are blocked in our read buffer. To handle all this some stdin functions decode the keys first to determine when the end of a keypress sequence is complete. I think the "c" libraries do this and that is why they have trouble with "esc" keys. When they see an escape, they don't know how many keys will follow and set a timer to wait and see. This makes it almost impossibe to hold down the ESC key for repeated ESCapes. For this reason, UNIX tends to avoid use of the ESC key. For the last 20 years no one has found a fix that handles serial terminals and all the UNIX configurations. I've encoutered problems with character blocking several times and played with various designs. As processors get faster the problems occurs less often, but it still lurks around. all the best, jeff |
|||
![]() |
|
vid 23 Jan 2007, 17:19
something doesn't suit me about your description... where is cooked mode? reading from stdin blocks until user presses enter, no? This applies to code that provides cooked mode, not to code that reads from console, or?
|
|||
![]() |
|
jeff 24 Jan 2007, 00:53
HI Vid,
Regarding "cooked mode" I ignore it. Some applications switich to raw mode and leave it, others switch to raw mode just before reading the keyboard. Very few applications use cooked mode. It would be impossible to write an editor or file viewer in cooked mode. For a few years I tried switching to raw mode at start of applications, but that was a bad idea. Now the AsmLib functions switch to raw mode just before reading a key. This appears to be what all the other libraries do. Does all this fit with your testing? I could be spouting nonsense and not know it <grin>. all the best, jeff . |
|||
![]() |
|
vid 24 Jan 2007, 01:23
Quote: Regarding "cooked mode" I ignore it. Some applications switich to raw mode and leave it, others switch to raw mode just before reading the keyboard. Very few applications use cooked mode. It would be impossible to write an editor or file viewer in cooked mode. libc-ish functions (scanf etc) do work in cooked mode though. and that is what i consider console input. something with functionality similar to scanf. Quote: For a few years I tried switching to raw mode at start of applications, but that was a bad idea. Now the AsmLib functions switch to raw mode just before reading a key. This appears to be what all the other libraries do. Quote: Does all this fit with your testing? I could be spouting nonsense and not know it my testing on linux is very poor. I'm just a linux newbie, so i rather hear to those more experienced. just wondering: how do you switch between raw and cooked modes? ioctl? |
|||
![]() |
|
MCD 24 Jan 2007, 02:45
asmide is quiet godd, and I got less trouble working with ot than with other GDB UIs.
|
|||
![]() |
|
jeff 24 Jan 2007, 16:57
Hi Vid
Regarding scanf() in cooked mode.. Yes, a command line tool could use cooked mode and enter the ascii string or character at the current cursor position. This was much too restrictive for me. I would rather enter the string anywhere on the screen and use a window. Also I want to control the size of buffer for string to prevent huge strings from being entered using a pipe. For these reasons AsmLib uses a get_string function in raw mode. Get_string can mimic cooked mode and more. Regarding switching between raw and cooked mode. I think there are some kernel functions to set terminal flags and possibly one for raw/cooked. I don't remember, because my preference is to read a block of all terminal flags and then set bits. After everything is setup write the block back. This is faster and eliminates the use of many small functions to set bits. The "c" libraries have both methods. The terminal block is call "termios" and is a bit messy. If you have installed AsmIDE then run "asmref" and look under terminal information. The termios block is described there. The termios block has a long history and support serial terminals that origionally dominated computting. Reading and writting the terminal block is tricky because we want to restore anything that was changed before our program exits. Failing to do this can screw up other programs. If you look at AsmLib source, there are many functions to read and write termios. Try the terminal directory files: raw_set1 and raw_unset1 These two functions can be used to read termios, save a copy, set the raw bit, then write it back. When done, the raw_unset1 function will restore the origional termios. The UNIX terminal is very complex and has keyboard descriptive files plus other stuff. I prefer to ignore most of this and try to simplify how it appears to the user. The "c" libs try to handle everything and this inflates their size and slows down programs. If you strace the startup for most "c" programs the initialization code goes on forever. This is a choice that all libraries have to make. Will the library work with UNIX (posix) interface or will it use another face. Most try to mimic the "c" libraries and look like UNIX (posix) functions. AsmLIb tries to look somewhat like DOS libraries. all the best, jeff |
|||
![]() |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.