Questions tagged [assembly]

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

Filter by
Sorted by
Tagged with
19
votes
3answers
3k views

What makes MOVEQ quicker than a normal MOVE in 68000 assembly?

I'm "re-learning" 68000 assembly language and came across the "MOVEQ" command that is labeled "MOVE QUICK". According to the NXP Programmers Reference Manual (reference below), the command MOVEQ (...
29
votes
9answers
9k views

How did early x86 BIOS programmers manage to program full blown TUIs given very few bytes of ROM/EPROM?

I've always wondered how so much functionality and relative luxuries(CMOS Configuration Utilities. See: https://geekprank.com/bios/ for an example) included with most popular x86 BIOSes could be ...
7
votes
1answer
174 views

Are there any PDP-8 assemblers that create linkable object files?

I am currently writing a compiler for the PDP-8. The compiler is going to translate source code into PDP-8 assembly code that calls some runtime routines to perform high-level functions such as ...
5
votes
1answer
300 views

What can an 8086 CPU do if an x87 floating-point coprocessor is attached to it? [duplicate]

As far as I know, old x86 CPUs (for example: the 8086 CPU) couldn't do floating point arithmetic, and in order to be able to do floating-point arithmetic, an x87 floating-point coprocessor should be ...
6
votes
1answer
280 views

What's the fastest way to ignore keypresses?

I'm writing a game for the IBM PC (running MS-DOS), complete with fancy cutscenes. Unfortunately, though, the keys pressed during those fancy cutscenes are carried out once the fancy cutscene has ...
5
votes
5answers
468 views

Did any assemblers work like this?

Once you get past the stage of manually entering numeric machine code, the most primitive programming tool is a machine code monitor. Intended primarily as a debugging tool, this works with a target ...
4
votes
3answers
384 views

Z80 unexpected output

I am trying to build a Z80 computer inspired by Grant Searle's design. I'm starting simple, with just a clock (clocked by an AVR pulsing at at 12.5 Hz for testing), a Z80, and a 8K EEPROM with a ...
9
votes
1answer
734 views

Looking for a specific 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
3answers
415 views

Comparing Signed Numbers on Z80 (8080) in Assembly

How do you compare two signed numbers in Z80 assembly? According to this site, To compare stuff, simply do a CP, and if the zero flag is set [then] the argument[s] were equal, else if the carry ...
6
votes
1answer
360 views

Common practices of programming the AY-3-8910 on Amstrad CPC: via Firmware routines or directly?

I'm starting to learn how to program in assembly (z80) on the Amstrad CPC computer. As an high level developper i find it pretty fun and i learn a lot of things about computer and CPU architecture. ...
32
votes
6answers
10k views

Which was the first programming language that had data types?

Machine language (and Assembly language) don't have the concept of data types, so if you want to add an int and a float variables in Assembly, you have to use the appropriate Assembly instruction that ...
20
votes
5answers
7k views

Will PC-DOS run faster on 4 or 8 core modern machines?

When I run PC-DOS on my 4 core AMD Phenom chip, does it take advantage of the extra parallel CPU's? If not, is there a way to coax DOS to use all available CPU's or does this require specific ...
1
vote
1answer
246 views

What don't I understand about this LR35902 code?

The question you are now reading is about a comment on this question, about overflow bugs in some Pokemon game. A comment on that question says: It was Game Freak's first project. They just were ...
0
votes
6answers
828 views

Can you compile 6502 assembly into a stand-alone PC application? [closed]

6502 assembly is a language meant for humans to write themselves, not compilers. It's an older Assembly that powered the olden days of computing and consoles such as the NES and Atari 2600. I want to ...
0
votes
2answers
335 views

Does anyone have an x86 EGA draw pixel routine?

So far, I have gotten by with using the BIOS draw-pixel routine here: http://stanislavs.org/helppc/int_10-c.html This works of course, but I can't imagine that commercial games used this BIOS call as ...
13
votes
1answer
464 views

Why does AT&T syntax use * and $?

In a comment to an answer about AT&T assembly syntax, another-dave asked the following: DEC used #foo for an immediate operand in -11 assemblers; the Unix guys apparently preferred $foo, which ...
11
votes
2answers
479 views

How to use the “darker” CGA palette using x86 Assembly?

For those of you retro developers out there, I am having a hard time figuring out how exactly to select the "darker" color palette in 320x200 CGA mode. Here's what I have so far: setup_cga_graphics: ...
4
votes
1answer
222 views

What was the first publication documenting AT&T syntax assembly language?

What was the first publication to document what is (now) known as AT&T syntax assembly language?
8
votes
2answers
1k views

What is the meaning of M in the Z80 statement ADD A,M

Recently I have been trying to compile CP/M 2.2 from source. When I try to assemble, everything works except for the instructions ADD A,M and SBC A,M, which the assembler returns a syntax error. I ...
12
votes
2answers
868 views

Does the Commodore 64 have the PHX opcode?

Code written for the Commodore 64 sometimes uses the PHX opcode, which should push X onto the stack. There also are plx, phy, ply. These were apparently added on the CMOS versions of the 6502; very ...
3
votes
2answers
279 views

How to express hi/lo byte of a label in crasm

I am trying to move my project from xa (which I found rather buggy) to crasm, which is the other 6502 assembler that comes with debian. My project contains a lot of lines like ldx #<pname ldy #&...
2
votes
2answers
335 views

Using C64 floating point kernal routines with 16 bit integer

How to use floating point kernal routines for 16 bit arithmetics such as: $1234*$ABCD or $1234/$ABCD ?
9
votes
1answer
940 views

Why does this 6502 code push a function address onto the stack before calling?

I am learning how to program the Atari 800 by examining some tutorial code that came with the IDE/Assembler I am using. I am using the MADS assembler for this. putchar_ptr = $346 csrhinh = 752 ...
8
votes
2answers
822 views

How useful were the 6809/6309's indirect addressing modes?

Much like the VAX, the 6809 and 6309 have a preponderance of indirect addressing modes (in VAX parlance, "deferred"), though neither go so far as to include a VAX-like doubly-indirect mode. To what ...
15
votes
2answers
4k views

What does “jmp *” mean in 6502 assembly?

Right now I am learning 6502 assembly. Currently I am using the MADS assembler to program for the Atari 800. This program is just a small tutorial program that came with the assembler zip file I ...
1
vote
2answers
379 views

Resource for 6502 assembly directives?

I am currently learning about 6502 assembly. One of the documents I am learning about it from is a super mario bros. disassembly document. When I was reading the code I noticed part of the code had ...
8
votes
3answers
2k views

6502 CMP instruction doesn't compare as expected

I am trying to code in 6502 assembly and for some reason the CMP instruction doesn't work. For example: CLD LDY #$03 LDA #$00 LDX #$05 CMP Y BEQ Equal STX $0200 Equal: BRK ...
7
votes
2answers
537 views

When did Intel undergo the SEX change?

I am reading the book "The 8086 / 8088 Primer Second Edition" by Stephen P Morse. In it on page 54, it says The 8086 provides instructions to facilitate the task of sign extension. These ...
9
votes
2answers
894 views

What is an “unused” memory address?

Reading this page on Commodore 64 memory structure and usage I stumbled across a cell where the table claims that this memory is unused. What exactly does this entail? Does this mean that if you ...
58
votes
13answers
13k 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 ...
13
votes
1answer
352 views

SYSENTER/SYSEXIT broken on Pentium Pro and Pentium II?

I was just 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 instructions. ...
5
votes
1answer
385 views

What instructions for the 8086 and subsequent x86 CPUs are not available in Long Mode?

I know from this answer that, Modern x86 CPUs are binary compatible with 8086. You can literally run 8086 binaries on a modern PC, in real mode. (The species analogy is a stretch here, but works ...
6
votes
4answers
675 views

Reason behind “ASCII Adjust” instructions being ASCII and not BCD?

I'm just curious if there was ever other instructions that were more ASCII-centric than the CISC associated ones we're left with now? Specifically, all the Binary Coded Decimal (BCD) instructions ...
57
votes
3answers
11k views

Why did DOS use dollar-terminated strings?

According to a few tutorials I am seeing, DOS used dollar-terminated strings to write to the terminal. This seems to also be documented here on INT 21H. AH = 09h - WRITE STRING TO STANDARD OUTPUT ...
2
votes
1answer
124 views

Can't enable list even with “enable run-stop” poke

Well, I've downloaded an old non-English textual adventure, which of course, "for the sake of professionalism" have list disabled. Even after entering pokes for enabling "run-stop/restore" and for ...
2
votes
1answer
370 views

What do the addressing modes imm, dir, and abs mean for the 65c816?

From http://www.6502.org/tutorials/65c816opcodes.html#6.1.1.2 For the CPX instruction: E0 3-x 3-x imm x.....xx . CPX #$54 E4 2 4-x+w dir x.....xx . CPX $10 EC 3 5-x ...
21
votes
3answers
2k views

Why use repeated STZ instructions with the same operand on the 65C816 for the SNES (Super Nintendo)?

Please consider the code in Super NES Programming/Initialization Tutorial/Snes Init. Here is an excerpt: stz $2113 ; Plane 3 scroll x (first 8 bits) stz $2113 ; Plane 3 scroll x (last ...
12
votes
2answers
491 views

Early 65C816 CPU's SEP and REP instruction are followed by a NOP?

Why did early versions of the 65C816 CPU need a suffixed NOP to every SEP and REP instruction? I saw comments in some source code pointing at this. Looking around in official WDC's documentation and ...
3
votes
1answer
521 views

How does JSR actually work on the 65c816 CPU for the SNES (Super Nintendo)?

Take the following machine code for the 65c816 for the SNES (Super Nintendo): 00000000 ea ea 78 18 fb c2 18 a2 ff 1f 9a 20 fa 80 e2 20 |..x........ ... | 00000010 a9 80 8d 00 21 a9 e0 8d 22 21 ...
13
votes
8answers
2k views

Uses for the halt instruction?

What was the halt instruction in early CPUs such as the Z80 and 8080 used for? Here's a description of the Z80 instruction: The HALT instruction suspends CPU operation until a interrupt or reset ...
16
votes
2answers
669 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, ...
1
vote
2answers
211 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 ...
9
votes
1answer
360 views

Can we express the instructions to the Analytical Engine in terms of assembler or machine code?

On a recent trip to the London Science Museum I saw Babbage’s Analytical Engine. Apparently this had an ALU (or equivalent). I can build an ALU out of logic gates but I can’t conceptualise how to do ...
10
votes
4answers
607 views

Motorola 6809 two stacks design

I'm an assembly newbie, but I'm curious about why the designers of the 6809 choose to use 2 stack in the microprocessor architecture. What is their original intent? The Wikipedia page says "a user ...
34
votes
4answers
11k views

Who is credited for the creation of Assembly Language?

The C Programming Language was originally developed by Dennis Ritchie who also co-designed the Unix operating system with which development of the language was closely intertwined. Is there a ...
1
vote
2answers
176 views

(How) can I safely use direct addressing for machine code routines on the Epson HX-20?

I am working through the exercises of Lance Leventhal's 6800 Assembly Language Programming on my Epson HX-20. My understanding is that the HX-20's Hitachi 6301 processor is compatible with the ...
1
vote
1answer
425 views

Why did this Hitachi 6301 assembler routine only work once?

I am trying to learn assembler on the various retro machines I own, or am about to buy. Today I tried converting this 8080 routine (which worked, repeatedly): | START: | MVI A,0 | 8000 | 3e | | ...
7
votes
2answers
6k views

Best path to learn C64 assembly [closed]

The amount of tutorials, youtube videos, scanned books on C64 programming is overwhelming. What materials would you recommend -- and, importantly, in what order! -- to build a path to programming my ...
6
votes
3answers
727 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 ...
11
votes
3answers
718 views

z80 crashes after executing some instructions

I'm building my own Z80 computer but I'm having a very strange problem. Consider this code: ld a,0xaa out (00),a jp a That works as expected, outputting 0xaa on port 0x00. Now consider this code: ...