Hello!
I'm debugging my code on x86 and the problem tracks down to AND instruction
sometimes does not clear ZF flag if the result is not zero.
Here is the problematic piece of code:
0257A9F9 mov edx,dword ptr [ecx+18h]
0257A9FC and edx,80000h
0257AA02 int 3
0257AA03 je 0257AA2A
I added a b...
Hey guys, I'm really new to assembly and I'm trying to create a simple program. For this I need to generate a random number.
Anybody know how I can do this with the FASM compiler?
Thanks,
Sam
...
In my assembly language class, our first assignment was to write a program to print out a simple dollar-terminated string in DOS. It looked something like this:
BITS 32
global _main
section .data
msg db "Hello, world!", 13, 10, ’$’
section .text
_main:
mov ah, 9
mov edx, msg
int 21h
ret
As I understand it, the $ sign serves...
Learning assembly has so far been pretty hard, I have read every tutorial I could find and I'm still having trouble getting some of the basics down. Does anyone out there want to mentor me and answer a few questions every now and then?
Thanks to anyone considering.
...
Often one of the main reasons given for learning C is that it brings you closer to programming at a low level which gives you insights into how things really work in higher level languages.
I've been programming in various Assembly flavors for awhile and you can't get any lower level than what I have been coding in and I have no illusio...
I have loaded an idt table with 256 entries, all pointing to similar handlers:
for exceptions 8 and 10-14, push the exception number (these exceptions push an error code automatically)
for the others, push a "dummy" error code and the exception number;
then jump to a common handler
So when the common handler enters, the stack is prop...
GCC compiles (using gcc --omit-frame-pointer -s):
int the_answer() { return 42; }
into
.Text
.globl _the_answer
_the_answer:
subl $12, %esp
movl $42, %eax
addl $12, %esp
ret
.subsections_via_symbols
What is the '$12' constant doing here, and what is the '%esp' register?...
I just translated this program,
#include <stdio.h>
int dam[1000][1000];
int main (int argc, const char * argv[]) {
// insert code here...
printf("Hello, World!\n");
return 0;
}
to assembly using gcc producing,
.cstring
LC0:
.ascii "Hello, World!\0"
.text
.globl _main
_main:
pushl %ebp
movl %esp, %eb...
diff fails as the assembly listing is filled with slightly different labels.
...
I wrote an answer yesterday to this:
http://stackoverflow.com/questions/192479/whats-the-coolest-hack-youve-seen-or-done
and I was trying really hard to remember my 6502 assembly, and I couldn't for the life of me remember how to branch if less than...
:1
lda $C010
cmp #$80
bcc :1 ; branch if less than? I forget how to do that....
Can someone please explain what the following x86 assembler instruction does?
call dword ptr ds:[00923030h]
It's an indirect call I suspect but exactly how does it compute the address to call?
Thanks
Marek
...
This is my first post on this site. I am taking an X86 assembly class and I am having a bit of trouble with my second project. The project is very simple. The program needs to take in a simple string from the user and display it back. I have gotten the program to take input from the user but I can't seem to store it. Here is what I have ...
So I am being taught assembly and we have an assignment which is to find the time difference between reading from memory and reading from cache. We have to do this by creating 2 loops and timing them. (one reads from main memory and the other from cache). The thing is, I don't know and can't find anything that tells me how to read from e...
I am writing an assignment in MASM32 Assembly and I almost completed it but I have 2 questions I can't seem to answer. First, when I compile I get the message:
INVOKE requires prototype for
procedure
&
invalid instruction operands
the first is due to this piece of code:
.data?
Freq DWORD ?
Time1 DWORD ?
Time2 DWORD...
I have an assignment from my comp. system org. subject and unfortunately I'm kind of new when it comes to assembly language. I'm supposed to write a program that displays the numbers 0,2,4,6,8,10 respectively. How would I go about this?
Maybe this'll answer my question: (Reactions please)
.model small
.stack 100H
.data
.code
call proc...
I'm trying to make a loop in masm32 running under Windows Vista, however I did it this way and even though it actually finishes the loop, it crashes and I see no obvious reason why...any ideas?
.386
.model flat, stdcall
option casemap :none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include...
Inspired by the question Difference in initalizing and zeroing an array in c/c++ ?, I decided to actually examine the assembly of, in my case, an optimized release build for Windows Mobile Professional (ARM processor, from the Microsoft Optimizing Compiler). What I found was somewhat surprising, and I wonder if someone can shed some ligh...
I'm trying to find a way to perform an indirect shift-left/right operation without actually using the variable shift op or any branches.
The particular PowerPC processor I'm working on has the quirk that a shift-by-constant-immediate, like
int ShiftByConstant( int x ) { return x << 3 ; }
is fast, single-op, and superscalar, whereas...
Hi, I'm learning SPARC assembly and I have to create a script that extracts a field from a register. The script accepts 3 values, initial number, field start position, field length.
It can't use any shift functions, but it can use multiply and divide.
I'm currently suffering from a respiratory virus, and am subsequently on a significant ...
Hi overflowers
I'm currently developing an x86 disassembler, and I started disassembling a win32 PE file. Most of the disassembled code looks good, however there are some occurences of the illegal 0xff /7 opcode (/7 means reg=111, 0xff is the opcode group inc/dec/call/callf/jmp/jmpf/push/illegal with operand r/m 16/32). The first guess ...