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
16
votes
3answers
1k views

6502 ORA not updating the accumulator

Unless I'm reading the manual incorrectly, the following should produce $11 when D404 = $10 (I'm turning on the gate for voice1 which has been previously set to triangle wave %00010000/$10) 00153 ...
15
votes
2answers
1k views

How to use "AND," "OR," and "XOR" modes for VGA Drawing

I've been trying to implement a blitter in MS-DOS, but before I do that I wanted to test the various graphics modes of the VGA graphics card. (I'm emulating using DOSBox.) According to this paper on ...
5
votes
1answer
310 views

Apple II Assembly DSECT

I'm trying to define a section of data in a program. The Apple 6502 Assembler/Editor mentions an assembler directive called "DSECT" but I can't tell if I'm using it correctly or not. Here is ...
14
votes
1answer
2k views

How can I set up the Microsoft C compiler to make it prefer immediate-mode push instructions?

I started a project to get a better understanding on how to compile a game for Windows 3.x. I tried to set up the build workflow so that it produce the byte-exact clone of a great open sourced Win16 ...
9
votes
0answers
227 views

Undocumented ModR/M byte combinations

The reason I am asking this question is because I was trying to compile a list of all 8086 opcodes, regardless of whether or not they are documented. The list is just for fun, the documented opcodes + ...
4
votes
1answer
347 views

How to wait for vBlank on Commodore 64

I'm not new to 6502 Assembly but I am new to the Commodore 64. I'm used to the NES where you have to write everything yourself, such as the NMI/RESET/IRQ vectors, etc, but from what I understand the ...
4
votes
2answers
190 views

Looking for NEC RA87 “Relocatable Assembler Package”

I admit, I am pushing my personal envelope (punching above my weight, beyond my pay-grade etc. etc.) on the trailing edge of technology. So please be kind! I would like to write new firmware for a NEC ...
1
vote
2answers
282 views

8086 assembly relative addressing issue [closed]

This tiny program puts a few A's into the text mode buffer of an ms-dos pc. But only works if the number of repetitions (CX) is loaded with a direct value. If I try to read that from memory, i.e. ...
16
votes
3answers
2k views

Why can't I invoke the next interrupt service by incrementing the AX register after calling the same interrupt?

I have two snippets of 8086 assembly code, both of which are supposed to do the same thing: make the mouse appear on the screen. Show_Mouse: push ax mov ax,0 ;Reset Mouse int 33h ...
4
votes
1answer
218 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
346 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: ....
11
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
71 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
472 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
352 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
252 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
667 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
228 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
585 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
186 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
569 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
320 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
167 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
325 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
110 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
245 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
487 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
447 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
97 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
2k 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
238 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
196 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
555 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
267 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
875 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 &...
9
votes
4answers
678 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
643 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
487 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
377 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,...