An assembly language is a low-level programming language for a computer, or other programmable device, in which there is a very strong (generally one-to-one) correspondence between the language and the architecture's machine code instructions.
-2
votes
0answers
23 views
Sparc machine error [on hold]
I am not sure what is wrong with my code I am trying to do a fibbionacci number sequence with an input for example 13 would be 1 1 2 3 5 8.
The problem is that it say I have a bus core dump error I ...
0
votes
0answers
13 views
To find the MIN value in an array of 3 - MASM [migrated]
Can someone help me figure out why this code isn't working? I received an error on the 3 lines with the compare instructions. This is for class and I have to teach myself basically, so any help ...
3
votes
1answer
42 views
Counter in FASM assembly
I am making a simple counter in assembly. It counts to a billion and exits. However, the performance of this is really horrible. A Java application (that does the same) outperforms it by around 10x. ...
7
votes
2answers
97 views
Improvements/suggestions for my CPU emulator
I am trying to emulate a basic CPU (Z80) as close as possible. It currently does not read real assembly code, but that will be implemented. If you have any views on how that could be implemented, ...
6
votes
1answer
104 views
Iterating string characters and passing them to a BIOS API
Which style of printing strings from the SI registry in NASM is more correct?
I'm learning assembly and x86 architecture, but I'm rather new in it, so I've prepared two styles (in NASM) of printing a ...
6
votes
1answer
122 views
Embedded conditional code compaction
I'm porting some AVR code from PROGMEM/PGM_P to __flash, and I want to reduce the amount of conditional compilation I need to do in the code.
Here's all the code (but keep in mind that only the parts ...
1
vote
0answers
65 views
x86_64 assembly print integer stack allocation [closed]
I have made this simple assembly program that prints an integer in hexadecimal.
It works, but I don't understand why it works with only a stack size of 15, when to print a 64 bit integer including 0x ...
4
votes
1answer
161 views
Is this CPUID parser ideal for any usage?
NOTE: I'm not perfectly sure of some of the parsed data, so any corrections are more than welcome.
Parser (cpuid.c):
#include <stdint.h>
#include <string.h>
#include "cpuid.h"
enum {
...
1
vote
2answers
136 views
Please review polling for Nios 2
The program listens to the Altera FPGA DE2 board's keys that can start and stop and reset a counter:
#include <stdio.h>
#include "system.h"
#include "altera_avalon_pio_regs.h"
extern void ...
6
votes
3answers
243 views
x86 strcpy - can this be shortened?
I got about 4 days of assembly knowledge so, I need a review on this strcpy function and if it can be done better (At least I have the feeling).
Full code (with the test included):
.data
s:
...
0
votes
1answer
69 views
Assembler PIC programming, is this correct? [closed]
The question is:
Write the following pseudo in assembler code:
if portC bit 3 == 0
(switch content of var1 and var2)
else
(add var1 with var2 and place the result in var1)
My answer is:
btfsc ...
2
votes
0answers
96 views
x64 assembly clearmem / zeromem
I've just started learning assembly yesterday, and the first useful thing I've written is a clearmem function. I'm looking for general feedback regarding my coding of this function, whether there any ...
2
votes
1answer
181 views
Fastest fill memory with specified 64-bit value
I need to fast fill some memory block in C#, so I wrote something like this (in Ffree Pascal COmpiler + Lazarus in 64 bit mode):
// ECX = Ptr64
// EDX = Count
// R8 = Value
PROCEDURE Fill64 (VAR ...
6
votes
1answer
351 views
Calculating prime factors in MIPS assembly
The goal of this was to be able to enter any number and print out the prime factors of that number. Are there any shorter ways of writing this code? I'm not very familiar with low-level syntax and was ...
6
votes
1answer
201 views
RC4 in 8051 assembly optimization
I've been playing around with 8051 assembly lately and thought I would make a little project of implementing RC4, since it is pretty interesting and the algorithm doesn't seem too hard. Plus, taking ...
7
votes
2answers
359 views
GCD/LCM calculator in x86 assembly
After creating a similar program in C++, I've decided to try to write it in x86 assembly language (the type of assembly I was taught in college).
I'd like to receive feedback regarding syntax and ...
5
votes
1answer
102 views
Computing a mathematical function in MIPS assembly
This code computes the function (3x^2-4x+16) / (5x^2+2x-4). I ran the program and it works, but I am fairly new to assembly language and am not quite sure how to make the most efficient use of the ...
3
votes
1answer
172 views
Trying to improve and better understand Intel SSE intrinsics
I've been writing a collection of signal processing function optimized with SSE intrinsics (mostly for audio processing). Here is a linear interpolation function I wrote. It works well and is quite ...
2
votes
1answer
454 views
Please review assembly for Nios 2 interrupts
This is homework for which we have prepared Nios 2 assembly and C:
########################################
# Definitions of device-addresses
# and important constants.
#
# de2_pio_keys4 - 0x840
...
5
votes
0answers
255 views
Writing SIMD libraries for C++ on FASM in x86-64 Linux
I have recently started a project of SIMD libraries development for C++ on FASM for x86-64 Linux.
I would be glad to hear any opinion or feedback about the project, cleanness of the code and ...
7
votes
1answer
238 views
Listing the first five perfect numbers in MIPS assembly
I've done some programming in the past, but I'm new to MIPS, which I'm trying to learn on my own. This program lists the first five perfect numbers. It uses the Lucas-Lehmer and Miller-Rabin primality ...
5
votes
1answer
204 views
First steps with amd64 assembly
I try to learn amd64 assembler. This is the first thing I tried. This piece of assembly should replicate the functionality of the following piece of C code, which turns a binary sha-256 hash into a ...
5
votes
1answer
200 views
The beginnings of a bootloader using GNU-based tools
This is a personal project of mine. I am currently in the research phase of developing my own bootloader that will be used to load a single task operating system. I am far away from the final goal, ...
4
votes
1answer
939 views
SSE2 assembly optimization - multiply unsigned shorts and add the result
I am attempting to optimize a piece of C code which aims to multiply a series of pairs of unsigned shorts and add the result. I am only concerned about the high 16 bits of the result, and I can ...
38
votes
8answers
7k views
Fastest way to clamp an integer to the range 0-255
I'm working on some image processing code that can generate pixel values outside of the normal range of 0 to 255, and I'd like to clamp them back into the valid range. I know that there are saturating ...
1
vote
2answers
428 views
Correct User Input - x86 Linux Assembly [closed]
So I am working on an x86 Assembly program for Linux using NASM. This program basically asks the user for their name and their favorite color. After doing this and storing the two strings in variables ...
6
votes
1answer
277 views
Improving this bilinear scaling SSE2 code on Core 2 CPUs
I am looking for some help with improving this bilinear scaling SSE2 code on Core 2 CPUs.
On my Atom N270 and on an i7, this code is about 2x faster than the MMX code. But under Core 2 CPUs, it is ...