Questions tagged [assembly]
Assembly languages in general, of any architecture. Use with the particular processor’s tag as appropriate.
193
questions
9
votes
3
answers
2k
views
Is there an equivalent of "#pragma once" in RGBASM (Gameboy DMG assembly language)?
So I am really just starting out in my assembly coding adventure. I have a little bit of knowledge of C/C++ but nothing too advanced yet.
But I also used to do a tiny bit of Z80 assembly, and I wanted ...
-4
votes
1
answer
287
views
If I build a new CPU architecture, how would an OS like Linux know how to run it? [closed]
I am trying to build a CPU from scratch (from NOR gates) in an emulator first, then on breadboard. (Inspired by nand2tetris and Ben Eater)
Just trying to understand how things work.
Now, as my CPU ...
2
votes
2
answers
280
views
From an electrical and software engineering perspective, ignoring available software, should I go for the Z80 or 65C02? [closed]
This might be a weird title but I noticed that recommendations for one over the other usually go into a direction that is not too helpful for me.
I would like to build an 8 bit computer and picked ...
7
votes
1
answer
407
views
PDP 11/70: how does MTPI work?
I'm trying to understand the MTPI (and its MFPI counterpart) instruction on the PDP/11.
As far as I understood, it:
it retrieves a value from the "current" memory space with the current ...
19
votes
3
answers
5k
views
Why are these DOS console drivers wasting precious bytes?
While doing some research on DOS device drivers, I took a peek at the console drivers DISPLAY.SYS and ANSI.SYS that are part of the DOS 6.20 installation. Both have "Microsoft" stamped on, ...
0
votes
1
answer
175
views
getting PDP-11 DL11 output via telnet
I'm trying to run the (a slightly adapted version but the original gives the same problem) example program from How to implement a 'write' function in pdp-11 / MACRO-11 / ODT using simh? in ...
7
votes
2
answers
455
views
Any recommendations for a Hitachi HD6303 assembler?
Does anyone have any good recommendations for a Hitachi HD6303 assembler?
I've been working on a project to reverse-engineer an executable made for a Hitachi HD63B03 processor. I've finished the first ...
63
votes
1
answer
7k
views
How did the SNES do the “pixelate” transition effect?
This effect is seen in many SNES games, including Super Mario World. The effect pixelates the screen, and makes the pixels larger, then smaller again when it switches to another scene.
It is done so ...
36
votes
11
answers
7k
views
When did assembly source code begin to be written in lowercase?
In nearly all the assembly source files and published listings I read up to the early 1980s, the labels, mnemonics, and operands were written in all uppercase. Just a few years later, I noticed 80x86 ...
5
votes
1
answer
244
views
Z80 CPU and nested/reentrant NMI
According to multiple documentation sources, non-maskable interrupts (NMIs) can be nested (or reentrant) in a Z80 microprocessor.
This is, upon a /NMI signal pulse, the CPU will interrupt the current ...
2
votes
1
answer
192
views
Timer B Interrupt occurs only once
I was following this tutorial on Commodore 64 timer interrupts and tried to replicate it (except all I was planning on doing was changing the border color.) I noticed that my interrupt only occurs ...
1
vote
1
answer
197
views
Game assembled using RGBDS can't access cartridge RAM
Any writes I do to cartridge RAM on my test game assembled with RGBDS are silently ignored. I wanted to move the stack pointer to cartridge RAM to have more room in high ram to use as a scratchpad, ...
1
vote
1
answer
214
views
How does RETN return from NMI on the Z80 in the event of nested NMI?
I was trying to learn how the Sega Master System works. The NMI occurs when the pause button on the console is pressed. So I wrote an NMI handler that makes a beep when the NMI occurs, then waits for ...
1
vote
1
answer
252
views
Can the window only be moved once per frame on the Game Boy?
I wanted to cover the top part of the screen to use as a status bar for a game. My idea was to use the Game Boy's window feature to do so. But I ran into a problem: The window's size is fixed to be ...
1
vote
0
answers
102
views
Getting a loading seam to work with 2x2 metatiles
I'm working on a prototype for a scrolling loading seam similar to Pokemon where the screen scrolls incrementally by 8 pixels with each direction button press, and new tile graphics are drawn off the ...
4
votes
0
answers
251
views
Game Boy interrupt handler crashes unless I jump to it indirectly
I have an interrupt handler I created, which is meant to reduce the overhead of interrupts as much as possible. Setting up the interrupt handler is done while interrupts are disabled, of course. It ...
5
votes
1
answer
243
views
Can I use cartridge RAM for the stack pointer?
My understanding is that the extra cartridge RAM banks at &A000-&BFFF are battery-backed SRAM that is preserved after powering off the game. If I'm making a simple game that doesn't have a ...
24
votes
11
answers
10k
views
Why weren't 80s arcade games programmed in C?
I know many arcade games from the 80s were programmed in 68000 assembly. This carried on probably well into the 90s, even though Motorola C compilers existed in the 80s. Why then weren't C compilers ...
8
votes
1
answer
1k
views
Why does the Z80 JP (absolute) instruction always take 10 states to execute?
I've looked at a few different websites and they all agree that a JP nnnn instruction (where nnnn is a 16-bit address) always takes 10 states to execute.
According to what I've read, all of the ...
6
votes
2
answers
490
views
How can I detect signed integer overflow on the Game Boy?
Unlike a normal Z80, the Game Boy has no CALL pe/po, JP pe/po or RET pe/po instructions. I've been trying to figure out how to detect integer overflow on the Game Boy. (It doesn't have those ...
17
votes
3
answers
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
2
answers
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 ...
0
votes
2
answers
183
views
why the result comes out as 1, rather than 2, in this 8086 Subtract with borrow? [closed]
STC
MOV AL, 5
SBB AL, 3 ; AL = 5 - 3 = 2, but I am getting 1 .. why?
RET
5
votes
1
answer
341
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
1
answer
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
0
answers
285
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
2
answers
526
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
2
answers
220
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
2
answers
300
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
3
answers
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
1
answer
265
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
2
answers
368
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
3
answers
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
1
answer
84
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
1
answer
823
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
1
answer
372
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
2
answers
268
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
3
answers
879
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
1
answer
244
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
1
answer
623
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
1
answer
218
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
3
answers
591
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
1
answer
359
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 ...
21
votes
3
answers
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
1
answer
183
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
1
answer
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
3
answers
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 (...
11
votes
1
answer
488
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
2
answers
117
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 ...
14
votes
2
answers
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 ...