Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 340

The Zilog Z80 microprocessor. Prefer [game-boy] instead for questions about the Game Boy CPU nicknamed the ‘GBZ80’.

12 votes

How costly is it to put things on the stack with the Z80?

Putting automatic objects on the stack is a horribly inefficient way of handling them on the 8080 and Z80 unless it is necessary to support recursion or reentrancy. … Copying the stack pointer to IX on function entry and then using IX to access automatic objects is somewhat reasonable from a code-size perspective, but the Z80's 4-bit ALU makes it very slow to process …
supercat's user avatar
  • 39.2k
14 votes

Z80: asymmetric use of B in DJNZ (B is a low byte) vs. BC in LDIR (where B is a high byte)

Both memory and I/O instructions that use C as part of an address output C on the lower part of the address bus and B on the upper part (which will often be ignored by the outside system, but is outpu …
supercat's user avatar
  • 39.2k
3 votes

Separate code and data address spaces on the Z80

A proper "start of instruction" indication would have been more convenient than the Z80's "some kind of opcode byte", but most code won't go very long without a write cycle, and once a write cycle occurs … Perhaps an ICE could track things even without M1, but it would require a more complicated state machine that understands almost all Z80 opcodes rather than just a few prefix bytes. …
supercat's user avatar
  • 39.2k
4 votes

Z80 string iteration failing

A handy way of outputting a string on the Z80 is to use something like: primm: ex (sp),hl primmlp: ld a,(hl) call putchar inc hl ld a,(hl) or a jr nz,primmlp ex (sp),hl ret The message …
supercat's user avatar
  • 39.2k
0 votes

What Video Chips/Video generation techniques are usable for the Z80?

A major question to consider is whether it would be acceptable to tie up the Z80 during significant parts of each frame. … If one is willing to tolerate a severe amount of CPU loading, one could produce a Z80 video subsystem with a surprisingly small number of off-the-shelf parts. …
supercat's user avatar
  • 39.2k
5 votes

Better way to do Z80 "bank switch & call"?

The normal way to handle cross-bank calls is to use a springboard which is either in an unbanked area of memory or appears identically in both old and new areas. If one doesn't mind using a different …
supercat's user avatar
  • 39.2k
1 vote

C++ compilation for the Z80 and 6502?

The most efficient way to process a C++ dialect on the 6502 or Z80 would probably be to design a virtual machine analogous to the UCSD P-system and then write a compiler that targets that. …
supercat's user avatar
  • 39.2k
11 votes
Accepted

Why does the Z80 JP (absolute) instruction always take 10 states to execute?

If the branch is skipped, the Z80 will skip those additional calculations. When processing a JP instruction, the Z80 fetches the next two bytes and increments the program counter while doing so. … Since the Z80 isn't performing any arithmetic with the target-address bytes, making use of them once they're fetched is no more expensive than discarding them. …
supercat's user avatar
  • 39.2k
22 votes

Can the Z80 Bus Request be used as an NMI?

The purpose of NMI is to cause the Z80 to execute code located at the NMI handler. … The purpose of Bus Request is to prevent the Z80 from executing any code until whatever wanted the bus is done with it, but not affect the sequences of instructions and memory operations performed by Z80
supercat's user avatar
  • 39.2k
23 votes
Accepted

How can a Z80 assembly program find out its own memory address?

If there are two consecutive bytes of RAM one can write at a known address, one could store the byte values E1h, E9h [POP HL / JP (HL)] at that address and then CALL it to place the address following …
supercat's user avatar
  • 39.2k
5 votes

Why does the Z80 include the RLD and RRD instructions?

. (*) Since writing the above, I've discovered that the Z80 uses a 4-bit ALU, and has steering logic to load/store its value from/two the upper or lower half of either half of any 16-bit register pair, …
supercat's user avatar
  • 39.2k
10 votes

Comparing raw performance of the Z80 and the 6502

Many operations on the 6502 take fewer cycles than corresponding operations on the Z80; the ratio tends to be somewhere between 2:1 and 4:1. … On the Z80, if the table is page-aligned, and if the address of "index" happens to be in HL--rather favorable assumptions--one may be able to get by with something like: ld d,tableH ld e,(HL) ld a,( …
supercat's user avatar
  • 39.2k
38 votes
Accepted

Why did the Z80 break 8080 compatibility?

The designers of the Z80 thought it would be useful for code to quickly determine whether signed arithmetic operations overflowed. … Have a "compatibility mode" flag which switches some instructions between perfect 8080 emulation and enhanced Z80 operation, along with instructions to turn it on and off. …
supercat's user avatar
  • 39.2k
5 votes

Does the Z80 allow interrupts after processing and ignoring a 0xdd prefix?

The Z80 increments the program counter while it is performing an opcode fetch. … As a consequence, by the time an opcode byte is fetched, the Z80 will be committed to completing the instruction before any interrupt may occur. …
supercat's user avatar
  • 39.2k
13 votes

Why do C to Z80 compilers produce poor code?

While the Z80 is definitely an 8-bit processor rather than a 16-bit one, the instruction set makes some operations easier with 16-bit values than 8-bit values. …
supercat's user avatar
  • 39.2k

15 30 50 per page