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
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
861 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
302 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,247
0 votes
1 answer
179 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
408 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
139 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,558
5 votes
5 answers
385 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,247
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 ...
24 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 ...
  • 343
6 votes
1 answer
304 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 ...
37 votes
3 answers
4k 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 ...
  • 184k
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
352 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
322 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
426 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 ...
21 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
220 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
535 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 ...
  • 669
63 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
339 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
203 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,558
1 vote
1 answer
217 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,558
1 vote
1 answer
268 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,558
1 vote
1 answer
280 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,558
1 vote
0 answers
106 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,558
4 votes
0 answers
267 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,558
5 votes
1 answer
267 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,558
25 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 ...
  • 351
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,558
6 votes
2 answers
594 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,558
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
1k 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,558
0 votes
2 answers
192 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
350 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
305 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,437
4 votes
2 answers
606 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,558
4 votes
2 answers
244 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
315 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. ...
  • 515
18 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,558
4 votes
1 answer
289 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
384 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: ....
11 votes
3 answers
2k views

Protecting 6502 decimal mode code from interrupts

A common idiom in 6502 assembly code is to protect sequences of code that rely on decimal mode from being interrupted. This because an interrupt handler typically clears decimal mode (cld), and thus ...
  • 58.5k
1 vote
1 answer
91 views

Is there a way to use .ident or * (PC) in numeric macro variables (using .set)?

I'm trying to write a macro to create "headers" in a linked list fashion. In each header the first 2 bytes should be the address of the previous header starting address (0000 in the first ...
7 votes
1 answer
1k views

The proper way to shift a byte using a Z80

In a nutshell, why can I not shift a byte using this way? LD A, 11110000b ; I want this to be 00001111b LD C, 4 SRA C OUT (0), A ; doesn't give correct number What is the proper way of shifting a ...
6 votes
1 answer
376 views

How does an 8086 CPU remember the memory address where it should write back the operation’s result? [closed]

I have an instruction: ADD [BX][SI] + 5FFDH, EABFH and I want to know how it operates exactly on 8086 microprocessors. I've realized that this instruction ADD [BX][SI] + 5FFDH, EABFH, works in this ...
4 votes
2 answers
281 views

Cannot assemble BASIC with high memory workspace (Z80)

This is a homebrew Z80 computer, using Z80, 64K RAM, EEPROM as well as SIO/0. I am trying to run BASIC, however I need to set the workspace at 0xC000 or higher. The code I am using is similar to https:...
  • 351

1
2 3 4 5