Hey, as an exercise to learn more precisely how c programs work and what minimum level of content must exist for a program to be able to use libc, ive taken it upon myself to attempt to program primarily in x86 assembly using gas and ld. As a fun little challenge, I've successfully assembled and linked several programs linked to differen...
Hello, please help me to write program in assembly (MIPS)
I have a word "hello!" and I need the mips prints next:
h
he
hel
hell
hello
hello!
I tried this:
.data
lbl1: .asciiz "hello!"
lbl2: .asciiz "h "
end_line: .asciiz "\n"
.text
main: la $s0, lbl1
move $a0, $s0
addi $v0, $zero, 4
syscall jr $ra
but it...
In assembly how do i Print the values of an Array?
Now in this program I also have to print its values < Index entered in by the user.
.intel_syntax noprefix
.include "console.i"
.data
index: .long 0
array: .long 1,2,3,4,5,6,7,8,9,10,11,12 # Array initialized
value: .long 0
.text
ask1: .asciz "Enter an...
Dear All,
I was looking at the assembler output of my code and need help with below instructions.
-- // --
0x00000fe8: e28fc000 .... ADR r12,{pc}+8 ; 0xff0
0x00000fec: e28cca08 .... ADD r12,r12,#8, 20 ; #0x8000
-- // --
From my understanding the 1st instruction causes r12 to be loaded with
"{p...
int main(void)
{
int x = 10, y;
asm ("movl %1, %%eax;"
"movl %%eax, %0;"
:"=r"(y) /* y is output operand */
:"r"(x) /* x is input operand */
:"%eax"); /* %eax is clobbered register */
}
what is r(y) here also why %% is used before eax. generally single % is used right ?
...
How do I subtract a decimal value in assembly. IA32 (linux)
1: mov edx, 1/2
sub ecx, ebx
sub ecx, edx
mov bal2, ecx
I tried this but it some how skips the subtraction with the decimal.
And if I enter .5 it gives me an error.
error:junk `.5' after expression
...
MIPS32 ISA defines the following format for the sync instruction:
SYNC (stype = 0 implied)
SYNC stype
here, stype may be SYNC_WMB (SYNC 4), SYNC_MB (SYNC 16), etc.
In inline assembler, I may use default sync: __asm__ volatile ("sync" ::);.
But, if I write something like __asm__ volatile ("sync 0x10" ::), it doesn't compile:
Error: ...
Hello. I'm trying to rewrite this asm code in C, but my asm knowledge very bad.
struct
{
union
{
struct{
WORD ShiftZ0;
WORD ShiftZ1;
WORD ShiftZ2;
WORD ShiftZ3; };
struct{
DWORD ShiftZ01;
DWORD ShiftZ23; };
};
short ShiftZ0Align;
short ShiftZ1Align;
short ShiftZ2Align;
short ShiftZ3Align;
int deltaZ0...
Does anyone know of an efficient implementation of a memcspn function?? It should behave like strcspn but look for the span in a memory buffer and not in a null terminated string. The target compiler is visualC++ .
Thanks,
Luca
...
I'm single-stepping through 64-bit intel opcodes using kdbg. I'd like to alter the contents of RAX, etc and repeat a sequence of opcodes - by altering RIP or otherwise telling it continue execution from some point. Is this possible?
Of course I've browsed all the kdbg documentation i could find.
...
This is a really easy question, but if I have a bunch of instructions written for MIPS (although I assume this probably carries over to assembly in general), and there is a label at some point, does the instruction at that label get executed even if it's not explicitly called? For instance, let's say I have:
SUB $6, $4, $3
BNE $6, $2, ...
Hi guys~
Does anyone know where to find a summery table or cheetsheet for the Linux system call in Assembly language? I am invoking Linux system calls through int 0x80 instruction and I need to refer to what register contains what value from time to time.
Thanks.
...
I wonder on which language is Chromium OS written.I guess they have used C/C++ but did they put something different(Go,).Did they used Assembly for low level code as I know that they had to change some things to make booting a lot faster?
...
Hi there,
I'm using Ollydbg to disasemble a program. What I need to do is inject code into the program and save an EDX value at a certain point. I'm guessing the easiest way would be for me to create a dll with a single function like so...
function WriteEAXValue(EAX: PChar): LongBool
and then inject code into the program so it calls t...
Guys I'm a novice.
I have learnt C and Assembly(IA32) on Linux and I will also be learning a few more languages this year.
I want to make my fundamentals strong and for that I need some tips from you guys as in, where will I find programs for practice? so that I solve them and get more and more experience.
Any good web links that would...
Hi,
I decided to start learning assembly a while ago, and so I started with 16-bit assembly, using FASMW.
HOwever, I recently got a really new computer running Windows 7 64-bit, and now none of the compiled .COM files that the program assembles work anymore. they give an error message saying that the .COM is not compatible with 64-bit wi...
Hello. I wish to write a bootable program in assembler that would be capable of sending and receiving network packets. I do not wish to use any libraries, I'd like to create it all by myself (and also learn while doing so). Unfortunately, I was unable to find any information regarding communication with the network card on the lowest lev...
I have assignment to calculate GCD of two no. by using stack frame & I write code for this -
.text
GCD:
push ebp
mov ebp,esp
1: cmp ebx,eax
je 3f
ja 2f
sub ebx,eax
jmp 1b
2: sub eax,ebx
jmp 1b
3: leave
ret
I got the answer of this code but i have question without taking mem...
I am doing some OS experiment. Until now, all my code utilized the real mode BIOS interrupt to manipulate hard disk and floppy. But once my code enabled the Protect Mode of the CPU, all the real mode BIOS interrupt service routine won't be available. How could I R/W the hard disk and floppy? Do I need to do some hardware drivers now? How...
I'm kind a of making a "JIT" for a numeric routine that I need to compute fast, for x86-64. I'm only using sse instructions for arithmetics and of course some moves. My application generates all of those by simply writing the binary form of machine instructions to some part of memory and then executing. For getting the binary form of ins...