flat assembler
Message board for the users of flat assembler.
Index
> Main > Examples needed! Goto page 1, 2 Next |
Author |
|
comrade 06 Feb 2004, 19:49
I have a few examples here:
http://www.comrade64.com/sources/mkpath.zip This examples makes nested subdirectory path from command-line. http://www.comrade64.com/sources/sysview.zip Incomplete, but functional, window and process browser for Windows. http://www.comrade64.com/sources/dns-mx.zip MX (mail) look-up with DNS protocol. http://www.comrade64.com/sources/linklist.zip Linked lists. http://www.comrade64.com/sources/knob.zip A radial knob. http://www.comrade64.com/sources/circle.zip Drawing circles in mode 13h. |
|||
06 Feb 2004, 19:49 |
|
Tommy 07 Feb 2004, 11:39
Hi Privalov!
Here's a simple base converter. It's not well commented nor well coded, but it might be an example to upload? Best regards, Tommy
|
|||||||||||
07 Feb 2004, 11:39 |
|
scientica 07 Feb 2004, 12:34
Privalov wrote: Every example should be provided as ZIP package, containing all the sources and final executable, some makefiles or documentation if necessary. I got one little question, I assume .zip are for Windows and DOS, examples for other OSes such as MenuetOS, *nix/Linux, *BSD, may use other 'stanard' packing formats (eg .tgz (tar.gzip), .tbz2 (tar.bzip2) for *nix/Linux:/*BSD) I (currently) don't have any examples for linux, but I think Bazik's 'old' examples should be included - for now I don't think they need to be revised _________________ ... a professor saying: "use this proprietary software to learn computer science" is the same as English professor handing you a copy of Shakespeare and saying: "use this book to learn Shakespeare without opening the book itself. - Bradley Kuhn |
|||
07 Feb 2004, 12:34 |
|
Kevin_Zheng 07 Feb 2004, 13:04
Hi,Privalov:
The attached file is writed by pure fasm language and used for tested protect mode on DOS platform. It have been downloaded 87 times on the forum and I do a short update for it. I think that it maybe a good protect mode demo programs . It included all of protect mode edges: flat mode, Interrupt and Exception handler, Page, V86 and Extented V86 mode. It's not well commented nor well coded, because I am Chinese and doesn't a native English user, But I hope that it maybe use to share on the fasm world, it might be an example to upload? Thank you.
|
|||||||||||
07 Feb 2004, 13:04 |
|
Rookie 08 Feb 2004, 13:16
Greetz to everybody.
The Readme.txt sez: Quote: This is one of my first proggies, it demonstrates the handling of command line parameters without the use of the C library, although it copies (more or less) its behaviour. Hope it helps somebody.
_________________ This is who I choose to be. Last edited by Rookie on 08 Feb 2004, 20:06; edited 1 time in total |
|||||||||||
08 Feb 2004, 13:16 |
|
Vortex 08 Feb 2004, 17:43
Hi Privalov,
I am intending to write some documentations for the tool scan and inc2inc _________________ Code it... That's all... |
|||
08 Feb 2004, 17:43 |
|
Tomasz Grysztar 09 Feb 2004, 22:06
Thanks for all your programs - I'll try to assemble the new "examples" section as soon as possible.
|
|||
09 Feb 2004, 22:06 |
|
Bitdog 10 Feb 2004, 04:04
What I use and look for on the internet is INCLUDE FILES
since every program is not much more than program parts put together in a certian order, prewritten, well commented, pretested, program parts in include files is the ticket..... I have converted all my Nasm inc16 procs to Fasm and I'm going to make a Fasm environment zip soon which is a ready to go to work assembly environment for DOS beginners. Templates, help, etc...... I have had my http://bitdog.home.att.net/files/nasmenv.zip out for about a year, & I was 3/4 of the way through making the upgraded version when I found Fasm & fell in love immediately........ So I haven't finished my NEW nasmenv.zip as of yet. ----message edited here------ fasmenv.zip version 0.01 beta is out, see link in message below. Last edited by Bitdog on 12 Feb 2004, 05:23; edited 1 time in total |
|||
10 Feb 2004, 04:04 |
|
Kevin_Zheng 11 Feb 2004, 14:34
Dear Comrade:
I have watched your program:sysview.zip. It's a good program . But I found that it absend a file "token.inc" so that it can't be recomplier. I think that it maybe you forgot it. Can you add it? Thank you. |
|||
11 Feb 2004, 14:34 |
|
avcaballero 11 Feb 2004, 14:58
Hello, I've put it recently in DOS section, it is a small source code (not optimized) which print to the screen the 256 ASCII characters into formatted manner. It can be compiler into COM format. Comments in spanish, sorry
|
|||||||||||
11 Feb 2004, 14:58 |
|
avcaballero 11 Feb 2004, 15:40
I hope to be a good tranlation
|
|||||||||||
11 Feb 2004, 15:40 |
|
comrade 11 Feb 2004, 23:17
Kevin_Zheng wrote: Dear Comrade: Updated (redownload). Thank you for noticing |
|||
11 Feb 2004, 23:17 |
|
Bitdog 12 Feb 2004, 05:12
Hello,
I have made the first version of fasmenv.zip for DOS 16 beginners. It is not much to brag about, but I hope to update it quickly. Any suggestions, advice, or include files I can use would be appreciated. If any one has a problem with what I'm doing, please advise me of it. And, a big thanks Privalov for Fasm. http://bitdog.home.att.net/files/fasmenv.zip PS, every thing I made is totally free. Use it in any way you want. BUT since it will be updated alot in the near future, I would appreciate it if webmasters just linked to the fasmenv.zip instead of putting a copy on their site, so old flawed version won't be floating around the internet, and the latest version is always available to every one. I will not change the address or name so links won't be broken. Bitdog |
|||
12 Feb 2004, 05:12 |
|
Ralph 12 Feb 2004, 07:27
I got most of a forth based OS. I don't want to release it, but I don't mind giving you some words that may be useful to others like maybe ascii<->bin (>num and .), keyboard input and display output (accept/key and type/emit) and pretty much anything else that you want. Also has a simple memory manager that might be worth a glance. It's all 32-bit code. Please private message me if you want anything or I'll probably overlook it. I can zip it up with readme/makefile/etc, just let me know what if anything you want.
|
|||
12 Feb 2004, 07:27 |
|
Bitdog 14 Feb 2004, 02:14
new version out
http://bitdog.home.att.net/files/fasmenv.zip still not complete or debugged, but I ran into some problems. Please don't get me wrong here, I love Fasm, but I have some requests for changes in Fasm: Every thing that's not a reserved word should be an address. (or something like that) Macro's should have local labels as default so local defines aren't required. SHORT, NEAR, FAR should be reserved words for JMP or CALL distance also. Align macro should be included in Fasm as a reserved word, which inserts NOPs by default or recieves input align 4 ;inserts NOPs align 16 db 0 ;inserts zeros align 16 ;align at 2,4,8,16,32,64,128,256,1024,or 4096 (NOPs) Code: AFAR2 = 102h ORG 100h ; A.com USE16 START: JMP BYTE WERK AFAR DD 0x12345678 ANUM DB 13,10 WERK: MOV AX,[ANUM] ;fails because ANUM is NOT treated as an address MOV BYTE [START],5 ;this should work HERE: MOV WORD [HERE],0xFFFF ;this should work too Fasm has defined ANUM as a BYTE, but it's an offset address. This stops me from accessing all kinds of stuff in memory. I should be free to get any byte from any where using any label, or #value, or anything that equates to a value to the assembler, no matter where it's used in the code and for what purpose. Above Fasm defined ANUM as a BYTE, but it's the first byte at the address ANUM I want to be able to move AX into the first word=offset of a Dword LABELx too. I'm stoped me from altering one byte of a declaired word in memory. I should be able to overwrite old code with data using pre existing labels. In Nasm every thing that's not a reserved word is an address and the reason is, is because that's the way the CPU see's it & it works out better that way for the programmer. Nasm will always be more powerfull than Fasm until the typing is removed. It is simpler/easier on the assembler to treat every thing that equates to a number as a number and allow address to be refered to by numbers. Which is what they are. Any way, if 5 pages of pre DEFINES, prototypes, extern declairations, and M$ bloat ware (remember this name) gibberish isn't needed, an assembler shouldn't demand it. The perfect mariage between a programmer and his computer is: The computer does the remembering (in referance files), leaving the programmer free to concentrate on the goal. The totally wrong way is: The computer dumps out massive junk that the programmer has to remember, which renders him useless. The reality is: A computer can dump out more junk than a person can ever remember, and almost none of it is needed. Code: MOV BYTE [START],AL MOV AX,[START] ; both of these should work MOV WORD [AFAR],AX MOV WORD [AFAR+1],AX MOV WORD [AFAR+2],AX MOV WORD [AFAR2],AX ; these should work These would work if everything was an address. I use that kind of stuff all the time in Nasm & it's real handy. Every thing is an address in assembled code to the CPU, and a debugger. WYSIWYG = What You See Is What You Get, is important. When learning from a debugger, one should be able to write code in the same style as the debuggers output. MOV WORD [100h],AX ;overwrite word at [DS:100h] MOV BYTE [100h],AL ;overwrite byte at [DS:100h] ------------------------------------------------------- Macro problems: local label if I make a macro in my program and only use it once, I don't need to make the macro, I'll just write the code in the program. If a macro has a non local label, it can only be used once. If I use it twice, I have to define any labels in it as local because labels in macro's in Fasm are not local by default. Nasm has all macro labels as locals as default, which is as it should be. ------------------------------------------------------- Jmp problems: JMP SHORT LABELx ; fails JMP BYTE LABELx ; is correct, but it's confusing in that LABELx isn't a declaired byte, I use an SHORT EQU BYTE ;to solve the problem but it would be better if they were reserved words included in Fasm ? Most assemblers use the SHORT, NEAR, FAR key words. I don't mean, take the BYTE, WORD, DWORD out. Just add the others? --------------------------------------------------------- Please correct me if I'm incorrect about anything. I didn't know how to phraze this diplomaticly, so I blurted, forgive me plz. Bitdog |
|||
14 Feb 2004, 02:14 |
|
comrade 14 Feb 2004, 02:54
ANUM is a byte label, but AX is a word. You need to use "word" cast.
|
|||
14 Feb 2004, 02:54 |
|
JohnFound 14 Feb 2004, 08:55
Hi.
Bitdog wrote:
"near" and "far" are reserver words (of course). About "short" - FASM produces optimizations of jumps - it compiles the shortest possible form. So in 99% of cases you simply don't need to write anything. In the remaining 1% you may force FASM to produce another form of the instruction using byte, word and dword prefixes to the label. If you are used to use "short" etc. you may define them as equates: "short equ byte" for example. But if you convert NASM sources, simply remove any "short" prefix and everything should be compiled best possible way. Quote: Align macro should be included in Fasm as a reserved word, Align directive is included in FASM since version 1.50 Quote: Fasm has defined ANUM as a BYTE, but it's an offset address. You ARE free to accessing all kind of stuff in memory. Come on, it is not MASM Simply FASM have typed labels. Every label or numeric IS an address, simply they have types assigned to them. Also there are untyped addresses. If you want to access the address not in it's native type, you simply have to write what type you want to use: Code: org $100 mov al, [MyData+5] ; does not need type casting. mov ax, word [MyData+7] ; need type identifier, because MyData is byte label. mov eax, dword [$100] ; numerics are untyped so you need type identifier. MyData db 'It is test string' ; label type byte. Quote:
Above is absolutely valid code for FASM. Quote: Macro problems: Hm, I think you missunderstood something. There are two completly different kinds of "local" labels in FASM. (Hm, maybe we need another therm for one of them) They havn't nothing common. 1. Macro local labels - that are labels that will be automatically generated as unique on every expanding of the macro - defined via "local" directive. 2. "program" local labels - This are labels that begins with '.' char. They are local relatively to the last global label - not begining with '.' Regards. |
|||
14 Feb 2004, 08:55 |
|
Bitdog 14 Feb 2004, 17:43
Hello, & thanks for the input.
I didn't know that Fasm optimised a jump to a SHORT/BYTE size so SHORT/BYTE isn't needed. Nasm programmed me to include size, but new Nasm has some optimize in it and that messed me up too. The align 16 failed with my Fasm 1.49 then I noticed the new Fasm 1.51 didn't report an error when I failed to include the align macro, but I thought it was a bug and didn't align to the right offset adr. But now I know it does & I'll check it out better. Oh well...... I'm learning...... Ok, I might have a ligitimate complaint on this one...... Code: org $100 mov al, [MyData+5] ; does not need type casting. mov ax, word [MyData+7] ; need type identifier, because MyData is byte label. mov eax, dword [$100] ; numerics are untyped so you need type identifier. MyData db 'It is test string' ; label type byte. The assembler should know it's size by the size of the Register, Nasm isn't as multipass as Fasm, so Nasm requires MOV WORD [aLABEL],AX but shouldn't fasm find something in the line that indicates size and attach sizeof to [adr of aLABEL] & move the word into it. BUT, I don't know about any conflicts with other things or would it limit ones ability to freely program memory address ? I'll learn to conform to Fasm eventually. ANUM is a byte label, but AX is a word. You need to use "word" cast. Word cast, Thanks, I'll look up the term & it's meaning/usage in detail. I got a little carried away with my complaing, and didn't double check it first....OOPs Code: MOV WORD [100h],AX ;overwrite word at [DS:100h] MOV BYTE [100h],AL ;overwrite byte at [DS:100h] Ok, local labels in a Fasm macro subject. (not refering to .LABEL (=other type of locals)) So Fasm requires that they be defined in the macro, my request is that they are defined local by default so you don't have to define them every time, and if you want a nonlocal label, you define it as nonlocal. (er something.) The reason being, I never use a nonlocal label in a macro, but I do have macros that have jumps to a NonLocalLabel Why would any one want to use a non local label in a macro ? You could only use the macro once. and so there is no point in haveing a macro, just write the code. But, I'll go check the FASM.TXT help for ver 1.51 and see if I can get some new info. I've been reading the old 1.49 fasm.txt help. OOPs... So in surmization, thanks JohnFound & Comrade your both a big help to me. Bitdog PS, is there anything usefull to anyone in my http://bitdog.home.att.net/files/fasmenv.zip ???? Where did I go wrong???? Suggestions are welcome, I know its fraut with errors, that I find and fix daily, but I was hoping for an overview to help aim my direction..... |
|||
14 Feb 2004, 17:43 |
|
vid 14 Feb 2004, 17:46
to local labels.
directive "local" in preprocessing directive and just extends label names by ? and some generated numeric constant. Code: macro pushstr str { local string, behind push string jump behind string db str behind: } pushstr 'aaaaa' becomes after preprocessing something like Code: push string?12341234 jump behind?56785678 string?12341234 db 'aaaaa' behind?56785678: in assembly time, labels whose first char is '.' are appended to last global label so Code: global: .local: is same as Code: global: global.local: and labels absolutely shouldnt be local be local by default. You often generate global labels (which is same as numeric constant, as you demanded) with macro, like Code: macro enum prefix,initval,[name] { local ..counter ..counter = initval forward prefix_#name = ..counter ..counter = ..counter + 1 } |
|||
14 Feb 2004, 17:46 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.