Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

For questions about Assembly Language in general. Also use the appropriate processor's tag.

21
votes
3answers
1k 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 ...
12
votes
2answers
384 views

Early 65C816 CPU's SEP and REP instruction are followed by a NOP?

Why did early versions of the 65C816 CPU need a suffixed NOP to every SEP and REP instruction? I saw comments in some source code pointing at this. Looking around in official WDC's documentation and ...
3
votes
1answer
260 views

How does JSR actually work on the 65c816 CPU for the SNES (Super Nintendo)?

Take the following machine code for the 65c816 for the SNES (Super Nintendo): 00000000 ea ea 78 18 fb c2 18 a2 ff 1f 9a 20 fa 80 e2 20 |..x........ ... | 00000010 a9 80 8d 00 21 a9 e0 8d 22 21 ...
13
votes
8answers
582 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 ...
14
votes
2answers
457 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, ...
1
vote
2answers
179 views

Mysterious things happening to stack when running a debug session

When I run a debug session using Freedos and debug.exe, I get a session like the following. I've added a description of what I saw as annotation on the image. Each step, I've printed out the stack ...
9
votes
1answer
223 views

Can we express the instructions to the Analytical Engine in terms of assembler or machine code?

On a recent trip to the London Science Museum I saw Babbage’s Analytical Engine. Apparently this had an ALU (or equivalent). I can build an ALU out of logic gates but I can’t conceptualise how to do ...
11
votes
3answers
350 views

Motorola 6809 two stacks design

I'm an assembly newbie, but I'm curious about why the designers of the 6809 choose to use 2 stack in the microprocessor architecture. What is their original intent? The Wikipedia page says "a user ...
33
votes
4answers
10k 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 ...
1
vote
2answers
126 views

(How) can I safely use direct addressing for machine code routines on the Epson HX-20?

I am working through the exercises of Lance Leventhal's 6800 Assembly Language Programming on my Epson HX-20. My understanding is that the HX-20's Hitachi 6301 processor is compatible with the ...
0
votes
1answer
251 views

Why did this Hitachi 6301 assembler routine only work once?

I am trying to learn assembler on the various retro machines I own, or am about to buy. Today I tried converting this 8080 routine (which worked, repeatedly): | START: | MVI A,0 | 8000 | 3e | | ...
3
votes
2answers
740 views

Best path to learn C64 assembly [closed]

The amount of tutorials, youtube videos, scanned books on C64 programming is overwhelming. What materials would you recommend -- and, importantly, in what order! -- to build a path to programming my ...
7
votes
3answers
336 views

Is there a way to link object files for DOS from Linux?

I'm able to use NASM to assemble simple COM files from my modern Linux computer, but how can I create a DOS EXE file while still in Linux? Specifically, I am interested in a solution that will target ...
11
votes
3answers
525 views

z80 crashes after executing some instructions

I'm building my own Z80 computer but I'm having a very strange problem. Consider this code: ld a,0xaa out (00),a jp a That works as expected, outputting 0xaa on port 0x00. Now consider this code: ...
27
votes
2answers
3k views

Why are first four x86 GPRs 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 ...
6
votes
2answers
347 views

Unsigned addition on the 6502

I am currently playing around with pointer and indirect addressing on the C64 and I encountered a problem with the ADC opcode. I am trying to increment a number repeatedly and when it overflows (goes ...
7
votes
3answers
882 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 ...
6
votes
4answers
666 views

How were interpreters loaded into computers?

I have been learning about PCs, the first of which was the Altair 8800. So that users could run programs, Micro-Soft created a BASIC interpreter to allow the program to be mapped to processor ...
11
votes
1answer
260 views

Sprites not rendering correctly before $2000

I am currently testing out some stuff in assembly with C64Studio and Vice and I noticed something with odd sprites. My code starts at $1000 and my sprites at $2000 but when I try to lower the first ...
47
votes
12answers
11k 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 ...
4
votes
1answer
252 views

Can someone help me get xROAR to read files? (M6809/TRS-80 ColorComputer)

I implemented a Forth interpreter or the TRS-80 Color Computer (M6809) way back in the 1980s, and I've been trying to figure out how to get it loaded into an emulator to test some parts of the ...
9
votes
2answers
318 views

Is the software available to simulate building a computer from the ground up? For example a system based on the 6502 [closed]

I recently got me head round the basics of how a CPU works after watching Ben Eaters 8bit bread board computer series of internet videos. Now I am hooked and i want to take my understanding further. ...
10
votes
2answers
615 views

What is the origin of different styles of assembly language mnemonics?

As exemplified in answers to this question (I hope that closed questions that are linked to, don't get purged), the instruction mnemonics in early assembly languages had a 1-to-1 correspondence to the ...
6
votes
2answers
790 views

Why the “jmp” instruction is not working?

I have written the following program in debug.exe: 1165:0100 mov ah, 09 1165:0102 mov dx, 107 1165:0105 int 21 1165:0107 db 'Hello World', 0A, 0D, '$' 1165:0115 jmp 1165:0100 However, when I ...
10
votes
1answer
1k views

How to write directly to video memory in MS-DOS?

The base address for the video memory in MS-DOS is 0xB8000. I am trying to write to this address using debug.exe, but I am getting an error: 1165:0103 mov [b8000],ax ^ Error
-5
votes
4answers
406 views

What is the starting address pointed by Stack Pointer in PDP 11?

To which memory location does the stack pointer point at the beginning of the program in PDP 11? And what can be the end address the SP can point to before overflow occurs?
9
votes
1answer
238 views

How many bits are stored in a memory location in a PDP-11?

PDP-11 is said to be word addressable, which means every data access returns 16-bit data. Suppose I give a read request for address 100 in memory. Will it return 8 bits (LSB) from address 100 and ...
0
votes
3answers
510 views

Does anyone have the source code of an early program written in Assembly? [closed]

I am interested in looking at the source code of any program that was written in Assembly just about when the Assembly language was invented. If anyone have a source code for such a program, please ...
9
votes
1answer
109 views

cbm prg studio for the Amstrad

CBM prg studio is brilliant. I have searched Google for a version (or something similar) for the Amstrad CPC 464, to no avail. Does anyone know of one?
33
votes
1answer
2k 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-...
13
votes
2answers
631 views

How could high level functions with return values map to 6502 assembly? (if at all possible)

What sort of code could be used to substitute a high level function with a return value to a 6502 subroutine? Take this C-like function for example. byte func(byte a, byte b, byte c) { d = (a + b)...
11
votes
3answers
498 views

How does 6502 machine code process $ (address) VS #$ (value)?

How does the 6502's machine code process $ vs #$, as in it's assembly language? Does every piece of machine code have an extra byte or something telling to use addresses or values or was it something ...
75
votes
7answers
25k 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 ...
12
votes
3answers
3k 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 ...
16
votes
9answers
4k 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?
8
votes
3answers
320 views

Arithmetic operations on multiple words on the PDP-8

For the PDP-8 with its strange ISA, I've always wondered what the "standard" (i.e. fastest) way to do arithmetic operations (add, subtract, maybe multiply) on integers consisting of multiple words was....
13
votes
1answer
479 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: ...
7
votes
3answers
372 views

Was The Telemark Assembler available for the Unix or Mac Environments?

I'm trying to build the recently released Infinity Game Boy Color source code on my macOS El Capitan box. The original development environment was a Windows box, and I'm trying to modify the build ...
11
votes
1answer
309 views

8080/8085 Instruction Test Suite

(This question was inspired by Comprehensive test suites for MOS 6520 PIA / 6522 VIA / 6526 CIA) Is there a comprehensive test suite for the Intel 808X series of processors? Something that would ...
41
votes
6answers
3k 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 ...
8
votes
2answers
558 views

Intel 8080 Read/Set Interrupt Mask Instructions

According to Intel's 8080-8085 Assembly Language Programming guide, the OP Code 20 corresponds to the Read Interrupt Mask (RIM) instruction, and 30 corresponds to the Set Interrupt Mask (SIM) ...
51
votes
7answers
11k 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, ...
8
votes
3answers
766 views

What Commodore 64 emulator and assembler to use? [closed]

I'm about to do some assembly coding for the C64 but for sanity I would like to do the actual coding on my Mac with an emulator. My question is; which is the most maintained/up-to-date emulator/...
21
votes
5answers
1k 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,...