I've recently learned how to use MASM from MSVC++ IDE, and to test whether it works, I would like to run a short program.
However, I don't know any assembly yet (that which I do is useless: ie: even though I know what i+=1; is in C++, I can't do anything without int main()).
So where can I find a simple assembly program akin to the hel...
I have to make a program in Assembly Language for 8086 or 8088 processor. Where a given .txt file will have all its letters (from A to Z, not case sensitive) counted and later shown on screen. The ammount of letters in the file cannot pass the size of a word (16bits or 65535).
in the end i show on screen something like this:
A - 0001...
What exactly do this instruction? I know that it try to align data with a multiple of a especific number but, why would you need to do this? Is there an equivalent instruccion in other assemblers?
...
Hi,
Unless I copied it wrong, the code above was written in the blackboard in a class by a student with the help/corrections of the teacher:
int array[100], sum, i;
void ini() {
for(i = 0; i < 100; i++)
array[i] = i;
}
int main() {
ini();
sum = 0;
for(i = 0; i < 100; i++)
sum += array[i];
}
.pos 0
irmovl Stack, %...
I've created this simple and pointless assembly (Y86) code to see if I understand everything that's happening in the stack when the instructions call, pushl, popl and ret are used.
Like I said, this code is pointless, it's just for testing/learning purposes. Although, all memory addresses were correctly (hopeful) calculated and are not ...
Hi I wanted to write something basic in assembly under windows, I'm using nasm, but I can't get anything working.
How to write and compile hello world without help of c functions on windows?
thx
...
I am trying to debug some win32API's like Createthread which returns a handle.
How to get the return values in windbg?
I did some research and found that return values generally stored in EAx register.
If I put breakpoint on CreateThread then I can step into assembly of Createthread and ultimatelyw I will hit ret statement which means ...
Hi
Silly question, but I just can not find the necessary flag in gcc. Basically, I have in my C program the following inline assembler code
asm volatile ("lea ebx, [timings] \n\t");
When compiling, I get an errormessage which says: Error: invalid char '[' beginning operand 2 `[timings]'
Now I remember that a long time ago I used some...
I have a piece of C code that calls a function defined in assembly. By way of example, let's say foo.c contains:
int bar(int x); /* returns 2x */
int main(int argc, char *argv[]) { return bar(7); }
And bar.s contains the implementation of bar() in x86 assembly:
.global bar
bar: movl 4(%esp), %eax
addl %eax, %eax
r...
Hi,
I am going through "Programming from ground up". Now I have the following code, which should give 2 as minimum answer, but I am getting 0 as answer when I do echo $?.
.section .data
data_items:
.long 3,67,34,222,56,87,9,2,88,22,11,66,900,0
.section .text
.globl _start
_start:
movl $0,%edi
movl data_i...
I have been reading Wikipedia's article on K programming language and this is what I saw:
The small size of the interpreter and compact syntax of the language makes it possible for K applications to fit entirely within the level 1 cache of the processor.
I am intrigued. How is it possible to have the whole program in L1 cache? Say,...
I'm trying to build Hello World in x64 assembly on my Leopard MacBook Pro. It assembles fine, but I get this error when I try to link it: ld: symbol dyld_stub_binding_helper not defined (usually in crt1.o/dylib1.o/bundle1.o) for inferred architecture x86_64
I loaded it with ld -o hello64 hello64.o -lc
My assembler is Yasm.
EDIT: As fa...
Hi,
I am trying to implement context switch using gcc for m68k processors. I need to use inline assembly for saving all the registers d0, d1...d7 and a0,...a7. I was wondering if I can use a loop in my inline gcc that would allow me to save these registers instead of write a separate line of code for each register.
for eg.
move.l %d0,...
I never thought I'd be posting an assembly question. :-)
In GCC, there is an extended version of the asm function. This function can take four parameters: assembly-code, output-list, input-list and overwrite-list.
My question is, are the registers in the overwrite-list zeroed out? What happens to the values that were previously in th...
I am very new to assembly language programming, so it is probably a very obvious error, but...
I use MSVC++, and when I compile any project that has a file with a .asm extension, it uses the rule
NAME EXTENSIONS COMMAND LINE RULE FILE
MASM *.asm ml.exe \c [All Options] [Additional Opti....
I've been trying to gain a deeper understanding of how compilers generate machine code, and more specifically how GCC deals with the stack. In doing so I've been writing simple C programs, compiling them into assembly and trying my best to understand the outcome. Here's a simple program and the output it generates:
asmtest.c:
void main...
Hi,
I read the different topics that deal with that kind of problem, but I still have no answer.
Here is my problem :
In my header file, i have this :
int cl, ch, _a = a, _b = b;\
__asm__ ("smull %0, %1, %2, %3\n"
"mov %0, %0, lsr %4\n"
"orr %0, %0, %1, lsl %5\n"
: "=&r" (cl), "=&r" (ch)
: "r" (_a), "r" (_b...
I am beginning to port a program which is written in C and have several pieces of code written in assembly with instructions for a 32 bit machine - like ljmp - to a 64 bits machine.
Is there a place/document that have the instructions, in assembly, for a 32 bit machine and its counterpart for a 64 one? If not, where can I find a documen...
I've seen this term in the Python Lisp compiler and some C linker's sources.
My guess is that a fix-up is just some wrapper around an Assembly routine that makes sure the alignment is right, but I'm not sure at all about anything here.
...
So, I'm disassembling a bit of code for fun and no profit (other than the joy of knowledge, that is), and I come across this bit:
mov eax, cr3
mov cr3, eax
Is this doing anything other than just masturbating with cr3? If so, what? This is x86 low-level (bios/firmware/before boot loader) intialization code. We haven't even setup up ...