Questions tagged [assembly]

Assembly languages in general, of any architecture. Use with the particular processor’s tag as appropriate.

Filter by
Sorted by
Tagged with
30 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 ...
  • 393
4 votes
0 answers
163 views

IMPI Instruction set: is there any reference?

I've had an IBM 9404 B-10 for some time and I'm curious about its assembly language. I'm fully aware the AS lines were designed with portability in mind as much IBM didn't seem to provide assembly ...
6 votes
2 answers
189 views

6502 Assembly on Apple IIe: GETLN fails with 'syntax error' under ProDOS

I'm writing a text adventure in assembly for the Apple IIe (using Merlin). I'm also using ProDOS 8 v2.0.3. At some point, I have a subroutine to read user input from the keyboard using the GETLN1 call....
3 votes
1 answer
320 views

Is RosAsm assembler self-hosting?

I have a few questions about the RosAsm assembler (not in active development anymore) by René Tournois: Is/was there a command-line tool (i.e. without a GUI) included to generate executable programs ...
  • 1,335
15 votes
4 answers
1k views

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

I'm writing a NASM-compatible assembler targeting the Intel 8086, and I'm looking for an existing open source program written in assembly, with which I can showcase the capabilities (and understand ...
  • 1,335
10 votes
3 answers
1k views

How to write text in MODE 0x13?

I have read How to write directly to video memory using "debug.exe" in MS-DOS? and I know how to write text to video memory in mode 0x3 but I can't figure out how to write text to video ...
9 votes
11 answers
893 views

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

I want to get into programming on old MS-DOS systems, before then going to older DOSs like CP/M. However, while programming for MS-DOS I'd like to also use era-appropriate software, both for the ...
7 votes
1 answer
391 views

Why didn't the CP/M-86 assembler support traditional macros?

The ASM86.CMD assembler Digital Research shipped with CP/M-86 provided only code-macros, a limited type of macros for creating new instructions through a small set of specific directives. Why didn't ...
24 votes
1 answer
1k 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 ...
  • 1,267
0 votes
1 answer
202 views

Apple II mixed mode cursor placement

I've been playing on my recently resurrected Apple IIs, a //e, IIc, and IIgs (mostly the //e), tinkering with assembly. I'm reading the paddles and plotting a colored block on the screen, kind of an ...
  • 93
8 votes
2 answers
2k views

Asking explanation of 65C02 assembler code

From Gary B. Little's "Apple ProDOS: Advanced Features for Programmers", pages 176 - 188: "Since the ONLINE command handler is not inherently relocatable, all references to internal ...
  • 93
6 votes
2 answers
425 views

SciTech's SVGAKit seems to be incomplete

I'm trying to get into MS-DOS development for fun, and I'd like to use SciTech's SVGAKit library. The last version of it is still downloadable via the Internet Archive here. However it seems to be ...
  • 211
2 votes
0 answers
155 views

Using the (An)+ to Memory addressing mode when address register is pointed to ROM causes Sega Genesis DMA to fail

This is a weird one, and I haven't found it documented anywhere. I was testing Sega Genesis DMA during scanline interrupts and found something very odd. When writing to VDP_CTRL to initiate DMA, if ...
  • 1,566
5 votes
5 answers
417 views

Chaining IRQs in x86 ROM code

Objective Summary: I need to write a sleep() function to be used in 8088 (PC/XT ISA) ROM code with 1 ms resolution. Though the question can be more generalized to chaining INTs with data in different ...
  • 1,267
15 votes
3 answers
2k views

Running CP/M on my own Intel 8080 emulator

I recently finished writing an emulator for the Intel 8080, having passed all of the usual test suites, and wanted to try running an actual OS on it (such as CP/M). I'm aware that I would have to ...
25 votes
3 answers
3k 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 ...
  • 353
6 votes
1 answer
369 views

How do I read a port value using Turbo Pascal inline code on CP/M?

After successfully using port[0] to read a port value in Turbo Pascal, I thought I'd try to understand how to do this using inline assembly/machine code. I'm able to write to the port (my OutPort ...
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 ...
  • 195k
10 votes
3 answers
2k views

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

So I am really just starting out in my assembly coding adventure. I have a little bit of knowledge of C/C++ but nothing too advanced yet. But I also used to do a tiny bit of Z80 assembly, and I wanted ...
-4 votes
1 answer
382 views

If I build a new CPU architecture, how would an OS like Linux know how to run it? [closed]

I am trying to build a CPU from scratch (from NOR gates) in an emulator first, then on breadboard. (Inspired by nand2tetris and Ben Eater) Just trying to understand how things work. Now, as my CPU ...
2 votes
2 answers
344 views

From an electrical and software engineering perspective, ignoring available software, should I go for the Z80 or 65C02? [closed]

This might be a weird title but I noticed that recommendations for one over the other usually go into a direction that is not too helpful for me. I would like to build an 8 bit computer and picked ...
  • 29
7 votes
1 answer
444 views

PDP 11/70: how does MTPI work?

I'm trying to understand the MTPI (and its MFPI counterpart) instruction on the PDP/11. As far as I understood, it: it retrieves a value from the "current" memory space with the current ...
22 votes
3 answers
5k 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, ...
0 votes
1 answer
234 views

getting PDP-11 DL11 output via telnet

I'm trying to run the (a slightly adapted version but the original gives the same problem) example program from How to implement a 'write' function in pdp-11 / MACRO-11 / ODT using simh? in ...
7 votes
2 answers
595 views

Any recommendations for a Hitachi HD6303 assembler?

Does anyone have any good recommendations for a Hitachi HD6303 assembler? I've been working on a project to reverse-engineer an executable made for a Hitachi HD63B03 processor. I've finished the first ...
  • 779
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 ...
36 votes
11 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 ...
5 votes
1 answer
379 views

Z80 CPU and nested/reentrant NMI

According to multiple documentation sources, non-maskable interrupts (NMIs) can be nested (or reentrant) in a Z80 microprocessor. This is, upon a /NMI signal pulse, the CPU will interrupt the current ...
2 votes
1 answer
217 views

Timer B Interrupt occurs only once

I was following this tutorial on Commodore 64 timer interrupts and tried to replicate it (except all I was planning on doing was changing the border color.) I noticed that my interrupt only occurs ...
  • 1,566
1 vote
1 answer
236 views

Game assembled using RGBDS can't access cartridge RAM

Any writes I do to cartridge RAM on my test game assembled with RGBDS are silently ignored. I wanted to move the stack pointer to cartridge RAM to have more room in high ram to use as a scratchpad, ...
  • 1,566
1 vote
1 answer
286 views

How does RETN return from NMI on the Z80 in the event of nested NMI?

I was trying to learn how the Sega Master System works. The NMI occurs when the pause button on the console is pressed. So I wrote an NMI handler that makes a beep when the NMI occurs, then waits for ...
  • 1,566
1 vote
1 answer
289 views

Can the window only be moved once per frame on the Game Boy?

I wanted to cover the top part of the screen to use as a status bar for a game. My idea was to use the Game Boy's window feature to do so. But I ran into a problem: The window's size is fixed to be ...
  • 1,566
1 vote
0 answers
109 views

Getting a loading seam to work with 2x2 metatiles

I'm working on a prototype for a scrolling loading seam similar to Pokemon where the screen scrolls incrementally by 8 pixels with each direction button press, and new tile graphics are drawn off the ...
  • 1,566
4 votes
0 answers
285 views

Game Boy interrupt handler crashes unless I jump to it indirectly

I have an interrupt handler I created, which is meant to reduce the overhead of interrupts as much as possible. Setting up the interrupt handler is done while interrupts are disabled, of course. It ...
  • 1,566
5 votes
1 answer
291 views

Can I use cartridge RAM for the stack pointer?

My understanding is that the extra cartridge RAM banks at &A000-&BFFF are battery-backed SRAM that is preserved after powering off the game. If I'm making a simple game that doesn't have a ...
  • 1,566
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 ...
  • 341
9 votes
1 answer
1k views

Why does the Z80 JP (absolute) instruction always take 10 states to execute?

I've looked at a few different websites and they all agree that a JP nnnn instruction (where nnnn is a 16-bit address) always takes 10 states to execute. According to what I've read, all of the ...
  • 1,566
6 votes
2 answers
671 views

How can I detect signed integer overflow on the Game Boy?

Unlike a normal Z80, the Game Boy has no CALL pe/po, JP pe/po or RET pe/po instructions. I've been trying to figure out how to detect integer overflow on the Game Boy. (It doesn't have those ...
  • 1,566
17 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 ...
  • 273
15 votes
2 answers
2k views

How to use "AND," "OR," and "XOR" modes for VGA Drawing

I've been trying to implement a blitter in MS-DOS, but before I do that I wanted to test the various graphics modes of the VGA graphics card. (I'm emulating using DOSBox.) According to this paper on ...
  • 1,566
0 votes
2 answers
199 views

why the result comes out as 1, rather than 2, in this 8086 Subtract with borrow? [closed]

STC MOV AL, 5 SBB AL, 3 ; AL = 5 - 3 = 2, but I am getting 1 .. why? RET
  • 23
5 votes
1 answer
357 views

Apple II Assembly DSECT

I'm trying to define a section of data in a program. The Apple 6502 Assembler/Editor mentions an assembler directive called "DSECT" but I can't tell if I'm using it correctly or not. Here is ...
  • 53
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 ...
9 votes
0 answers
343 views

Undocumented ModR/M byte combinations

The reason I am asking this question is because I was trying to compile a list of all 8086 opcodes, regardless of whether or not they are documented. The list is just for fun, the documented opcodes + ...
  • 1,729
4 votes
2 answers
670 views

How to wait for vBlank on Commodore 64

I'm not new to 6502 Assembly but I am new to the Commodore 64. I'm used to the NES where you have to write everything yourself, such as the NMI/RESET/IRQ vectors, etc, but from what I understand the ...
  • 1,566
4 votes
2 answers
270 views

Looking for NEC RA87 “Relocatable Assembler Package”

I admit, I am pushing my personal envelope (punching above my weight, beyond my pay-grade etc. etc.) on the trailing edge of technology. So please be kind! I would like to write new firmware for a NEC ...
  • 41
1 vote
2 answers
322 views

8086 assembly relative addressing issue [closed]

This tiny program puts a few A's into the text mode buffer of an ms-dos pc. But only works if the number of repetitions (CX) is loaded with a direct value. If I try to read that from memory, i.e. ...
  • 585
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 ...
  • 1,566
4 votes
1 answer
310 views

ZX Spectrum coordinates to bitmap conversion subroutine acting strange

I originally posted this question on stackoverflow, but I wrote a little program that converts coordinates stored in the b and c registers of the z80 into their corresponding memory address for the ZX ...
  • 43
6 votes
2 answers
396 views

Macro for counted string accepting multiple arguments?

Using ca65 assembler, I'd like to use a macro to encode a string as a pascal style string or FORTH counted string with a leading length byte. In ca65 documentation there is this example: ....

1
2 3 4 5