assembly

What is the string length when parameter passing in asm?

i am passing two strings from a c file to asm file as parameters. then i move these to ecx and edx from stack. how can i know exactly what their lengths are? like strlen(string) in c? push ebp mov ebp,esp mov ecx,[ebp+8] mov edx,[ebp+12] ...

[OAM] Factorial

I have some OAM code here, and I've looked up all the instructions, what they do how they act, and I've re written it all pseudo, but I'm having a problem locating (so I can count how many) loops are in the program. I feel like it should be staring me in the eyes, and I've done a thousand factorial programs in C/Java etc.. but I can't se...

assembly implementation for kbhit in linux

I'm writing a game in assembly, and I need to check if a key was pressed. So, how is kbhit implemented in Linux? Thanks. ...

How to fetch memory in realtime after CreateProcess?

I have executed a process using CreateProcess, but I want to fetch or dump the memory area allocated to the process, preferably in real time. Unfortunately I do not know how to recieve the pointer to the memory are after creating the process. I've been searching around, but I have not found any useful answers so far. If anyone could hel...

Are cores (device abstraction level) of OSs written entirely in C? (Like: "UNIX is written in C")

Are cores of OSs (device interaction level) really written in C, or "written in C" means that only most part of OS is written in C and interaction with devices is written in asm? Why I ask that: If core is written in asm - it can't be cross-platform. If it is written is C - I can't imagine how it could be written in C. OK. And what ...

Explaination of dd command in nasm

I am reading osdev wiki. I came across these two lines of code. nasm kernel.asm -f bin -o kernel.bin dd if=kernel.bin of=/dev/fd0 I can understand the first line but I can't understand the second line. what the second line do? what is this dd command? what is this /dev/fd0 here? Can anybody explain me this please? Thanks in adva...

How to boot in vmware?

I came across these two lines in osdev wiki. nasm kernel.asm -f bin -o kernel.bin dd if=kernel.bin of=/dev/fd0 It copies the kernel binary to a flopy. Does this means the flopy becomes bootable? I don't want to create a bootable flopy , instead of that I want to create a iso image by which I can boot in vmware. is it possible? If...

address in push instruction changing after modifying exe in hex

running on windows 7, 32bit home pro I created a very simple few line app in visual studio 2008 , compiled and linked with standard libraries in release mode into executable test.exe. The code in c is as follows: char* test = "h"; int main() { _asm { push 0xFEEDBACC; } MessageBoxA(0,test,test,0); } which res...

cross compile (arm-none-eabi-as) arm assembly error "junk at end of line /" or undefined symbol

Hi while i cross compile an startup.s file (arm-none-eabi-as file.s) (*-gcc) I am getting in each commentary line some errors - junk at end of line, first unrecognized character is / when i delete the // some comment lines i get errors about undefined symbols even i defined them at beginning of the file. anyone know whats wrong? ...

x86 Assembly: How do Disassemblers know how to break up instructions?

How does a x86 disassembler know where to break up the instructions? I am looking at the 8088 instruction set. For example the move instruction has 7 variations that range from 2 to 4 bytes. The instructions themselves seem to follow no particular order. Another reason for Why is x86 ugly?. For example: 7654321...

How to optimize a cycle?

I have the following bottleneck function. typedef unsigned char byte; void CompareArrays(const byte * p1Start, const byte * p1End, const byte * p2, byte * p3) { const byte b1 = 128-30; const byte b2 = 128+30; for (const byte * p1 = p1Start; p1 != p1End; ++p1, ++p2, ++p3) { *p3 = (*p1 < *p2 ) ? b1 : b2; } } ...

Assembly Code problem

write a program that sends 33H, 7FH, B7H,and EFH to P0, P1,P2,P3. Each number must appear at each port for 2 seconds and each port must always have one of these numbers there. the processor is a DS89C450 and has a clock of 11 MHz. Using assembly language. ...

Returning a pair of items from a function

I know all the normal ways of doing this, what I'm looking for is an article I read a long long time ago that showed how to write some crazy helper functions using inline assembly and __naked functions to return a pair of items. I've tried googling for it endlessly, but to no avail, I'm hoping someone else knows the article I'm talking ...

array of Integers in embedded x86 assembly

I am trying to acces values from an array of integers and have been trying for hours with no luck. Here is my code so far: All I am trying to do is acces the values in the array "arr", i have seen how to do it with characters but not with integers. int binarySearch (int* arr, int arrSize, int key, int* count) { int result=-1; ...

need help writing a program

I am taking a class in microprocessing, and having some trouble writing a program that will hold a value in a port for two seconds before moving on to the next port. Can any one help this make more sense? I have thought of using NOP but realized thats a bit unrealistic, I have tried ACALL DELAY but for some reason its pulling up as an u...

Need a reference for the masm procedures prototyped inside masm32.inc and other .inc files

I have a problem because all though I can see the procedures inside the .inc files most of the actual code as been processed into .lib files. I have tried doing searches inside msdn and the masm hlp files. The win32 api has some of the information neccessary to make correct procedure calls but only for some of the procedures. What I n...

Converting unsigned chars to float in assembly (to prepare for float vector calculations)

I am trying to optimize a function using SSE2. I'm wondering if I can prepare the data for my assembly code better than this way. My source data is a bunch of unsigned chars from pSrcData. I copy it to this array of floats, as my calculation needs to happen in float. unsigned char *pSrcData = GetSourceDataPointer(); __declspec(alig...

Task management on x86

Can someone please point out some books or online resources which explain in detail and at an advanced level the task management features of x86? I'm specifically interested in understanding the relationship between x86 hardware and the OS (POSIX style) when an interrupt or context switch occurs. Intel manuals are very confusing and I ca...

How to pass parameter to a function from Assembly to C

I am using HCS08 and Code Warrior. I am calling a C function from assembly. How can I pass parameter to this C function? ...

Instrumentation

Hello All, I am new to ASM(byte code manipulation kit) and am using it to instrument java byte code. I want to access the methods of a class and change their access modifiers using ASM. Does someone have an idea about how to achieve this? I know that calling visitMethod would help but do not know how to do that exactly Any information o...