Questions tagged [assembly]

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

Filter by
Sorted by
Tagged with
8
votes
2answers
461 views

Trying to understand some assembly syntax in the Unix v7 write system call

so here is the code: (which comes from here, I've also verified this source is in my unix v7 distribution). For reference, this is running on a PDP-11 simulated with the simh program (so please keep ...
4
votes
1answer
438 views

Z80 PIO Keyboard

I am working on designing a Z80 computer and I would like to use a PS/2 Keyboard for input. I would like to use a PIO to communicate with it, but I am having trouble finding any documentation online ...
9
votes
4answers
1k 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 ...
2
votes
1answer
196 views

How to implement a 'write' function in pdp-11 / MACRO-11 / ODT using simh?

So, I'm working on a project where I'm aiming to get the first winner of the IOCCC (obfuscated c code contest) dissected down to the last detail... The program is mullender.c which you can find by ...
16
votes
12answers
6k 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 ...
90
votes
8answers
27k 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 ...
5
votes
1answer
285 views

Adding control characters to string constants in ca65 assembler

According to the cc65 documentation, a string constant in assembler programs can be defined with the .ASCIIZ command. However, I could not manage to sneak control commands in, for example, the ...
17
votes
3answers
3k 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 ...
1
vote
1answer
177 views

Using Bresenham's circle algorithm (or another alternative algorithm) to draw an arc [closed]

I'm trying to create some graphics function for a ZX Spectrum (Z80) machine in assembler. I already have the basics except for the arc. I know that there must be some way to draw an arc using the ...
7
votes
1answer
500 views

On the LR35902, what does the assembly 'LD (HL-),A' do?

I'm working on implementing the instructions of the z80 chip inside a gameboy for an emulator. I'm starting with the instructions in the boot rom that sets everything up. I've implemented the first 3 ...
34
votes
8answers
7k 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 ...
9
votes
2answers
431 views

How do I tell vasm to allow white spaces?

I have recently been learning to use vasm. For those that don't know, vasm is a cross-platform assembler for multiple types of processors such as the M68000. http://sun.hasenbraten.de/vasm/ I am ...
1
vote
6answers
1k views

Compile the 6502 assembler source code for running on modern computers [closed]

I want to make an executable file for modern computers that you can download and run without any other software, using any kind of a 6502 assembler. Can I compile source code, written for the 6502, ...
11
votes
3answers
317 views

Do any 6502 assemblers have better support for self-modifying code?

I find I keep on doing things like this: raster_interrupt: bgnd_color = * + 1 lda #$00 sta $d021 ; rest of interrupt handler so that I can do this kind of thing elsewhere in my ...
8
votes
4answers
1k views

Imaging a HDD from DOS over Serial

I have recently fixed an old IBM Clone, which has an MFM hard drive. The PC booted up fine, but then I saw, that a few years back, I have deleted a few important files (probably by mistake). The ...
1
vote
1answer
297 views

Were all NES games 16 kibibytes or less?

While searching on the Internet and Quora, I found disassemblers for Pac-Man, Galaxian, and Super Mario Bros. The thing that puzzled me, was while Super Mario Bros was arguably quite a complex game ...
43
votes
2answers
4k 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-...
6
votes
2answers
477 views

What 6800 assembler to use?

Does anyone know of a good, modern Motorola 6800 assembler? I've used dasm, which I quite like (and it's even actively developed), but it doesn't actually support 6800. It supports 6803, which is ...
31
votes
11answers
7k 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/...
11
votes
1answer
280 views

Inverting the carry flag on an M6800

Are there any tricks that can be used to invert the carry flag on the 6800, in as few bytes as possible? This is the shortest subroutine I've come up with, which is straight forward: INVC: BCS ...
10
votes
3answers
1k views

Comparing Signed Numbers on Z80 (8080) in Assembly

How do you compare two signed numbers in Z80 assembly? According to this site, To compare stuff, simply do a CP, and if the zero flag is set [then] the argument[s] were equal, else if the carry ...
3
votes
3answers
438 views

How to transfer the address of a data block into zero page using the Merlin 8 assembler on my Apple //e?

I've been fooling around with the Merlin 8 (v2.58) assembler on my Apple IIe and ran into a small snag. Basically, I would like to load the address of a block of data into a two-byte pair in zero ...
53
votes
7answers
9k 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 ...
8
votes
3answers
750 views

How can I access/use memory outside of the standard 1 MB address range of MS-DOS?

How do you access more memory (above the 1MB) in DOS if the 640KB of conventional memory are not enough? I have read a lot about this, but I couldn't figure out how to do this in actual code. Is ...
11
votes
2answers
421 views

Best learning path for Apple IIe assembly language [closed]

I have an emulator up and running and access to the asimov ftp site, and I want to learn how to program assembly language on the Apple IIe. What assembler should I use (Merlin? LISA?) and what book or ...
5
votes
3answers
312 views

Did the Apollo Guidance Computer or other multi-ROM machines subdivide code between ROM chips/modules to facilitate partial updates?

The Apollo Guidance Computer had its code stored in six modules that held 6 kwords of storage each, and the design of each module was such that changing even a single bit after construction would have ...
1
vote
5answers
890 views

How binaries are generated using Punched cards? [duplicate]

I thought that punched cards already represent the code in binary since a hole means 0 and rest positions mean 1 on a punched card. But then I read that you could use punched cards to present the ...
0
votes
2answers
144 views

RTC 16bit I/O read/write

Why can't RTC (0x70, 0x71) read and write 16 bits? such as Mov ax, 0xa8f Out 0x70, ax But I found in a 286 BIOS that they did this: (BIOS ID string: S286-6181-101590-K0) 00005357 B87253 ...
10
votes
2answers
736 views

Zilog Z80 estimated time discrepancy

I am writing a basic Zilog Z80 assembly language interpreter and something I noticed as I went through the 8 bit load commands is that the estimated times for LD (IX+d), n and LD (IY+d), n are ...
19
votes
4answers
3k 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-...
15
votes
1answer
3k 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
2answers
2k 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 ...
4
votes
3answers
159 views

ca65 vs tass syntax: converting a hex address to decimal?

Most of the tass example programs start with a header like this, which places BASIC code at the beginning of the file that has an appropriate SYS instruction to run the rest of the application: * ...
4
votes
2answers
690 views

Adding a register to the accumulator in 6502

In the past, the only assembly programming I've done has been a tiny bit of ARM, and then a larger game project in 68k. In 68k I was used to being able to do things like add.l d0, d1 to add the ...
6
votes
1answer
278 views

Putting code into two different memory areas with cc65/ca65

According to cc65 / ca65 documentation, the .org directive does not affect the placement of the code unlike with other 6502 assemblers. The docs suggest defining a memory segment with the intended ...
70
votes
9answers
8k 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 ...
2
votes
1answer
139 views

In vasm 1.7d targeting 68000, how to assemble with program counter at specific address without padding?

I'm programming for the Sega Mega Drive using vasm 1.7d assembler. I'm copying a block of my code from ROM to RAM so I can do some self-modifying code. ; First $200 bytes are header, dc.b ...
12
votes
5answers
917 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 ...
29
votes
9answers
10k 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 ...
21
votes
2answers
2k views

Why didn't the 6502 have increase/decrease 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. ...
21
votes
2answers
975 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, ...
13
votes
3answers
1k views

Memory models for assembly libraries for Turbo C

Turbo C follows the Intel Memory Model where in Tiny, Small and Compact models calling a function is near but in Medium, Large and Huge models calling a function uses far calls. If I want to develop ...
4
votes
0answers
105 views

MICRO 800 assembler?

I'm reading (well, writing...) about the FLOW language and it mentions the "MICRO 800 assembler". This was in the early 1970s, and I can't imagine what this might be. The context suggests it was on ...
2
votes
1answer
742 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 | | ...
6
votes
1answer
200 views

Different handling of ASCII interpretation between ca65 and cl65

I stumbled upon a divergence in the ASCII upper case/lower case handling when using assembler and linker of the cc65 suite separately (I used cc65 V2.15 on Win10). For a test I made the following ...
5
votes
1answer
288 views

How can I change the MSX function keys using ASM?

How can I change the texts assigned to MSX function keys using Z80 ASM?
15
votes
6answers
5k 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, ...
59
votes
13answers
14k 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 ...
19
votes
3answers
3k 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 (...
10
votes
4answers
3k 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 ...