As of May 31, 2023, we have updated our Code of Conduct.
45 votes
Accepted

Managing registers/memory effectively on the Z80

It's quite a while since I did any Z80, but there's an important difference between classic Z80 systems and modern kinds of computer. Memory is fast. Unlike modern systems where memory accesses take ...
John Dallman's user avatar
  • 9,903
37 votes
Accepted

Why are the Intel 8080's rotate instructions called opposite to intuition?

What historical reason is there for these instructions being called that? "Historical Reason" is the right key word here, as ... TL;DR: It's Piled Up Heritage The 8080 inherited the ...
Raffzahn's user avatar
  • 199k
36 votes

Why are assemblers called assemblers?

The first use seems to be in "Wilkes, M. V., D. J. Wheeler, and S. Gill, The Preparation of Programs for an Electronic Digital Computer. Reading, MA.: Addison-Wesley, 1951". This book can ...
RETRAC's user avatar
  • 12.9k
32 votes
Accepted

Where can I find the debate around snow-free screen updates mentioned in the Zen of Assembly Language?

The discussion started with an article by Augie Hansen, Instant Screens, in the June 1986 issue of PC Tech Journal. That article describes the snow problem in detail, and presents a technique to avoid ...
Stephen Kitt's user avatar
23 votes

Why are assemblers called assemblers?

"Compile" appears to have taken over for "translate" as an informal synonym until the term translate wasn't needed anymore. "Assemble" is older than either term. The ...
John Skiles Skinner's user avatar
23 votes

Managing registers/memory effectively on the Z80

Well, there isn't a simple answer. It's a lot is more about philosophy than hard, Z80 specific advice, but let's look at some points: The most important thing about Z80 is maybe to forget that it's a ...
Raffzahn's user avatar
  • 199k
23 votes
Accepted

Help porting nasm code down from 386 to 8088 (shifts by more than 1 bit)

For sar and sal (and the other shift instructions), you need to use the cl register if you are shifting by more than one bit. So: mov cl, 4 sar al, cl
Greg Hewgill's user avatar
  • 6,387
21 votes

Where and when did the ".s" suffix for assembly-language source files originate?

I asked Ken Thompson. The s stands for source, because it was the only source at the time.
Russ Cox's user avatar
  • 311
21 votes
Accepted

Is it possible to detect a CGA card on an IBM PC 5150 by write/reading the Motorola 6845?

You can, in fact, relatively reliably and safe, detect a 6845 in your system by trying to write to a 6845 register and see whether you can read back the same value. I have successfully done that with ...
tofro's user avatar
  • 30.7k
20 votes
Accepted

How can I avoid overflowing R_SPARC_13 relocations when writing SPARC assembly?

SPARC instructions are 32-bit in size, so you cannot load a 32-bit pointer as an immediate in one instruction. This is typical of any RISC architecture. The alternatives are to split the immediate ...
matja's user avatar
  • 481
19 votes
Accepted

Running CP/M on my own Intel 8080 emulator

Sounds like you got to go the same way as any system manufacturer back then: Build your (virtual) Hardware. CPU, RAM, ROM emulation Some terminal connection And at least some (virtual) mass storage ...
Raffzahn's user avatar
  • 199k
18 votes
Accepted

Is there an equivalent of "#pragma once" in RGBASM (Gameboy DMG assembly language)?

Assembly language is typically not providing any safety nets or harnesses - so, in general, the answer would be "no". Assembly language is also not in any way standardized, especially in the ...
tofro's user avatar
  • 30.7k
18 votes
Accepted

How to write text in MODE 0x13?

In mode 13h you can't write character codes to video memory because the card is not in text mode where it renders character codes to pixel data for you, it is in graphics mode where it just outputs ...
Justme's user avatar
  • 25.6k
15 votes

Looking for an open source DOS .com program written in assembly

The small / tiny text editors section on Free software for DOS includes a few text editors provided with source code, such as SuperTed. They are all smaller than 10KiB, so they don’t quite fit your ...
Stephen Kitt's user avatar
15 votes

Help porting nasm code down from 386 to 8088 (shifts by more than 1 bit)

8086/8088 has imul but only in the one-operand widening form, just like mul where it does DX:AX = AX * r/m. Note that's r/m, not imm16, so you will have to mov your constant into a register first (...
Nate Eldredge's user avatar
13 votes

Towards people who were there, what programs did you use to develop applications for the IBM 5150?

Turbo Pascal 3.0. It is hard today to understand how much a revolution it was to go from something that required writing your source file to diskette, exiting the editor and running first the compiler ...
Thorbjørn Ravn Andersen's user avatar
13 votes
Accepted

Assembly delay function for C64

I would get something like this... Yes, all of them. The code may be fast enough to report a line multiple times, get all lines and miss some, all at once. It all depends on the machine setup, other ...
Raffzahn's user avatar
  • 199k
12 votes

Looking for an open source DOS .com program written in assembly

I wasn't going to post it as an answer, because I felt it exceeded the specified criteria, but I wrote a comment that the OP may enjoy testing their assembler on this actively-developed 8086 open-...
RockPaperLz- Mask it or Casket's user avatar
12 votes

Help porting nasm code down from 386 to 8088 (shifts by more than 1 bit)

https://pushbx.org/ecm/doc/insref.htm is a corrected + improved version of the appendix of the NASM manual that documents the CPU required for each form of each instruction, along with English ...
Peter Cordes's user avatar
  • 2,765
11 votes

Running CP/M on my own Intel 8080 emulator

You probably do not need to build CP/M from source. If you have a binary image you should be able to use that. But, you'll have to emulate the correct hardware for the build you have (since CP/M can ...
Greg Hewgill's user avatar
  • 6,387
11 votes

Is it possible to detect a CGA card on an IBM PC 5150 by write/reading the Motorola 6845?

The Paku Paku game source code doesn't directly detect it. The strategy is to detect VGA, EGA, Tandy, PCJr, etc etc, then if none of those "hit", assume it is CGA. Does it, or would MDA ...
Raffzahn's user avatar
  • 199k
11 votes

Is it possible to detect a CGA card on an IBM PC 5150 by write/reading the Motorola 6845?

If all the other adapters have already been detected to be absent from the system, the possible options are that there are no MDA or CGA adapter at all, there is either MDA or CGA adapter installed, ...
Justme's user avatar
  • 25.6k
10 votes

Why are the Intel 8080's rotate instructions called opposite to intuition?

It can't be helping your intuition that that the official descriptions from the 1975 Intel 8080 Assembly Language Programming Manual, p.21, use the word "carry" in the descriptions only of ...
cjs's user avatar
  • 23.9k
10 votes
Accepted

Asking explanation of 65C02 assembler code

These are the page parts of all absolute addresses within the program. The whole process is described in detail on page 177 of the book (third paragraph). The program is compiled to run at page $21 (...
Raffzahn's user avatar
  • 199k
9 votes

Asking explanation of 65C02 assembler code

The relocatable routine is assembled to $2100: =2100 112 CMDCODE EQU * Relocation is simplified by the CMDCODE routine only occupying one page and starting at a page boundary, ...
Nick Westgate's user avatar
9 votes

Are there any statistics or data showing how much more productive the C programming language is compared to x86 assembly language?

You'll never find a good single number for this sort of thing. One factor is that software time estimation is famously difficult in-general. Nobody has ever been good at estimating how long software ...
wrosecrans's user avatar
  • 2,094
9 votes

Assembly delay function for C64

Going from recollection, I got pretty decent results by waiting for line 0, then line 100 (pick a random, but different line) counting one frame, then repeating the cycle. I'd also have written the ...
Jerry Coffin's user avatar
  • 4,652
8 votes

Managing registers/memory effectively on the Z80

Raffzahn's answer is excellent. Having developed a software product at the time – I don't know how many thousands of lines of assembler but the program was huge, about 96KB in size – here are a couple ...
Martin Kochanski's user avatar
8 votes

Are there any statistics or data showing how much more productive the C programming language is compared to x86 assembly language?

TL;DR The productivity gain is in the portability of the "C" language relative to Assembly. I think you might have an unintended caveat in the question in referencing a specific dialect of ...
Brian H's user avatar
  • 59.5k
7 votes

Looking for an open source DOS .com program written in assembly

I've taken a look at all .com files of at least 6000 bytes on the FreeDOS 1.2 CD. Here is the list of programs written in assembly: 32935 NASM devel/insight.zip.ex/progs/insight/insight.com 27566 ...
pts's user avatar
  • 1,385

Only top scored, non community-wiki answers of a minimum length are eligible