Suppose we've got two integer and character variables:
int adad=12345;
char character;
Assuming we're discussing a platform in which, length of an integer variable is longer than or equal to three bytes, I want to access third byte of this integer and put it in the character variable, with that said I'd write it like this:
character=...
Hello,
I've started learning 16-bit assembly (eventually moving up to 32-bit) from this tutorial here:
http://matthew-4gl.wikispaces.com/fasm_tutorial
and I am doing a few tests and practices on the flat assembler version 1.69
I got to the part in the tutorial on jumps, and the use of the jmp instruction. No matter what I do, however, ev...
I'm using GCC with the -fomit-frame-pointer and -O2 options. When I looked through the assembly code it generated,
push %ebp
movl %esp, %ebp
at the start and pop %ebp at the end is removed. But some redundant subl/addl instructions to esp is left in - subl $12, %esp at the start and addl $12, %esp at the end.
How will I be able to re...
How can I prepend a SS: or ES: using AT&T Assembly Syntax without adding in a .byte 0x36 or .byte 0x26?
ie. How would I be able to convert mov dword ptr ss:[esp+0x10], offset foo from Intel syntax to AT&T without using:
.byte 0x36
movl $foo, 0x10(%esp)
I have tried movl $foo, %ss:0x10(%esp) which assembles without warnings but, ...
I'm confused about machine code and native code. What is the difference between these?
Are these the same or not please?
...
Hi,
In assembly, when they say "immediate data" is that signed or unsigned??
I'm writing a Gameboy emulator and am using the opcodes here:
http://www.pastraiser.com/cpu/gameboy/gameboy_opcodes.html
Opcode 0xC6 for example is ADD A, d8.
My guess is that it's unsigned else why would they need "SUB A, d8" but I thought that I'd ask jus...
I'm working on an assembler for the 8086 . My question is how do you convert the hex opcodes to an executable file like .EXE,.ELF,.COM,a.out etc .Looking for links/resources for this and should the assembler do the linking process or is it done by the OS automatically?
...
Hello,
I have seen the following topic.
I am interested in contacting the keyboard via the IN / OUT instructions and setting various modes, such as turning on the caps lock led. So far I have encountered problems doing so.
The following link may help.
I have tried various combinations such as
mov al,0EDh ;ED command - Send L...
I've made a compiler for a general-purpose programming language. As part of the toolchain, I'd like to include a profiler with the ability to estimate the time complexity of a given expression. It seems fairly straightforward to calculate the algorithmic complexitythat is, assuming all constant-time operations take the same amount of tim...
I want to enable data cache. I dont have much experience with ARM as I have mostly programmed for IA32. My understanding is that I need to enable MMU to enable data cache. As I dont need the virtual memory other wise so I want to enable MMU with one-to-one mapping between physical and virtual address space for all applications.
Any help...
As the Intel Manual illustrated, both Interrupt Gate and Trap Gate can be used to access a handler routine. And some exceptions even share vector numbers with interrupts. I am wondering when such a shared vector is detected by the CPU, how could CPU know whether it stands for an exception or an interrupt?
I am kind of confused about th...
I'm confused should i learn C++ or ASM?
I'm just a hobbyist so no big deal but i need some advise.
thank you
...
How can I perform restricted instructions such as IN and OUT from protected mode?
I've found out that It would require privilege level (CPL) high enough to perform the IO instruction. How can I run in kernel mode, have IO permission or anything other that may help me? - I would like to have direct access to hardware, without anything bl...
I am working with a Microchip dsPIC33FJ128GP802. It's a small DSP-based microcontroller, and it doesn't have much power (40 million instructions per second). I'm looking for a way to render a convex (i.e. simple) polygon. I am only dealing with 2D shapes, integer math, and set or clear pixels (i.e. 1 bit per pixel.) I already have routin...
Hello. If I have the following code in Windows VC++:
DWORD somevar = 0x12345678;
_asm call dword ptr [somevar]
How can I make the same thing in GCC inline-assembly, with AT&T syntax?
__asm__ __volatile__ (
"call dword ptr [%%edx]" : :
"d" (somevar)
);
I've tried something like this, but it generates an "junk" error...
And ...
I was reading this document: http://www.fadden.com/techmisc/hdc/lesson11.htm
In it he stated:
Problem is, we don't know how long
these are. So, we encode the length
with the unary coding we looked at
first (colons added for clarity):
value binary coding
1 1:
2 01:0
3 01:1
4 001:00
5 ...
How do I compile assembly code in a separate file?
If my function is of the type "void __fastcall foo(unsigned long long, unsigned long long, unsigned long long, unsigned long long&, unsigned long long&)", how do I implement this in my .asm file?
...
I have found these few lines of assembly in ollydbg:
MOV ECX,DWORD PTR DS:[xxxxxxxx] ; xxxxxxxx is an address
MOV EDX,DWORD PTR DS:[ECX]
MOV EAX,DWORD PTR DS:[EDX+116]
CALL EAX
Could someone step through and tell me what's happening here?
...
How can the following instructions make any sense?
xor eax,eax
mov eax,[eax]
When you XOR eax, you get zero most of the time, so can you dereference what is at address [eax] (in this case eax contains 0) and put it back into eax?
Someone please clarify?
...
I've been messing around with IDA Pro and trying to disassemble my own products just for the sake of it.
I've noticed a couple of things I don't understand because my assembly language knowledge is terrible. Here is a little chunk of code which invokes CGContextSetRGBStrokeColor.
CGContextSetRGBStrokeColor(ctx, 1, 1, 1, 1);
In IDA i...