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
2
votes
2answers
298 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 ...
2
votes
2answers
105 views

PDP-1 skip group invert bit functionality

I'm confused on the behavior of setting the invert bit on the PDP-1's SKP group. The manual states: The intent of any skip instruction can be reversed by making Bit 5 (normally the Indirect Address ...
13
votes
2answers
1k views

Origin of “arithmetic” and “logical” for signed and unsigned shifts

The assembly language for many processors use the phrase "arithmetic shift" to represent the bitwise shift of a signed value, and "logical shift" for an unsigned value. The two ...
4
votes
3answers
163 views

Apple II: ProDOS, zero length prefix and MLI calls

I have a simple program on my Apple IIc written in assembly language. It starts by getting a filename from the user (just the file name, not the full path), then it opens the corresponding file with a ...
12
votes
3answers
1k views

What 8086 instructions accept REP?

I tried this code in my assembler, set to 16 bit mode: bits 16 rep mov ds, ax Surprisingly, no error was thrown. Is this even valid? Wasn't rep only supposed to work with string instructions? Is it ...
12
votes
1answer
730 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 &...
11
votes
3answers
1k 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 ...
23
votes
12answers
7k 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 ...
14
votes
1answer
515 views

SYSENTER/SYSEXIT broken on Pentium Pro and Pentium II?

I was just reading What is linux-gate.so.1?, and it says this: Intel recognized this problem early on and introduced a more efficient system call interface in the form of sysenter and sysexit ...
4
votes
2answers
400 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 ...
0
votes
3answers
309 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/...
2
votes
1answer
83 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 ...
4
votes
2answers
623 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 ...
5
votes
2answers
295 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 ...
13
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 ...
5
votes
4answers
367 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 ...
11
votes
1answer
1k views

Identifying this 6502 Assembler

I found some 6502 assembler code for a Commodore 64 program that uses meta commands like #include "foobar", define the address to be assembled to via *=$1234 and define labels without a colon. ...
5
votes
1answer
355 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 ...
9
votes
3answers
967 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
194 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 ...
21
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: ...
1
vote
0answers
61 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 ...
11
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
411 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"),\ ...
14
votes
5answers
4k 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 ...
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
187 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, ...
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/...
61
votes
13answers
15k 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 ...
6
votes
1answer
506 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 ...
16
votes
1answer
511 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
268 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 ...
1
vote
2answers
301 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-...
9
votes
5answers
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 ...
21
votes
2answers
1k 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, ...
4
votes
2answers
118 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
393 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 ...
6
votes
3answers
431 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 ...
5
votes
2answers
300 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
186 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 ...
16
votes
4answers
1k views

Toolchain and workflow to build CP/M

Building my own version of CP/M has always been a fascinating to-do project. Problem is that it seems that the source code is not in regular assembler, but some kind of macro-assembler like language ...
2
votes
0answers
131 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
732 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 ...
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 ...
89
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
372 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
340 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
727 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
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 ...