assembly

Dereferencing a label in x86 assembly

Consider this x86 assembly code: section .data foo: mov ebx, [boo] mov [goo], ebx goo: mov eax, 2 mov eax, 3 ret boo: mov eax, 4 mov eax, 5 ret What exactly is going on here? When I dereference [boo] and mov it to [goo] what exactly am I moving there? Just one command? The ret as well? Follow-up que...

The C++ implicit this, and exactly how it is pushed on the stack.

Hi: down to business: I need to know whether, when a class method in C++ is called, the implicit 'this' pointer is the first argument, or the last. i.e: whether it is pushed onto the stack first or last. In other words, I'm asking whether a class method, being called, is taken by the compiler to be: int foo::bar(foo *const this, int a...

Windows/DOS Assembly - Simple Math

Hi there... I'm currently learning Windows/DOS assembly. I'm just making a small program that adds two base 10 integers, and outputs the solution to standard output. Here is my current code: org 100h MOV al,5 ADD al,3 mov dx,al mov ah,9 int 21h ret I'm confused as to why when that is compiled, I get the error: error: invalid co...

Assembly: MOVing between two memory addresses

I'm trying to learn assermbly (so bear with me) and I'm getting a compile error on this line: mov byte [t_last], [t_cur] The error is error: invalid combination of opcode and operands I suspect that the cause of this error is simply that its not possible for a mov instruction to move between two memory addresses, but half an hour o...

What's the advantage of writing an OS entirely in assembly?

MenuetOS is an example of an OS written entirely in Assembly. Is there any advantage to writing it in Assembly instead of a low-level programming language such as C? ...

building a system in Java and assembly language that runs on "bare metal"

Alright everyone, Let's say i wanted to make a system that used only assembly and java, my question would be, as long as i included all of the jvm folders, classes, jars, etc.. java should still function effectively? i understand there are those things that are compiled platform specifically but this is why i am asking, is it...

understaning assembly code in windbg

I was debugging some code in windbg and I am not able to understand some assembly code 78151113 ff1230401e78 call dword ptr [Somefunction (781e9950)] ds:0023:781e9950=028d1170 Can someone explain what this statement means.I know this is call statement but how it is jumping to 028d1170 address ...

Writing an z80 assembler - Lexing ASM and building a parse tree using composition?

Hi guys, I'm very new to the concept of writing an assembler and even after reading a great deal of material, I'm still having difficulties wrapping my head around a couple of concepts. 1) What is the process to actually break up a source file into tokens? I believe this process is called lexing and I've searched high and low for a real...

Z80 ASM BNF structure... I'm am on the right track?

I'm currently trying to get to grips with BNF and attempting to assemble some Z80 ASM code. Since I'm new to both fields So my question is, Am I even on the right track? I am currently trying to write the format of Z80 ASM as EBNF so that I can then figure out where to go from there to create machine code from the source. At the moment I...

How to enable ARMv6 unaligned access on WinMobile6?

ARMv6 introduce a great feature - unaligned memory access, which make some things in code much more simplier and faster. But microsoft gives API for it only in winCE6. And most PDAs now based on WinMobile6 (which is on CE 5.x). And unaligned access is disabled by default :( I've try to set unaligned flag in CP15 register, but this doesn...

Assembly language tools and references

I used to do assembly language programming a while back, I was foolish enough to want to get back into it. Back in the day, I used to compile asm code with MASM.EXE command line, writing code with no validation in a basic text editor. What are the best tools in use today for writing in assembly? What are some good quick references on...

Analysing a crash in Windows: what does the error message tell us?

A small utility of mine that I made for personal use (written in C++) crashed randomly yesterday (I've used it roughly 100+ hours with no issues so far) and while I don't normally do this, I was feeling a bit adventurous and wanted to try and learn more about the problem. I decided to go into the Event Viewer and see what Windows had log...

assembly file extension, .s79, .s82, s90, .asm, .s, etc...what are their differences?

Just saw assembly extension as titled in a couple of platform, but just wodering how they are different. Thanks. ...

Using NASM as inline assembler compiler in Visual Studio 2008 ?

Hi everybody, I managed to set NASM as compiler for separate .asm files, but I can't find a way to set NASM as compiler for inline assembler (__asm directive). For example, helloWorld db "Hello world !",0 won't compile (assembler syntax error, found "db"). Is there a way to do that ? Or am I bound to use MASM or use another deve...

C++ try/throw/catch => machine code

Mentally, I've always wondered how try/throw/catch looks behind the scenes, when the C++ compiles translates it to assembler. But since I never use it, I never got around to checking it out (some people would say lazy). Is the normal stack used for keeping track of try's, or is a separate per-thread stack kept for this purpose alone? Is...

ARM: what are available executable binary formats and emulators?

For fun, I'm working on a compiler for a small language, and I'm targeting the ARM instruction set first due to its ease. Currently, I'm able to compile the code so I have ARM machine code for the body of each method. At this point I need to start tying a few things together: What format should I persist my machine code to so I can... ...

Why is this code being generated by avr-gcc and how does it work?

This is a snippet of disassembled avr code from a C project I'm working on. I noticed this curious code being generated and I can't understand how it works. I'm assuming it's some sort of ridiculous optimization... Can anyone explain? 92: ticks++; +0000009F: 91900104 LDS R25,0x0104 Load direct from data space +0...

How can I see the assembly code that is generated by a gcc (any flavor) compiler for a C/C++ program?

I am trying to optimize a lot of multiplications and pointer arithmetics and would like to see what the compiler does underneath when I put in optimization flags. --Edit-- How to restrict it to a specific function or a code block? --Edit_2-- How to let gcc generate a less verbose assembly-code? ...

Which syntax and architecture of assembly is most useful to know?

I've always wanted to learn assembly, but there seems to be a jungle of assembly-related information out there that is difficult to interpret. I haven't just been able to google "learn assembly" and get going. First, there are two types of syntax: Intel and AT&T. What's the difference? Why are there still two in use? When would I ne...

Fast little-endian to big-endian conversion in ASM

I have an array of uint-types in C#, After checking if the program is working on a little-endian machine, I want to convert the data to a big-endian type. Because the amount of data can become very large but is always even, I was thinking to consider two uint types as an ulong type, for a better performance and program it in ASM, so I am...