flat assembler
Message board for the users of flat assembler.
![]() Goto page 1, 2 Next |
Author |
|
uart777 27 Aug 2012, 07:53
Hi everyone. I have recently created a website for FASM programmers:
http://www.sungod777.zxq.net SITE FEATURES * Easiest ASM code imaginable. Minimal example in ONLY 4 lines: include 'z.inc' | code | say 'Hello' | exit * Includes 200+ files: 400+ procedures/"command"s, 30+ examples, 20+ raster bitmap fonts with viewer and royalty FREE graphics, icons and cursors * Unique, crystal-clear programming style that is unlike anything the ASM community has ever seen before * Logical design with the simpliest names: draw.pixel, load.image, draw.image, save.file, load.font, draw.text, save.exe, etc * Supports countless HL sequences - BYTE a=1, b, c='Z' | .loop [i]=0 to [n] | get [p]=allocate 4*KB | etc - that are customizable by experienced FASM programmers * TEXT: 40+ useful text functions to copy, compare, attach, search, convert, insert, remove/replace next/all, etc * PRINT: A custom "print" formatted text that supports binary * ARRAY: Create dynamic array, index, insert, remove, versatile sort/arrange numbers, text and structures by member value, encrypt/decrypt, randomize, etc. It's extremely rare to find code like this written in ASM! * FILE: Open, read/write BITs, numbers, text, search directories, get attributes, etc * DRAW: Set VGA. Draw pixels, lines, boxes, images. Manual software rendering to [vga]. DirectDraw is only used to get a [vga] pointer. Z77 does its own clipping, color conversions, transparency, alpha, light/color adjustments and other effects * FONT: Load bitmap font, draw text, caption, etc * TILEMAP: Load and display tilemap from easy .txt script format * EXE: Easy template for writing .EXE files * MACHINE: Write raw machine code instructions directly to memory at runtime * ... and MUCH more! Any comments would be appreciated. |
|||
![]() |
|
revolution 27 Aug 2012, 07:59
Perhaps this link is on order.
![]() |
|||
![]() |
|
ronware 27 Aug 2012, 09:18
![]() |
|||
![]() |
|
randall 27 Aug 2012, 09:46
Nice work.
|
|||
![]() |
|
revolution 27 Aug 2012, 10:02
uart777 wrote: revolution: None of that applies to my site, ... uart777 wrote: ... but thanks for sharing the opinions of one person who knows nothing about design. |
|||
![]() |
|
Tomasz Grysztar 27 Aug 2012, 10:45
uart777 wrote: As an artist, my site is intended for game/graphics programmers. Sarcasm aside, I think what revolution had in mind was that this website could probably be viewed in a browser from '90s and look not much different. Which may in fact be seen as some kind of advantage, but still would not excuse omitting the list tags, because HTML had list tags from the very beginning... |
|||
![]() |
|
hopcode 27 Aug 2012, 12:15
Hi uart
uart777 wrote: ...Any comments would be appreciated. https://www.virustotal.com/file/a00685b67af0ae16eae75bd1103a2100881a86ebd4ef28fdd2d867f4cf351451/analysis/1346069290/ sorry, cannot comment suspicious files. Cheers, _________________ ⠓⠕⠏⠉⠕⠙⠑ |
|||
![]() |
|
uart777 28 Aug 2012, 01:50
Hi, Tomasz. I meant to say that my code is intended for artistic/graphics programmers who I can relate with and my teachings would be helpful to them. My site would be popular if it were advertised on a game/graphics programming site like gamedev where there are mostly people like me who make games by themselves.
In general, artists ARE unique and non-conformist. I prefer to think for myself and not be a mindless follower who does what they are told. "unusual" - Yes, it certainly is, but I think this difference is a good thing considering that I'm using my ASM library to make small games in under 1,000 lines (Video Poker example is only about 600 lines). Jimi Hendrix was "unusual" and he was initially rejected by society for being different, but he was loved and praised by musicians who understand what he was doing and by people who appreciate music. Uniqueness is not a bad thing in itself. Some things like gold are valuable because of their rarity. If anyone has comments on my ASM CODE, I'd love to hear them. Please be specific. Vague remarks like "your code sucks" are meaningless to me. Please explain why and show me better. I'd love to see your improvement. Thanks ![]() |
|||
![]() |
|
randall 28 Aug 2012, 08:14
I don't get you guys. uart777 is coming with nice asm code and you are commenting his website/html code.
|
|||
![]() |
|
hopcode 28 Aug 2012, 13:56
randall wrote: I don't get you guys. uart777 is coming with nice asm code and you are commenting his website/html code. because you guys, you have welcomed him in a too much usual way; and you did it by setting aside sarcasm and tagging him in a normal list, where our Jimi, you know, was initially rejected by society for being different. Also, please,dont forget that vague eventual remarks like "your code sucks" are meaningless to our Jimi. relating to me, i can say the sungo-macro is not that bad. i though it some years ago something similiar, alike for the vissual bassic language. then i abandoned it because i was not so popular on forum like today. but today the problem is different, and i cannot resist such utterances like "Some things like gold are valuable because of their rarity." Also, good work, keep it up, uart with or without viral binary, keep it up !! btw: from the link http://catb.org/esr/html-hell.html "Hell is other websmiths." may be misleading. some not definitive explanations of what J.P. Sartre meant by "Hell is the Others" http://www.answerbag.com/q_view/43593 is not that simple. Sartre there was triying to explain existentialism. for this reason he avoided to say somethin like "Hell is the other" because "the other" would have been an abstraction on what he was triying to explain (we call that mental play "tautology"). and doing so, the explanation would result abstract (=useless) already for begginers of his thinking. he used the plural to "realize" concretely, hic and nunc, the principles of existentialism or rather, the phenomenology related to his concept of existentialism. hope it helps, ![]() Cheers, _________________ ⠓⠕⠏⠉⠕⠙⠑ |
|||
![]() |
|
JohnFound 28 Aug 2012, 14:19
Personally I don't like such extended use of macros with HLL-like syntax. Assembler is assembler, you know. If I needed such an ersatz-HLL I whould use Pascal instead.
The power of FASM macro language does not necessary means you have to use it all the time. Better write some assembly. |
|||
![]() |
|
Dex4u 28 Aug 2012, 19:09
|
|||
![]() |
|
AsmGuru62 28 Aug 2012, 19:23
I agree with JohnFound -- all macros will blow out the code and we end up with the same .NET-like bloat.
Also, I want to see where the branches go for branch prediction optimization and using HLL macros - I doubt I can do that - it is not obvious. |
|||
![]() |
|
uart777 28 Aug 2012, 22:12
JohnFound and AsmGuru62: I understand what you're saying. My library started in 100% traditional ASM in MASM in 97' with only a handful of files: MEMORY, TEXT, FILE, DRAW. Back then, I didn't use any HL features (not even "proc") because I wanted to learn REAL ASM. I recommend that all beginners start this way. But once you know ASM well, it seems pointless to keep re-writing code. I wrote so-called "real ASM" for over a decade, it wasn't until recently (2010') that I started using HL macros and I have noticed a dramatic increase in production.
By "HL features", what specifically are you referring to? When you think about it, just referring a label (address by name) is a HL feature. Programmers who say they are against HL features use them extensively in their code without realizing it. For example, "proc" is the highest level macro that I know of and nearly all ASM programmers use it. "proc" does all kinds of HL things: It produces prologue/epilogue code, saves/restores registers, creates temporary names for parameters, locals, allows you to specify types/sizes, etc. ".if" just equates to cmp-jxx, there is no overhead, there's nothing mysterious going on behind the scenes, and it generates the same consistent code everytime unlike "proc". I wonder have many complete retail-quality applications they have created in real ASM. Any idiot can learn ASM from a technical perspective, but it takes real time, practice and dedication to make a complete program. Bottom line: Real programmers make programs. randall: Thanks. I hope my code helps people to make real games and programs in ASM. |
|||
![]() |
|
JohnFound 29 Aug 2012, 05:36
It is very long talk "How many HL is enough?" For me, procedures are not "HL feature". They are "structured programming" feature that help making code more readable. Data definitions are another field where IMO using complex macros is acceptable as long as it improves the readability of the code.
On the other hand, the data processing must be provided by clear assembly instructions, one per line of code, without hiding branches and jumps. Here is a random sample of what I mean is good use of HL features. Note, how "stdcall" macro mimics the normal instruction with arguments and operands. Code: .check_lf: mov [.expect_next], 0 cmp [esi], al jne .next_line inc esi dec ecx .next_line: sub edx, ebx dec edx jz .end_of_request ; empty line ends the headers of the HTTP request. stdcall StrExtract, ebx, 0, edx stdcall StrCat, [.hCurrent], eax stdcall StrDel, eax stdcall AddArrayItems, [.pHeaders], 1 mov [.pHeaders], edx |
|||
![]() |
|
AsmGuru62 29 Aug 2012, 17:11
@uart777: I see your point.
Productivity is very important in ASM, but it may be achieved by other means, like code re-use based on modules. Say, you need a module dealing with strings - we'll call it TString module. Now, we'll create two files: TString.Inc TString.Asm 1st file will declare structures and constants for the string object: Code: virtual at 0 TString: .Buffer PCHARS ? .Length UINT32 ? .Room UINT32 ? .size = $ end virtual 2nd file will have procedures for dealing with the data: Code: align 32 TString_Append: ; ------------------------------------------------ ; EBX = pointer to TString structure ; ... more parameters (as needed for a method) ... ; ------------------------------------------------ ; ; code to concatenate strings ; ret align 32 TString_Insert: ; ------------------------------------------------ ; EBX = pointer to TString structure ; ... more parameters (as needed for a method) ... ; ------------------------------------------------ ; ; code to insert text into string ; ret align 32 TString_Remove: ; ------------------------------------------------ ; EBX = pointer to TString structure ; ... more parameters (as needed for a method) ... ; ------------------------------------------------ ; ; code to remove text from string ; ret align 32 TString_Find: ; ------------------------------------------------ ; EBX = pointer to TString structure ; ... more parameters (as needed for a method) ... ; ------------------------------------------------ ; ; code to find sub-strings ; ret ... and so on ... Notice how every method is prefixed with "TString_" -- module name plus underscore. This will make readable code and allow for similarly named methods for other object types, like: "TLinkList_Insert" and "TMemory_Insert". To use this code in some program -- all you need to do is to include these two files into your main FASM file (into proper sections): Code: include 'TString.Inc' ... include 'TString.Asm' Another thing with macros is that the code is hidden. Imagine you have a loop and it takes a few lines of macros, but in reality the loop does not fit into CPU instruction cache and every iteration causes a delay. These cases are not obvious. |
|||
![]() |
|
uart777 30 Aug 2012, 02:11
Please don't get me wrong, I'm not trying to change programmers who are satisfied with the way they write code. All power to you. My only intention is to provide easy solutions to game/graphics programmers who are struggling with ASM and are looking for alternatives because they want to be able to concentrate on the art/design aspects.
If you have any questions regarding Z77, please visit my message board: http://sungod.boardhost.com/ COMPARISON: C/C++ VS Z77 Code: *** STRUCTURES *** // C... typedef struct { unsigned char a, r, g, b; } RGB; typedef struct { void *p; int x, y, w, h, bpp; int key, alpha; } IMAGE; ; Z77... TYPE RGB = BYTE a, r, g, b STRUCTURE IMAGE VOID p NUMBER x, y, w, h, bpp=32 COLOR key, alpha ENDS *** MEMORY ALLOCATION *** // C... if (!(p=(char*)malloc(16777216))) { goto r; } // ... r: ; Z77... try [p]=allocate 16*MB ; ... r: *** TEXT/STRING *** // C... char *a="abc", *b="xyz"; if (strcmp(a, b)==0) { // ... } ; Z77... TEXT a='abc', b='xyz' .if.text.equal a, b ; ... .end *** FILE I/O *** // C... FILE *fp; char *p; // ... fp=fopen(filename, "rb"); p=(char*)malloc(256); fread(p, 1, 256, fp); fclose(fp); ; Z77... VOID p ; ... open filename get [p]=allocate 256 read [p], 256 close ; or just... get [p]=load.file filename |
|||
![]() |
|
AsmGuru62 30 Aug 2012, 02:33
Your code is nice.
Probably, just not my thing. |
|||
![]() |
|
Dex4u 30 Aug 2012, 15:15
I am trying to do something similar for bare metal programming, like on the raspberry pi, in the forum of a basic like language crossed with a arduino like language.
Example to turn a led on and off on the pi in dexbasic Code: include 'DexBasic\DexBasic.inc' pinMode GPIO16, OUTPUT ; set GPIO 16 as output LetsLoop: digitalWrite GPIO16, HIGH ; set LED on delayMicroseconds 1000000 ; waits 1 second digitalWrite GPIO16, LOW ; set LED off delayMicroseconds 1000000 goto LetsLoop align 4 ProgramSize: with a arduino using arduino ide Code: int ledPin = 13; // LED connected to digital pin 13 void setup() { pinMode(ledPin, OUTPUT); // sets the digital pin as output } void loop() { digitalWrite(ledPin, HIGH); // sets the LED on delay(1000); // waits for a second digitalWrite(ledPin, LOW); // sets the LED off delay(1000); // waits for a second } |
|||
![]() |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.