Greetings, SO.
I have some code which I've made attempts at compiling using gcc, but my attempts have been thwarted. Could anyone more versed assist me with the subject, perhaps there's something I'm missing.
I'm compiling this code on Linux Kitchen 2.6.28-15-generic #49-Ubuntu SMP Tue Aug 18 19:25:34 UTC 2009 x86_64 GNU/Linux.
int
...
I decided to learn the Assembly language. The main reason to do so resides in being able to understand deassembled code and maybe being able to write more efficient parts of code(for example, through c++), doing somethings like code caves, etc. I saw there are a zillion different flavors of assembly, so, for the purposes I mention, how s...
When someone codes something for example in MASM, what is it called? Coding in assembly? What is it called when you look at the opcodes of some program debug part or when you dissassemble? What are their differences? I'm a bit confused.
...
Hello!
I am just testing and trying to learn how assembler works with C. So i was browsing around some tutorials and i found this:
__asm
{
mov ax,0B800h //startaddress for the screen memory (in textmode)
mov es,ax //add the startaddress to es
xor di,di //reset di (start at the beginnin...
how to sort number in descending order by using easy68k?
...
Hello,
My program asks the user if the number he/she is thinking of is in a list. The user inputs a y or an n. How can I check if a user has entered y or n in assembly? Is it sufficient to put the user input into a register and branch if equal to 121 (decimal ASCII code for 'y') or branch if the value is equal to 110 (decimal ASCII code...
Hi,
The following GCC inline asm is taken from LuaJit's coco library. Can someone provide a line by line explanation of what it does?
static inline void coco_switch(coco_ctx from, coco_ctx to)
{
__asm__ __volatile__ (
"movl $1f, (%0)\n\t"
"movl %%esp, 4(%0)\n\t"
"movl %%ebp, 8(%0)\n\t"
"movl 8(%1), %%ebp\n\t"
"...
Hi,
Here's my previous question about switching C callstacks. However, C++ uses a different calling convention (thiscall) and may require some different asm code. Can someone explain the differences and point to or supply some code snippets that switch C++ callstacks (preferably in GCC inline asm)?
Thanks,
James
...
Hello
I want to learn some assembly .
I installed nasm on my x86 windows machine .
But I need recommendation for some IDE that i will be able to compile with my installed nasm through it , and of course that it will color the syntax . (maybe even debugger ) .
I saw that notepad++ can color syntax but it not really Enough.
Thanks f...
I googled and I see a suprising amount of flippant responses basically laughing at the asker for asking such a question.
Microchip provides some source code for free (I don't want to post it here in case that's a no-no. Basically, google AN937, click the first link and there's a link for "source code" and its a zipped file). Its in AS...
Banging my head today ;)
Over here I asked about translating an ASM file to C, and from the responses it looked like there was no reasonable way to do it. Fine. So one of the responses suggested I just make use of the functions as-is and be done with it. Sounds good.
But how?
Holy crap I've tried everything I can think of! I'm usi...
Are there any good Itanium assembly language tutorials?
...
I feel extremely comfortable dealing with 32-bit PowerPC assembly code, but I am completely lost when trying to make sense of x86 code. Do any of the other common architectures like ARM, MIPS, Sparc etc have an easier than x86 instruction set?
...
Hi. My compiler won't work with an assembly file I have and my other compiler that will won't work with the c files I have. I don't understand assembly. I need to move this over but I'm not getting anywhere fast. Is there someone out there that can help? I can't believe there isn't a translator available. Here is the beginning of the...
I have been dealing with Nasm on a linux environment for some time and this function worked great... but now I am switching to a windows environment and I want to use Masm (with VS2008) I cant seem to get this to work...
void outportb (unsigned short _port, unsigned short _data)
{
__asm__ __volatile__ ("outb %1, %0" : : "dN" (_port), ...
I need to create an assembly function that adds two positive numbers together, called by a C program.
The C program would look like this:
#include <stdio.h>
int main(void){
int a = 0;
int b = 0;
int c = 0;
printf( "Enter first number: " );
scanf( "%d", &a );
printf( "Enter second number: " );
scanf( "%d", &b );
sum();
printf( "Answer ...
I want to call the Sleep function on ASM. So I wrote the following:
push 5000
call Sleep
Although everything went fine, I had the idea that everytime I pushed a value on the stack, I should also pop it(otherwise it'd get all cluttered later in the program?). Should I pop it? How should I do it?
...
Just to experiment assembly in C++, I tried the following, which is causing the application to crash:
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
__asm {
push 5000
call Sleep
}
...
}
the ass...
; int __stdcall wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd)
_wWinMain@16 proc near
var_4= dword ptr -4
hInstance= dword ptr 4
hPrevInstance= dword ptr 8
lpCmdLine= dword ptr 0Ch
nShowCmd= dword ptr 10h
From what I can see, the last 4 variables are the parameters passed to the WinMain func...
Using this example coming from wikipedia, in which DrawSquare() calls DrawLine(),
could anyone explain me what the ebp and esp are in this context?
From what I see, I'd say the stack pointer points always to the top of the stack, and the base pointer to the beggining of the the current function? Or what?
Thanks
edit: I mean this in...