49 questions
0
votes
1
answer
166
views
Is there _any_ way in Java (even if "unsafe") to instantiate an uninitialized object directly at a specified address?
[Edit: This would not be done on (regular) heap memory; but direct ByteBuffer, or off-heap memory allocated through Unsafe, or MemorySegment (from FFM) are all possible candidates.]
I'm aware that via ...
-4
votes
1
answer
55
views
Swap 2 lines in text file using assembler
this is my code for swapping 2 lines in DosBox assembly. I can not find out why is it printing the same thing from input.txt to out.txt. I think the problem is with line numbers (and user input). ...
0
votes
0
answers
241
views
can't open a file (image.gray) in assembly RISC V (windows and also linux)
can't open a file ("filename.gray") in assembly Risc v,
assume that the path to the file, either being absolute or relative is correct (i'm not having issues with null terminated strings)
...
1
vote
0
answers
81
views
Why are as-assembled files so big?
I'm quite new to assembly and low-level-coding, but I found nothing worth on Google, so maybe someone could explain why a simple Hello World ARM64 script takes 17KB on my Mac.
I'm using an Apple Mac ...
1
vote
1
answer
64
views
how to pack a section of machine code as a function in .o object file
GOAL: Given a section of machine code, which conatins RISC-V extended instructions, I want to wrap it as a function and create an .o object file.
The function is something like void foo(), there's no ...
0
votes
1
answer
49
views
Event Processing based on different windows
I have a use case which for which i want to make my system scalable. Lets say some producers are pushing different events in a Message queue. Event 1,Event2, Event3 etc. In backend consumer I want to ...
0
votes
0
answers
101
views
PEB X86 wrong address [duplicate]
So here is my question :
I wanted to get PEB from x64 and x86 without calling NtQueryProcessInformation.
I use ASM from this question : How to use NtCurrentTeb() without Windows header files?
ASM Code ...
1
vote
2
answers
933
views
What does this syntax *((unsigned int *)(buffer+i)) mean in C
This is the code:
char *command, *buffer;
command = (char *) malloc(200);
bzero(command, 200);
strcpy(command, "./notesearch \'");
buffer = command + strlen(command);
for(int i=0; i < ...
0
votes
1
answer
2k
views
How to assign value to std_logic_vector in VHDL?
I am trying to assign value to OUTPUT std_logic_vector in the below code, but it gives me errors that
COMP96 ERROR COMP96_0143: "Object "OUTPUT" cannot be written." "design....
0
votes
2
answers
738
views
Fastest way to spread 4 bytes into 8 bytes (32bit -> 64bit)
Assume you have a 32-bit unsigned integer, where the bytes are organized like this: a b c d.
What is the fastest way to spread these bytes into a 64-bit unsigned integer in this fashion:
0 a 0 b 0 c 0 ...
0
votes
0
answers
1k
views
MIPS Assembly Language Code To Use ASCII Values For Name
I am new to MIPS and this assignment is a little confusing for me because the requirement is to calculate the ASCII values of each character in one's name, and to print the name in Last, First format, ...
0
votes
0
answers
40
views
Computer programs from the point of view of CPU
This might sound a bit naive, but, I'm unable to find an appropriate answer to the question in my mind.
Let's say there is an algorithm X, which is implemented in 10 different programming languages. ...
0
votes
0
answers
207
views
Mips Matrix multiply wrong answer
I have been trying to complete this program for the last 13 hours. I have tried everything and nothing seems to work. For some reason it works when I take input from the user for 4x4 matrices and ...
0
votes
1
answer
94
views
Java: How to populate a variable in subclass?
So this is not a assignment but one of my lecture slide did not make it clear and when I try to code something similar myself, I run into a problem.
I can't figure out how to populate a variable ...
1
vote
4
answers
2k
views
How to form an ASCII(Hex) number using 2 Chars?
I have char byte[0] = '1' (H'0x31)and byte[1] = 'C'(H'0x43)
I am using one more buffer to more buff char hex_buff[0] .i want to have hex content in this hex_buff[0] = 0x1C (i.e combination of byte[0]...
-1
votes
1
answer
382
views
default __init__ for code objects
I found code objects in Python. I'm curious as to what each of the variables in the constructors do. There is not much information on them in the builtin help function all I got was:
class code(...
1
vote
4
answers
522
views
C code - a way to convert 5 to 7 and 7 to 5 without "if"
I want to write a function that gets a number X and if X=5 it returns 7 , if X=7 it return 5 otherwise, return something else.
There is the trivial way - to use "if" blocks
Another way - to use a map (...
2
votes
1
answer
300
views
How does software interact with hardware at the lowest level? [closed]
I'd love to know/see some example code from the lowest level. By this I mean the code that for example, sets the voltage to the speakers, or something equivalent. I can't imagine how this would look/...
2
votes
2
answers
2k
views
C low-level standard-in to accept filename then printing file contents to stdout
I want to get a file name from a user via stdin, open the file with open() and assign it to a file descriptor, then print the contents of that file to stdout. This is my code, and it's not working ...
1
vote
4
answers
10k
views
How can I write a string to a file using the low-level write() function?
For example, I am able to write the contents of an input file to and output file with:
char buffer[1024]; // character buffer
char userInput[1024]; // for user input
char *p;
char *q;
int n;
int ...
12
votes
3
answers
18k
views
How can I check to see if a file descriptor was closed?
In a POSIX environment when using system calls to manipulate text files (open(), close(), read(), write()), is there a way to to check to see if I actually closed a file descriptor when using close(...
7
votes
1
answer
9k
views
ARM assembly using Qemu [closed]
Well i've searched whole internet for code that will run using arm-linux-gnueabi-as and qemu.
To print a integer value. From string. A routine will help.
0
votes
2
answers
7k
views
use read() to take user input instead of scanf
Im trying to use the read() function to take user input but the only thing I can find in the documentation is regarding reading from files, this is in Linux c language. I also want to use write() do ...
3
votes
3
answers
3k
views
Where can I find low level Sound Programming Theory Tutorials
I am an intermediate graphics programmer. I want to learn audio/sound processing theory from the ground up.
Just like how "A pixel" and its components R,G,B,A is the fundamental part of Graphics ...
40
votes
6
answers
13k
views
Learning about Java bytecode and the JVM
In a recent question asked recently my simple minded answer highlighted many of my misconceptions about Java, the JVM, and how the code gets compiled and run. This has created a desire in me to take ...