>>49
you're making it overly complicated, when i read asm, i tend to look at it like c code, unless its highly optimized asm.
>1. No variables. Actually, you have to make your own. Either memory locations or registers can be your variables. Preferably registers, but you only have a couple of those. So, you have to decide which memory locations are going to serve as your variables, or decide which registers you can use.
True, but you can easily define data if you use an assember(of course unless you write in machine code and generate your executable files from scratch, then you can define your memory layout). Then you have the system's mem allocing functions, you can still define structures in your assembler, even if they are nothing more than offsets ( like .StructMember would be nothing more than +C or whatever offset it was, but it makes writing it easier)
>2. No IF statements. You have compare instructions. And then depending on ther result of that comparison, you can jump(branch) to another address or carry on.
Conditional jumps(JCC) ARE if's. If you want if(){}else{} behavior, the macro assembler(masm/ml) actually have such directives, they would translate to the appropriate jumps. MASM also has loops. They are provided to speed up coding, but any masm-knowning person would know exactly what code they would generate. again, nobody is forcing you to use the provided macros, they are only there if you want more rapid development.
>3. No PRINT/printf statement. You have to make your own using operating system/DOS/BIOS routines or writing to screen memory yourself.
There are OS api's for this usually, and if not you can write your own routines or use msvcrt.dll 's printf or whatever, if none of that suits you, there are some ready made libs made by some people just for linking in masm, oh and it doesnt really matter what the libs where coded in, as you can link obj files regardless of compiler. Assemble(generate code)&Link(generate executable)
>4. No expressions. Everything boils down to a sequence of instructions.
Already discussed, if you want expressions, there are macros, if not, use instructions.
>5. Direct access to hardware. Ports/IRQs/memory locations, it's all there. Unless your program is running under protected mode.
Unless you're coding something for a bootloader or DOS, you are running in protected mode, oh and even in protected mode you can access them if you have the right IOPL priviledges, in Win you can make a driver grant them to you. as for 'memory locations' , you can always access any memory inside your process, if you want other processes memory, then you'll have to use the APIs give to you or have a ring0 driver supply writing/reading to them.
>6. No data types. You have signed or unsigned bytes, words, doublewords, quadwords, but they're all really bytes.
Yes, if you say that a variable is a signed dword for example, then you'll only use signed operations/jumps on it,thus provind that its signed, you'll only access it as a dword, again providing tis a signed dword.
>7. Flag register. Generally, after a math operation, the bits in the flag register are set to some values based on what just happened. You can branch depending on how various bits are set in it, like the carry bit, etc. Google for information on carry and overflow bits.
True
Again, you can go as low level as you want with asm. Oh you can do that in C almost all the time, except for some more specific stuff. Or you can go quite highlevel in asm as well, some assemblers provide you with macros and directives that allow you near high-level programming experience, there are even templates for building classes in asm. It's quite simple actually. All that you can do in a high level language, you can do in asm, it's a matter of how you organize your data and if you understand how compilers actually generate the code for what you write.