Questions tagged [assembly]
Assembly languages in general, of any architecture. Use with the particular processor’s tag as appropriate.
230
questions
95
votes
7
answers
29k
views
Why would a NES game use an undocumented 1-byte or 2-byte NOP in production?
Reading the NESdev wiki page on CPU unofficial opcodes, I see a few games use an undocumented 2-byte NOP instuction in production: Puzznic, F-117A Stealth Fighter, and Infiltrator use $89 #i. Beauty ...
87
votes
9
answers
15k
views
Why is the processor instruction called "move", not "copy"?
Many processors have an instruction called "move" (sometimes spelled MOV) which copies data from one location (the "source") to another (the "destination") in registers and/or memory. It does not do ...
71
votes
3
answers
14k
views
Why did DOS use dollar-terminated strings?
According to a few tutorials I am seeing, DOS used dollar-terminated strings to write to the terminal. This seems to also be documented here on INT 21H.
AH = 09h - WRITE STRING TO STANDARD OUTPUT
...
64
votes
13
answers
16k
views
Were later MS-DOS versions still implemented in x86 assembly?
Recently, Microsoft published the source code of old MS-DOS versions on GitHub.
What is odd in my opinion is the use of x86 assembly language for everything. The assembly language would not be my ...
64
votes
1
answer
7k
views
How did the SNES do the “pixelate” transition effect?
This effect is seen in many SNES games, including Super Mario World. The effect pixelates the screen, and makes the pixels larger, then smaller again when it switches to another scene.
It is done so ...
63
votes
7
answers
11k
views
Why did the MS-DOS API choose software interrupts for its interface?
Access to the DOS API was done through the INT 21h x86 instruction. This was always counter-intuitive to me, coming from 8-bit systems that accessed system services by calling subroutines through a ...
61
votes
8
answers
9k
views
Are there any modern compilers that can generate Amiga/m68k executables?
I would quite like to resurrect my openkick project. As I note on that project's README.md, it is stalled because GNU GCC is not fit for purpose.
Sadly, there do not seem to be any other modern ...
54
votes
7
answers
12k
views
Why use static RAM addresses instead of the stack?
I'm studying the 65c816 assembly for the 1994 game, Super Metroid.
A hobbyist studied the game in-depth and created a RAM map. From it:
7E:0B56 - 7E:0B57 Moves Samus this distance horizontally, ...
53
votes
12
answers
13k
views
How was the first assembler for a new home computer platform written?
How did the 8-bit computers (Spectrum, Commodore, Atari, Amstrad etc) typically "bootstrap" from bare electronics into a platform with a working assembly language and OS?
What I mean: An assembler is ...
48
votes
4
answers
7k
views
Why are first four x86 General Purpose Registers named in such unintuitive order?
On x86 the first four general-purpose registers are named AX, CX, DX, BX. It would be quite intuitive if their indices (those used in instruction encoding) were in alphabetical order, but instead of ...
46
votes
2
answers
6k
views
What computer system is this from 1984 Doctor Who?
In the 1980s, the popular BBC science fiction series Doctor Who used some real computer system(s) to display impressive (for the time, OK, maybe not!) graphics. They actually ran the software real-...
41
votes
12
answers
8k
views
When did assembly source code begin to be written in lowercase?
In nearly all the assembly source files and published listings I read up to the early 1980s, the labels, mnemonics, and operands were written in all uppercase. Just a few years later, I noticed 80x86 ...
39
votes
14
answers
9k
views
What "unusual" syntax assembly languages are/were there?
This question may have the apparent form of a question soliciting a "list" answer, but I'm expecting the list to be very short, so please bear with me.
What "unusual" syntax assembly languages are/...
39
votes
4
answers
21k
views
Who is credited for the creation of Assembly Language?
The C Programming Language was originally developed by Dennis Ritchie who also co-designed the Unix operating system with which development of the language was closely intertwined.
Is there a ...
38
votes
3
answers
5k
views
Why are assemblers called assemblers?
We tend use the term assembler as if there is a fundamental implication of being different from a compiler. This disparity is usually taken as a fact, no matter how sophisticated or primitive either ...
37
votes
9
answers
9k
views
When and why did high-level language compilers start targeting assembly language rather than machine code?
From what I've read, the first FORTRAN compiler built a machine-code program entirely in memory; it was, in fact, designed to read the entire source code of the program, and then sequentially load ...
33
votes
6
answers
12k
views
Which was the first programming language that had data types?
Machine language (and Assembly language) don't have the concept of data types, so if you want to add an int and a float variables in Assembly, you have to use the appropriate Assembly instruction that ...
31
votes
6
answers
3k
views
Managing registers/memory effectively on the Z80
I've been writing assembly for the Z80 for some time, lately. Initially, I had no experience with working with 8-bit processors, but after going through a tutorial for my platform and spending a lot ...
31
votes
3
answers
6k
views
Why didn't the 6502 have increment/decrement opcodes for A?
In 6502 Assembly, we can use INX and INY to increase the value stored in X and Y. They can be decreased with DEX and DEY. However, it seems that there are no such instructions for A, like INA or DEA. ...
29
votes
9
answers
11k
views
How did early x86 BIOS programmers manage to program full blown TUIs given very few bytes of ROM/EPROM?
I've always wondered how so much functionality and relative luxuries(CMOS Configuration Utilities. See: https://geekprank.com/bios/ for an example) included with most popular x86 BIOSes could be ...
26
votes
3
answers
4k
views
Why are the Intel 8080's rotate instructions called opposite to intuition?
The Intel 8080 has two pairs of instructions for rotating the value of the accumulator -- RLC/RRC and RAL/RAR.
One of them shifts the 8 bits in the accumulator circularly, writing out into the carry ...
24
votes
11
answers
11k
views
Why weren't 80s arcade games programmed in C?
I know many arcade games from the 80s were programmed in 68000 assembly. This carried on probably well into the 90s, even though Motorola C compilers existed in the 80s. Why then weren't C compilers ...
24
votes
4
answers
4k
views
Why are branches relative in many 8-bit CPUs?
I was looking over an old article on the 6809 and was perusing the opcodes and noticed that the branch instructions came in two flavors, long and short. That sparked a memory about one of the 6502-...
24
votes
5
answers
3k
views
How much benefit should be expected on a more advanced compiler for z80/r800 based computers?
I am self studying about compilers, and get hands on very good textbooks about the subject. I am thinking in develop a compiler using the almighty llvm infrastructure to cross compile to old computers,...
24
votes
1
answer
2k
views
Where can I find the debate around snow-free screen updates mentioned in the Zen of Assembly Language?
Michael Abrash's book Zen of Assembly Language: Volume I (1989) contains a reference to a column in a computer magazine, though the actual source is not cited.
From the text:
I recall a debate in the ...
23
votes
12
answers
7k
views
Was memory corruption a common problem in large programs written in assembly language?
Memory corruption bugs have always been a common problem in large C programs and projects. It was a problem in 4.3BSD back then, and it's still a problem today. No matter how carefully the program is ...
23
votes
2
answers
2k
views
What are these tiny TSRs doing?
I've been puzzled by this for a while now. The (very old) game Phantasie comes with three small TSRs that are run prior to running the main game executable. This is the content of the file PH.BAT, ...
22
votes
5
answers
9k
views
Will PC-DOS run faster on 4 or 8 core modern machines?
When I run PC-DOS on my 4 core AMD Phenom chip, does it take advantage of the extra parallel CPU's? If not, is there a way to coax DOS to use all available CPU's or does this require specific ...
22
votes
3
answers
4k
views
Was there any automated unit testing prior to 1972?
Prior to 1972, was there any automated unit-testing? Did any assemblers include a testing a framework?
I can find some academic journals on this topic from the late 70s -- most of which I don't have ...
22
votes
3
answers
6k
views
Why are these DOS console drivers wasting precious bytes?
While doing some research on DOS device drivers, I took a peek at the console drivers DISPLAY.SYS and ANSI.SYS that are part of the DOS 6.20 installation. Both have "Microsoft" stamped on, ...
22
votes
3
answers
6k
views
What makes MOVEQ quicker than a normal MOVE in 68000 assembly?
I'm "re-learning" 68000 assembly language and came across the "MOVEQ" command that is labeled "MOVE QUICK".
According to the NXP Programmers Reference Manual (reference below), the command MOVEQ (...
22
votes
2
answers
1k
views
Where and when did the ".s" suffix for assembly-language source files originate?
The closest I was able to find on StackOverflow is What are .S files?, in which no answerer addresses why we use .s for assembly. (And .S for preprocessor/macro assembly; and gcc -S to produce ...
22
votes
1
answer
1k
views
When did the IBM 650 have a "Table lookup on Equal" instruction?
In 1959, Donald Knuth wrote an assembly program named SuperSoap for the IBM 650. Here is the manual, and here is a listing of the program (in SuperSoap assembly language). Quoting from the abstract:
...
21
votes
8
answers
11k
views
Uses for the halt instruction?
What was the halt instruction in early CPUs such as the Z80 and 8080 used for?
Here's a description of the Z80 instruction:
The HALT instruction suspends CPU operation until a interrupt or reset ...
21
votes
3
answers
3k
views
Z80 to x86 asm translator?
8086 is source code compatible with 8080. Zilog Z80 extended Intel 8080 with:
An enhanced instruction set including bit manipulation, block move, block I/O, and byte search instructions
New IX and IY ...
21
votes
3
answers
2k
views
Why use repeated STZ instructions with the same operand on the 65C816 for the SNES (Super Nintendo)?
Please consider the code in Super NES Programming/Initialization Tutorial/Snes Init.
Here is an excerpt:
stz $2113 ; Plane 3 scroll x (first 8 bits)
stz $2113 ; Plane 3 scroll x (last ...
20
votes
1
answer
2k
views
How can I set up the Microsoft C compiler to make it prefer immediate-mode push instructions?
I started a project to get a better understanding on how to compile a game for Windows 3.x. I tried to set up the build workflow so that it produce the byte-exact clone of a great open sourced Win16 ...
19
votes
12
answers
6k
views
Did early assembly games use hardcoded memory locations?
In the era of C64, Apple][ GS, and SNES, did the games use hardcoded memory locations, or did they let the assembler help them (like modern assemblers)? If yes, how did they manage the memory?
18
votes
6
answers
7k
views
How slow was the 6502 BASIC compared to Assembly
Imagine a modern computer, where let's say Python is a high level programming language and needs to be interpreted in order to execute a piece of code. You could write some code in C, compile it, ...
18
votes
3
answers
2k
views
6502 ORA not updating the accumulator
Unless I'm reading the manual incorrectly, the following should produce $11 when D404 = $10 (I'm turning on the gate for voice1 which has been previously set to triangle wave %00010000/$10)
00153 ...
18
votes
5
answers
5k
views
Was Family BASIC for the NES/Famicom powerful enough to create full games and applications?
"Family BASIC or Famicom BASIC is the consumer product for programming
Nintendo's Family Computer video game console of Japan."
wikipedia
I can't seem to find much info about Family BASIC ...
18
votes
3
answers
2k
views
How to use the "darker" CGA palette using x86 Assembly?
For those of you retro developers out there, I am having a hard time figuring out how exactly to select the "darker" color palette in 320x200 CGA mode. Here's what I have so far:
setup_cga_graphics:
...
18
votes
2
answers
3k
views
Meaning of $ and $$ in Modcomp assembly language
The Modcomp II was a 16-bit minicomputer circa 1970. As well as in FORTRAN IV, the Modcomp family could be programmed in assembly language, with syntax like this excerpt from Kermit for Modcomp:
...
17
votes
3
answers
2k
views
Why can't I invoke the next interrupt service by incrementing the AX register after calling the same interrupt?
I have two snippets of 8086 assembly code, both of which are supposed to do the same thing: make the mouse appear on the screen.
Show_Mouse:
push ax
mov ax,0 ;Reset Mouse
int 33h
...
17
votes
2
answers
6k
views
What does "jmp *" mean in 6502 assembly?
Right now I am learning 6502 assembly. Currently I am using the MADS assembler to program for the Atari 800. This program is just a small tutorial program that came with the assembler zip file I ...
17
votes
5
answers
2k
views
Has there ever been a instruction set architecture that did not require instruction decoding at all?
I am studying basic principles of instruction set architectures and am considering what it would take to not have any instruction decoding at all. I.e., all the control lines of the computer would be ...
17
votes
4
answers
7k
views
MSX Assembly/Basic programming documentation
I'd like to try to create software (and maybe simple games) for the MSX standard.
I know I have two ways to do so, either I use MSX Basic or Z80 assembly. I think that Z80 assembly is more powerful ...
17
votes
3
answers
4k
views
Does this 1978 code for a 6800 really clear ALL of memory?
On page 43 of the October 1978 Dr. Dobb's Journal (reprinted in Volume 3 Page 425 Issue 10 Number 29) is a letter to the editor giving three 6800 routines to clear ALL of memory, stating...
Routine ...
16
votes
12
answers
8k
views
How can a Z80 assembly program find out its own memory address?
I'm wondering how to write a program in Z80 assembler that discovers its own memory location.
I thought that maybe I could somehow load the program counter PC into, for example, BC.
Is there a way ...
16
votes
4
answers
2k
views
Is it possible to detect a CGA card on an IBM PC 5150 by write/reading the Motorola 6845?
I am trying to programatically detect the CGA card on old IBM 5150-ish PCs.
The Paku Paku game source code doesn't directly detect it. The strategy is to detect VGA, EGA, Tandy, PCJr, etc etc, then if ...