Click here to Skip to main content
15,888,610 members
Everything / Programming Languages / Assembler

Assembler

assembler

Great Reads

by CMalcheski
How to Create a Complete DirectX Game in Assembly Language
by Chris Boss
Why some prefer the BASIC language over others
by leon de boer
Introducing SmartStart something like a BIOS for the Pi
by Gregory Morse
UTM based on mov is Turing-complete paper x86 and x86-64

Latest Articles

by Jonathan Chapman-Moore
How to build Microsoft Disk Operating System 1.25
by Tasos Kipriotis
A quicker way to calculate the partial sum of binomial coefficients
by Andrea Simonassi
A simple subtraction algorithm for multiple precision arithmetic
by Andrea Simonassi
Showing algorithms and code used on this article series

All Articles

Sort by Score

Assembler 

8 Jun 2017 by CMalcheski
How to Create a Complete DirectX Game in Assembly Language
23 Aug 2018 by Chris Boss
Why some prefer the BASIC language over others
17 Sep 2017 by leon de boer
Introducing SmartStart something like a BIOS for the Pi
5 Feb 2017 by Gregory Morse
UTM based on mov is Turing-complete paper x86 and x86-64
26 Jun 2018 by CMalcheski
A Full DirectX Sample Application Created in Pure Assembly Language
3 Oct 2020 by Ben Hanson
Back in 1984, I wanted to write a Z80 assembler. At the time, this would have meant coding it in Z80 machine code, but due to the conveniences of modern technology, I have now done it in C++.
24 Jul 2018 by stevemk14ebr
PolyHook v2 - the C++17 x86/x64 library supporting multiple methods of hooking
5 Mar 2017 by Jose A Pascoa
14 Jun 2017 by CMalcheski
Part II - Laying the Foundation for the Migration to Assembly
1 Nov 2018 by Alexander Eremeev
The Windows kernel-hacking library and development framework written on C++17
27 Feb 2016 by John Jiyang Hou
A List data structure implementation in MASM Assembly with C function realloc
30 Aug 2019 by Oscar-Tark
If you are looking into white hat hacking, it's good to know old school tactics used for overflows.
28 Dec 2020 by CPallini
Fast integer square root computation in 8051 assembly
5 Jun 2019 by altomaltes
This code calculates square root of an integer on a few assembler code lines.
28 Jun 2016 by David A. Gray
A reference chart that doubles as the engine behind a data structure mapper
15 Feb 2024 by Jonathan Chapman-Moore
How to build Microsoft Disk Operating System 1.25
22 Nov 2015 by OriginalGriff
Assembly language doesn't use a compiler - only high level languages need that. Assembly language is processed to machine code via an assembler, which is a different type of program altogether.And this isn't a question we can answer: each assembler is specific to a processor type - or even...
15 May 2016 by Anton Angelov
Describes how to improve even further the behaviours design pattern tests through new base classes and usage of Unity IoC container.
30 Nov 2016 by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
We will discuss a quick tip to resolve the SourceTree issue mentioned in the title.
12 Sep 2018 by Chris Boss
A short introduction to using the Powerbasic 6.0 console compiler with the Ontime RTOS-32 embedded operating system
26 Oct 2020 by OriginalGriff
Yes it can be done: just because something isn't directly supported by the processor doesn't mean you can't use it in assembler - think about a BigInt value where each decimal digit is stored in a nibble - so two digits fit in a byte - and an...
26 Oct 2020 by KarstenK
There is support in some C++ libraries like Boost for that. Some compilers are not handling exact sizes for data types, but are using alignment. The advantage is that full bytes are used and so the processing speed is better, because no efforts...
15 Sep 2021 by Richard MacCutchan
Multiplication and Division in MIPS Assembly Language[^]
21 Jun 2015 by CPallini
If you meant 'How could I establish if an int value would fit in a byte?' then the answer is yes, you may do it. A simple approach could be the round-trip:unsigned int a = 0xDEADBEEF; // see the nvr3 commentbool fit_in_a_byte = (a == static_cast(a));
19 Jul 2015 by Frankie-C
OK now it makes a little bit more sense.To write an assembler is not such an easy task, at least to encode correct machine code.In some cases even if a full specified instruction is present there could be more than one legal encoding.Anyway going back to your question consider that in...
24 Jun 2015 by CPallini
In order to output the number 11 to the display you have to call the interrupt 21h two times, providing the character '1' (that is the value 31h) as dl argument.Generally speaking, in order to ouput (in decimal representation) the content of a 8bit register you have to:divide (integer...
24 Aug 2015 by Dave Kreskowiak
There is no assembly to add a reference to. NativeWifi is part of Windows and accessible through P/Invoking the various functions. There is no assembly in the .NET Framework that wraps that functionality.There is, however, a third party wrapper you can use here[^], though it hasn't been...
24 Sep 2016 by OriginalGriff
Look at your IF:IF num1 > num2 AND num3 THENThat doesn't do what you think it does!You think it means "if number one is the greatest of the three numbers" - it doesn't. The AND breaks it into two separate conditions and insists that both must be true: So "if number one is greater than number...
11 Jun 2022 by Andrea Simonassi
Showing algorithms and code used on this article series
15 Sep 2021 by CPallini
Note, you don't have to use the multiplication. You know, the left shift...
2 Oct 2022 by Richard MacCutchan
Do you see something wrong here? MOV AL, NUM1 MOV AL, NUM2 MOV SOMMA, AL And at that point both NUM1 and NUM2 are characters, and not numeric values. So the first thing you need to do is convert each number to its integer equivalent. So...
9 Nov 2023 by Andre Oosthuizen
Hi Mike, great to see you on the Q&A side of the world for a change :)... I am not at all familiar with ZMAC at all and took the "easy but stupid" way out, sometimes it helps, sometimes it is a waste of time, your choice to try it - I have asked...
14 Jan 2024 by merano99
Quote: Opcodes are 1 byte, except push/pop operations which are 2 bits. The increase in memory traffic caused by an instruction that addresses a memory location depends on the size of the memory address. In the task, it was specified that the...
9 Jul 2015 by OriginalGriff
"how do you store a 11 byte data into 1 byte memory?":laugh:You don't.db allocates bytes, not just a byte - so if you use msg db 'Hello, world!',0xathen it will allocate an area for an fourteen character string with the data filled in, not a single byte. The label msg will contain...
9 Jul 2015 by F-ES Sitecore
msg db "ABC"the above places "ABC" at that memory address and that memory address is labelled as "msg". So if my code is at memory address 10000 then the following assemblymsg db "ABC"NOPwill result in10000 A10002 B10004 C10006 00 (00 being the NOP)Memory address...
2 Sep 2015 by Richard MacCutchan
Assuming from your question you do not have a copy of a reference manual, you can find the answers quite easily by following: https://www.google.com/search?q=arm+assembly[^].
30 Oct 2015 by Jochen Arndt
You should definitely get some copy of the MIPS instruction set reference. Even without that I was able to find the instructions floor.s and ceil.s using Google. However, these are only supported with newer MIPS CPUs. But you can also do it the hard way by adding or subtracting 0.5 (depening...
10 Nov 2015 by Leo Chapiro
Take a look at this very nice free PDF (under the terms of the GNU FreeDocumentation License) from Jonathan Bartlett:Programming from the Ground Up
10 Nov 2015 by Patrice T
The dragon book may be of interests to you too.https://en.wikipedia.org/wiki/Compilers:_Principles,_Techniques,_and_Tools[^]
24 Dec 2015 by Andreas Gieriet
A simple task scheduler?A memory pool memory manager?A fixed-point arithmetic library, e.g. for add/sub/mul/div?A device driver for an SPI connected device?...CheersAndi
4 Mar 2016 by Richard MacCutchan
You cannot create a .com program directly from the assembler (including the fact that the source does not support it). The output should have a .exe extension.
4 Mar 2016 by stackprogramer
i had a silly wrong!!i completed answer my friend after thinking i concluded that int 0x80 is not in windows, it should be for linux.Richard MacCutchan thanks very much.cordially your stackprogramer
10 Jun 2016 by E.F. Nijboer
The difference is between using the value directly or from memory address.mov esi, OFFSET byteValHere the address of byteVal will be put into register esi (assume 00404000 as in the example)mov al, [esi] ; AL = 10hHere the esi is put between brackets, like [esi], meaning not to use...
11 Jun 2016 by Patrice T
First of all, you can simplify your codereverseLoop: mov eax, [esi] ;move the element in esi to eax mov ebx, [edi] ;move the element in edi to ebx xchg eax, ebx ;exchange the two elements mov [esi], eax ;move the element in eax, to the address in esi mov [edi], ebx ...
3 Aug 2016 by Richard MacCutchan
buffer: db 'hello, world'times 64-$+buffer db '_'Assume the location of buffer is 1000, then the location of times (identified by the $ sign) is 1012.So:64 - 1012 = -948-948 + 1000 = 52The expression effectively calculates the number of dashes to add to the previous string to...
16 Aug 2016 by Richard MacCutchan
Portable Executable - Wikipedia, the free encyclopedia[^].Managed Execution Process[^].
26 Sep 2016 by Garth J Lancaster
I would have started on a piece of paper, since you only have 3 variables, LINES, X, YI'm going to use a notation a
13 Mar 2017 by Kornfeld Eliyahu Peter
To print a character using BIOS interrupt 10h, you first have to set the function in AH...mov ah, 0x0emov al, '-'int 0x10If you wish us to examine your code, please paste it in to your question instead of adding a link...
31 May 2017 by Patrice T
We do not do your HomeWork. HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them. Any failure of you will...
11 Jun 2017 by OriginalGriff
Quote: I need a help. ... blah, blah, homework question copy'n'pasted in, blah, blah ... I need this code We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify...
11 Jun 2022 by Andrea Simonassi
The simplest multiple precision sum algorithm
13 Dec 2017 by Jochen Arndt
That depends on the type of data (bit width with integers or single/double precision floating point values) and if overflow can occur and should be handled. For 16-bit int with no overflow detection and array address in ds:si: [EDIT: Fixed wrong offsets] AvgLoop: ; Check for end of...
16 May 2018 by OriginalGriff
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action. And 3 lines of C code does not count...
16 May 2018 by Patrice T
Quote: X86 assembly sorting problem What problem do you have on this HomeWork ? We do not do your HomeWork. HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have...
3 Dec 2018 by CPallini
Quote: I expected the register $v0 to store 32 (11 + 11 + 10) and $a0 to store 154 (79 + 75). Your assumptions are wrong. addi $v0, $zero, 11 could be written (pseudocode) v0
20 Mar 2019 by Dave Kreskowiak
We're not here to do your homework for you.
23 Apr 2019 by OriginalGriff
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you. So we need you to do the...
13 Aug 2019 by Stefan_Lang
The problem is that when you use any form of automatic conversion, the resulting code cannot be magically more readable than before. It requires hard work and good analysis to understand what the data structures are, recognize patterns in the algorithms and subroutines, and derive the general...
13 Aug 2019 by Patrice T
Quote: but i could not seem to find the syntax. i tried but i always get an error. Advice: Never do this, not like that! The code in your comment show that you do not understand what you do, and it is a good thing that you get errors. This piece of code: 0x00401410 : push %ebp...
18 Nov 2019 by OriginalGriff
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you. So we need you to do the...
18 Nov 2019 by CPallini
Have a look, for instance, at MASM - Arrays - Other Language Tutorials | Dream.In.Code[^].
5 Mar 2020 by Richard MacCutchan
There are links at GitHub - asmjit/asmjit: Complete x86/x64 JIT and AOT Assembler for C++[^] to the blog and chat spaces, so you would probably get better information there.
13 Apr 2020 by Rick York
The problem is you are including source code files. Those are supposed to be compiled separately and then linked together. The error is because the source files included, EncryptData_Initial.cpp and DecryptData_Initial.cpp, are likely to also...
5 May 2020 by CPallini
You know we will not do your homework for you. The right approach is: try (harder) yourself and post here only specific questions.
26 Oct 2020 by deXo-fan
Hello, Well, the title of this question is perhaps self explanatory, but at the same time I already know the answer to that question is "No". So allow me to elaborate my question and goal a bit. There used to be a 12-byte integer type in C++ a...
26 Oct 2020 by Patrice T
Quote: There used to be a 12-byte integer type in C++ a few years back, at least in Microsoft's compiler. But even then that didn't make sense, because as you know, C++ is converted to Assembly code, and the two largest integer types in Assembly...
9 Nov 2020 by Sandeep Mewara
Quote: I tried to search on internet but i couldn't find examples Not sure what you searched for. Didn't knew something like this was there and thus googled out of curiosity. Example: 8086 program to find the factorial of a number -...
10 Nov 2020 by CPallini
As mentioned in the requirements, you have to use nested loops. Try, for instance .data InArr: .word 0x0eeeeeee 0xeeeeeeee 0xeeeeeeee 0xeeeeeeee 0xeeeeeeee 0xeeeeeeee 0xeeeeeeee 0xeeeeeeee .text .globl main main: li $s4, 8 # outer loop...
4 Jan 2021 by Dave Kreskowiak
This is not a code conversion service. You have to do the work yourself. It looks like you're going to have to learn MIPS assembly language.
12 Jul 2021 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
23 Oct 2021 by OriginalGriff
Or just lw $s2, $zero Which avoids any arithmetic at all.
10 Dec 2021 by Richard Deeming
As I suspected, the problem is that your unmanaged code is running outside of the fixed blocks, so the CLR is free to move the memory around. The pointer you pass in will be pointing to the wrong thing. Since you can't await inside a fixed...
27 Jan 2022 by OriginalGriff
This is not a code conversion service: we are not here to translate code for you. Even if we did, what you would end up with would not be "good code" in the target language – they are based on very different frameworks, and what makes something...
27 Jan 2022 by CPallini
For such a task you clearly don't need assembly at all, so, I assume it is homework. In order to fulfill it, you should first gain knowledge of the assembly language featured by your own arduino board (probably AVR, see: AVR Instruction Set...
26 Oct 2023 by Tasos Kipriotis
A quicker way to calculate the partial sum of binomial coefficients
5 Jan 2024 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
6 Jan 2024 by Mike-MadBadger
Given that you already have a partial answer to the three address machine case then this is what I would expect from you (adapted for the processor architecture in question) : LOAD A, R1 LOAD B, R2 ADD R1, R2, R3 MUL R3, R3, R4 LOAD C, R5 MUL...
6 Jan 2024 by OriginalGriff
We can't tell you: there is no generic law that states that an imaginary stack-based machine must use operands in any specific order: either order is possible, and it will depend on the way the stack machine was defined: though generally speaking...
12 Jan 2024 by OriginalGriff
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for...
9 Apr 2015 by Member 11591622
I am trying to write a program that takes two non-negative numbers from the user and raises the first input to the power of the second input. I am struggling a bit with this problem...but I have worked out some, unfinished code:Power = """00 read r1 #get n01 read r2 #get...
9 Apr 2015 by BacchusBeale
One algorithm would be get integers A and B.make power be P=1while A is not zeroP= P times BA = A - 1print P
28 Apr 2015 by Sergey Alexandrovich Kryukov
It is not possible to execute arbitrary 8086 code on Linux, you would need a virtual machine with simulation of some real-mode system, such as DOS, as a guest OS. This is not a question; there is nothing reasonable in this post. Of course, you can use assembler itself on Linux:...
27 May 2015 by OriginalGriff
"The question I asked is an assignment question of Computer Graphics course but I'm unable to answer it due to not knowing Assembly language.""In our class We have been taught C and then Assembly languages. But I didn't learn it"So...you didn't bother and now you want us to pull your...
11 Jun 2015 by rudy-peto
I am trying to add two number, because of the adding result is in ASCII, I added 'AAA' to correct the result, but i can't print the result which is store in AL on screen because I need Interrupt 21-service 9 to print. Then I copy AX to DX, but it doesn't work.. What's wrong?ORG 100hMOV...
11 Jun 2015 by Richard MacCutchan
You do not have a string reference in DX; you should be using service 02h as described at http://spike.scu.edu.au/~barry/interrupts.html#ah02[^].
24 Jun 2015 by rudy-peto
Hi! I need to add two numbers and return the result in number (decimal) not hex or binary or char. I am using emulator8086.I've done something like this:org 100hmov al,6mov bl,5add al,blmov dl,almov ah,02hint 21hint 20hThe result is in a character. Then how do I get an...
24 Aug 2015 by Coder1999
Hello. I can't find where the Nativewifi reference is in visual studio. Does someone know what reference NativeWifi is part of?
8 Sep 2015 by chandrAN2&
I am working on a ARM xscale board, where for data abort exception there is an exception handler which is getting executed in the task context. Is this correct?whenever an abort happens,cpu will switch to Abort mode and use a separate stack and the handler will be executed in context similar...
29 Oct 2015 by Jochen Arndt
Declare a data storage reserving the amount of memory (max. string length). You did not specify the assembler you are using but according to http://logos.cs.uic.edu/366/notes/mips%20quick%20tutorial.htm[^] it might be: .datastring1: .space 40 # max. length for string1...
29 Oct 2015 by Richard MacCutchan
See http://www.cs.umd.edu/class/sum2003/cmsc311/Notes/Mips/dataseg.html[^], or the documentation for whichever assembler you are using.
30 Oct 2015 by amin.j
I want to write this code: y= 0.4*x+1 but I have some errors in MIPS assembly[Edit - Added from comment]I have an integer value in register $t1 and I want to multiply it with 0.4 but it has error in the second line:li.s $f0, 0.4mul.d $f1, $f0, $t1mfhi...
30 Oct 2015 by amin.j
I would like to ask how I can do floor and ceil functions in MIPS assembly??
11 Dec 2015 by OriginalGriff
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.Try it yourself, you may find it...