Questions tagged [assembly]

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

Filter by
Sorted by
Tagged with
16
votes
10answers
5k views

Was memory corruption a common problem in large programs written in assembly language?

Memory corruption bugs have always been a common problem in large C programs and projects. It was a problem in 4.3BSD back then, and it's still a problem today. No matter how carefully the program is ...
0
votes
3answers
237 views

How was “Super Mario Bros” made with Assembly if the DASM compiler came out in 1987?

Would somebody care to explain how "Super Mario Bros." was released in 1985. But the DASM Assembler came out in 1987? The 6502 Assembly language was introduced in 1975. How would you compile/...
4
votes
2answers
382 views

The use of segments in non-relocating assemblers

I've been looking at a bunch of different 6502 assemblers recently (dasm, ca65, xa, kickass), and many of them have support for multiple code segments. Some of these assemblers can generate ...
2
votes
1answer
75 views

Defining zeropage address labels in xa assembler?

I am trying to use the xa assembler to write some 6502 code. According to the documentation, I can define a zeropage segment using the .zero pseudo-op. I was hoping to do something like this: .zero ...
14
votes
1answer
1k views

How can a Z80 assembly program find out the address stored in the SP register?

I'm wondering how to write a program in Z80 assembler that discovers the value stored in the SP register. From what I've seen, the only instructions that touch the SP register are: LD SP, HL/IX/IY EX ...
10
votes
3answers
948 views

Make the “z80asm” assembler place an instruction at a known memory address

I'm writing a very basic OS for my homebrew Z80 computer. As an absolute assembly language beginner, I managed to obtain a working "os plus memory monitor" that can show memory content and ...
0
votes
3answers
182 views

c64 copy chars to sprite issue

How to do correct copying char to sprite ? Lets say 1st char is at $2000 second is at $2008 and copying to sprite at $2480. And with this we can copy 1 char to top left position of 1st sprite. But ...
20
votes
1answer
1k views

When did the IBM 650 have a “Table lookup on Equal” instruction?

In 1959, Donald Knuth wrote an assembly program named SuperSoap for the IBM 650. Here is the manual, and here is a listing of the program (in SuperSoap assembly language). Quoting from the abstract: ...
0
votes
0answers
55 views

Run ca65 assembler with intermediate step of resolving macros

I would like to convert an assembler program in ca65 with macros into assembler code with resolved macros in order to carry out manual or automatic optimizations with the resulting code. Then, the ...
12
votes
2answers
1k views

How would I reliably detect the amount of RAM, including Fast RAM?

If I was to write an Amiga game, what would be the best/most reliable way to detect how much RAM is actually available? Looking at Action's Guide to AGA-Fixing!, he mentions Faulty Memory Detection: ...
6
votes
2answers
397 views

Labels in cc65 inline assembler with #define macro

In general, it is possible to use inline assembler statements within C macros, for example #define toscreencode(C) (__AX__ = (C), \ asm("cmp #$60"),\ ...
4
votes
3answers
2k views

8086 duration of program

I have the following assembly code for 8086 MOV AL, [BX] OUT DX, AL The bus clock frequency is 1MHz. Access to memory is done without WAIT, and to I/O with one WAIT tick. How I can calculate the ...
4
votes
2answers
182 views

Were there “higher level programming” macro packages for the IBM Macro Assembler?

The IBM/360 Macro Assembly language was quite powerful, allowing non-trivial compile-time string manipulation. Did macro packages exist which would facilitate programming at a (slightly) higher level, ...
10
votes
1answer
640 views

Difference between INT 0x20 and INT 0x21 (0x4C)?

Checking the MS-DOS interrupt list we see INT 0x20 "Terminate the program" (see https://en.wikipedia.org/wiki/DOS_API) but if we check the same page we see INT 0x21 with function 0x4C will &...
5
votes
4answers
332 views

Better way to do Z80 “bank switch & call”?

I have a memory setup where the whole address space can be exchanged (default 2 slots with 2 banks each, but may change depending on "expansion cards" plugged in). Banks are switched by ...
15
votes
1answer
481 views

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

The closest I was able to find on StackOverflow is What are .S files?, in which no answerer addresses why we use .s for assembly. (And .S for preprocessor/macro assembly; and gcc -S to produce ...
4
votes
1answer
241 views

Does a defacto format exist for Commodore 64 SID music?

I first learned about tracker / mod music on my Amiga in the early 1990's. I remember fooling around with Protracker, listening to mods with Intuitracker, and coming to the realization that all those ...
6
votes
1answer
344 views

Why is my program outputting only zeros to the data bus during I/O operations?

I'm building a breadboard Z80-based computer. As now, I have the CPU hooked up to an EEPROM and an I/O device (an HD44780 character display) with appropriate decoding logic. The ROM chip starts at ...
4
votes
2answers
116 views

6800 I flag at reset

I have written an emulation of the Heathkit ET-3400A microcomputer trainer in Java, mainly to see if I could do it and to get my feet wet in Java. Odd question, but there's a discrepancy (one of many,...
3
votes
2answers
369 views

How were games and programs written for the C64 in assembler in the 80s? [duplicate]

Were developers using monitors like e.g. "Supermon+64", "Merlin 64" or "Monitor$C000" and cartridges like "Final Cartridge", "Action Replay" (both of ...
5
votes
2answers
283 views

Commodore Plus/4 jiffy clock tied to screen refresh frequency? (warning: flashing images)

Warning: There are flashing images below, do not scroll down if you are sensitive to them! According to various sources (for example this for the Plus/4), both the C64 and Plus/4 have a "jiffy&...
1
vote
1answer
181 views

Working on programming a retro z80 computer (SDCC error)

I am working on coding a driver of sorts for a Z80 based computer I am making. I am compiling with SDCC and I have been getting the following? ASlink-Warning-Undefined Global 'data' referenced by ...
2
votes
0answers
126 views

Help debugging a circuit/code for Z80 and TMS9918ANL

I am working on designing a Z80 computer that utilized the TMS9918ANL for graphics. I am currently just trying to make sure the TMS9918ANL is working, so I hooked up the control pins the bus (...
10
votes
2answers
713 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
2answers
607 views

Z80 PIO Keyboard [closed]

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 ...
2
votes
1answer
237 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 ...
1
vote
1answer
301 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 ...
8
votes
1answer
679 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 ...
35
votes
8answers
8k 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 ...
10
votes
2answers
461 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 ...
11
votes
3answers
403 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 ...
1
vote
1answer
355 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 ...
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 ...
34
votes
14answers
8k 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/...
7
votes
2answers
686 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 ...
11
votes
1answer
286 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 ...
3
votes
3answers
458 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 ...
11
votes
2answers
723 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 ...
8
votes
3answers
935 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 ...
6
votes
3answers
429 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 ...
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
5answers
1k 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 ...
1
vote
2answers
297 views

Performing 16-bit port I/O on the RTC

Why can’t the RTC (0x70, 0x71) read and write 16 bits at a time? For example: mov ax, 0xa8f out 0x70, ax I have found in a 286 BIOS that did this (BIOS ID string: S286-6181-...
56
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 ...
10
votes
2answers
762 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 ...
16
votes
12answers
7k 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 ...
4
votes
3answers
183 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
866 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
461 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 ...
2
votes
1answer
204 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 ...