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
3
votes
1answer
191 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 ...
5
votes
2answers
338 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: ....
10
votes
3answers
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 ...
1
vote
1answer
63 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
1answer
429 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
1answer
339 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
2answers
247 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:...
6
votes
3answers
612 views

Apple II Toggles between 40 and 80 columns in assembly language (Apple IIc)

To switch from 80-column to 40-column display, what is the difference between the following two actions: lda #$11 jsr COUT ; $FDED and sta $C00C ; 80coloff switch In the first case, I do not ...
4
votes
1answer
219 views

Apple IIc : displaying HGR page 1 in AUX memory

I need to display HGR page 1 ($2000 to $3FFF) located in AUX memory (not in MAIN memory). According to the "Apple IIc Reference Manual - Volume 1", page 45, I must first turn 80Store on by ...
6
votes
1answer
566 views

Why does the JSR operation not jump?

I am building a computer based on the 65C02S, and when stepping through the code, I see strange things happening. This is my code: SEI CLD LDX #$ff TXS JSR someRoutine ... This translates to this ...
7
votes
1answer
179 views

How did macro-instructions and indirect addressing interact in IBM's MAP/FAP assemblers?

The MAP and FAP assemblers for the IBM 709/7090/7094 had a nice macro facility. I was surprised by its power. (Actually, I guess it is possible that most macro processors at the time were as ...
5
votes
3answers
567 views

Was there an analog of local labels in the IBM assembly language?

In the assembly language used in Unix on DEC machines (PDP-11, VAX), one can use numerical labels and refer to them with suffixes "b" and "f" meaning "backwards" and &...
7
votes
1answer
308 views

What could be the reason an `LD B, B` instruction was used in this busy loop?

The Game Boy game "Tetris" leaves a transmission interval of about a millisecond between bytes sent over the serial link, as suggested by the official Game Boy Programming Manual, to give ...
19
votes
2answers
2k views

Z80 to x86 asm translator?

8086 is source code compatible with 8080. Zilog Z80 extended Intel 8080 with: An enhanced instruction set including bit manipulation, block move, block I/O, and byte search instructions New IX and IY ...
5
votes
1answer
164 views

Why have both the ORG and LOC pseudo-operations in the SHARE/Symbolic/Fortran Assembly Programs for the IBM 704/709/7090/7094?

This is a fairly basic question, and I almost feel ashamed to ask it; I'm guessing it can be answered in a single sentence. There was a rather influential series of assemblers for some of IBM's ...
14
votes
1answer
1k views

Who are the people associated with Simula, Assembler and Fortran in this video?

I am watching a recording of a discussion panel ‘Unix50 - Unix Today and Tomorrow’, part of which contains Bjarne Stroustrup’s talk ‘From C to C++’, discussing the history of C++. At 20:46 there is a ...
6
votes
3answers
2k views

Z80 string iteration failing

First Z80 project after 6502, a simple looking piece of code giving me hard time. print_char is a working function which prints contents of A to the screen. My first issue is that the following code (...
10
votes
0answers
316 views

Assembler where output file was executable WHILE including the source code

I seem to remember using an assembler with the following interesting workflow: You'd write an assembly language file and assemble it. The output overwrote your source code by placing the executable ...
2
votes
2answers
107 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 ...
5
votes
3answers
234 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
2k 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 ...
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 ...
0
votes
3answers
398 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
431 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
92 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 ...
9
votes
3answers
1k 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
232 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 ...
22
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: ...
3
votes
1answer
175 views

Is there a way to have the ca65 assembler only expand macros?

I would like to convert an assembly program in ca65 with macros into assembly code with resolved macros in order to carry out manual or automatic optimizations with the resulting code. Then, the ...
14
votes
2answers
2k 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: ...
7
votes
2answers
529 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 ...
5
votes
2answers
248 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, ...
12
votes
1answer
817 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 &...
6
votes
4answers
500 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 ...
17
votes
1answer
593 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 ...
6
votes
2answers
456 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 ...
5
votes
1answer
374 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
121 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
499 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
350 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
202 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
146 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
761 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
721 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
2answers
335 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
398 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 ...
9
votes
1answer
905 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 ...