assembly

How to read/use mouse from a boot loader?

I want to use mouse from a boot loader, but the int33h is not working, (DOS interrupt, and there is no DOS booting),so can you help me, how can I read the mouse position, status, etc without using int33h? Thanks ...

Assembly language : try to understand a small function

Hi, for my work, I need to reverse what this portion of code (ARM9) is doing. Im a java developper & I really don't understand this portion of code related to a single function. Of course I'm asking help because the original code is not more available. Anyone can help me to know what this code is doing with a smal algorithm in any high...

Why do segments begin on paragraph boundaries?

In real mode segmented memory model, a segment always begins on a paragraph boundary. A paragraph is 16 bytes in size so the segment address is always divisible by 16. What is the reason/benefit of having segments on paragraph boundaries? ...

How do I write text in different colours in DOS?

How do I write text in DOS, setting each character to a different colour? ...

Assembly - 32 bit vs 64 bit...?

Hey guys... I'm really wanting to learn assembly. I'm pretty good at c/c++, but want a better understanding of what's going on at a lower level. I realize that asembly related questions have been asked before, but I'm just looking for some direction that's particular to my situation: I'm running windows 7, and am confused about how I ...

Assembly - .data, .code, and registers...?

Hi everyone, So this morning I posted a confused question about assembly and I received some great genuine help, which I really appreciate. And now I'm starting to get into assembly and am beginning to understand how it works. Things I feel I understand alright include the stack, interrupts, binary/hex, and in general what most of the...

If the call stack gets corrupted, would that crash only the current thread, or my entire application?

I'm a noob when it comes to threading in C#, and I'm not sure if each thread is supposed to have its own call stack? Basically, if I get a "Run-Time Check Failure #0 - The value of ESP was not properly " , would that crash only the thread in which it occured, or the entire program? ...

Why is my masm32 program crashing whenever I try using interrupts?

Here's the code: .386 ;target for maximum compatibility .model small,stdcall ;model .code main: int 20h END main Result: http://img705.imageshack.us/img705/3738/resultom.png "test.exe has stopped working" - always right when it reaches the interrupt. This is the interrupt I'm trying to use. It should simply exit the ...

GCC generated assembly equivalent to continue statement in C

When a continue statement is used inside a loop in C code, GCC creates a new label with a nop instruction right before the end of the loop block and jumps to it, rather than jump to the end of the loop block itself. For instance, the following C code for (i=0; i<10; i++) { puts("blah\n"); if (i < 10) continue; puts("This sho...

difference in jump statements in assembly programming

how do you decide when do you use which jump statement...statements such as JG JNLE JNC can do the same job how do u diffrentiate them? ...

getting starting address of a stack in assembly programming

is it possible to get the effective starting address of a stack after completing stack operations like push and pop in assembly programming? ...

Generating Assembly For an x86 Processor

I'm currently working my way through Andrew Appel's Modern Compiler Implementation in Java, and I'm right around the point where I build the low-level intermediate representation. Initially, I had decided to target the JVM and ignore all of the low-level machine stuff, but in the interest of learning things that I don't know much about ...

Query on Stack pointer use in Assembly Language

Hi All, I was ready a article posted on wikipedia on Tail recursion: http://en.wikipedia.org/wiki/Tail_call Now here at the end of the article, the example shows Stack Pointer being used to access the arguments passed to the function call in the assembly pseudo code. Isn't this wrong? I mean the arguments are accessed by the callee by ...

Assembly: Why are we bothering with registers?

I have a basic question about assembly. Why do we bother doing arithmetic operations only on registers if they can work on memory as well? For example both of the following cause (essentially) the same value to be calculated as an answer: Snippet 1 .data var dd 00000400h .code Start: add var,0000000Bh mov ea...

How do I store the value of a register into a memory location pointed to by a pointer ?

I have the following code: void * storage = malloc( 4 ); __asm { //assume the interger 1 is stored in eax mov eax, storage //I've tried *storage as well but apparently it's illegal syntax } /* other code here */ free(storage); However, in the code, when I dereference the storage pointer ( as in *(int *)storage ), I do not ge...

addressing in assembler

hi, there is something i can't digest. I'm learning some assembler and right now i'm at chapter with addressing. I understand the concept of brackets for dereferencing, but somehow when I see the usage of it I just can't soak up the point of it. To be a little bit more exact here is where my confusion started: mov al, [L1] ok here I s...

How is thread synchronization implemented, at the assembly language level?

While I'm familiar with concurrent programming concepts such as mutexes and semaphores, I have never understood how they are implemented at the assembly language level. I imagine there being a set of memory "flags" saying: lock A is held by thread 1 lock B is held by thread 3 lock C is not held by any thread etc But how is access to...

Creating (and accessing) an array in MIPS

I'm trying to create an array in MIPS Assembly, and then add all the elements together. However, when I try to assemble the following, it says Error in read_array line 1 position 7: ".word" directive cannot appear in text segment Assemble: operation completed with errors. Here's my assembly: list: .word 3, 2, 1, 0, 1, 2 li $t0...

count leading zero in single cycle datapath

As you all might know that the MIPS instruction set supports clz (count leading zero) as follows: clz $t0,$t1 count leading zeros t0 = # of leading zeros in t1 I am writing a single cycle datapath in verilog and was just wondering what the ALU needs to support in order for me to do this... any ideas?? ...

booting from a disk/cd/usb

How can I boot my small console from a disk/cd/usb, with the following configuration: The media that I want to use will be completely raw i.e no filesystem on it. When I insert the media in my system or assume that its already inserted, I want to make it boot my own small OS. The procedure that I want to use is that when my system st...