Questions tagged [z80]

The Z80 is an 8-bit CPU designed by Zilog to be a backwards-compatible enhancement of the Intel 8080. It has been in continuous wide use since 1976 and was formerly popular in microcomputers, such as models of the Tandy (Radio Shack) TRS-80 microcomputer and their derivatives, the ZX Spectrum and the MSX standard. Presently its main use is in embedded systems.

Resources on the Internet:

The Zilog Z80 CPU User Manual

Rodnay Zaks wrote a classic book on the Z80: Programming the Z80

See also:

182 questions
1
vote
1 answer

Trouble understanding the Z80 book and flags

I reading the official Zilog User's Manual and I'm having trouble understanding the flags section for each instruction. In the book it says: Condition Bits Affected: ... H: Set if carry from bit 3; reset otherwise ... C: Set if carry…
kamkow1
  • 467
  • 2
  • 8
1
vote
1 answer

Drawing two character sprite in Z80 assembly

Following on from First Steps in Z80 Assembly Language I'm trying to move a two high character sprite in assembler. ORG 30000 ; Origin LASTK EQU 23560 ; last key press (system variable) PRINT EQU 8252 …
Ghoul Fool
  • 6,249
  • 10
  • 67
  • 125
1
vote
1 answer

Sjasm: can't assemble DW or OUTPUT directive?

This is my code: output "ejemplo1.bin" db #fe dw START dw END org #8500 START: ld a, [#8600] ld b, a ld a, [#8601] add a, b ld [#8602], a ret END: And this is what I'm getting when trying to compile…
Daniel Tkach
  • 576
  • 2
  • 9
  • 18
1
vote
1 answer

Z80 function called by Joystick button prints extra strings instead of the expected one

While exploring joystick connection to the Z80 games I've got this code, which should print 1 letter when I press Up, Left or Right. But for some reason when I press Left it prints lru, when I press Right it prints ru, and u after pressing Up. …
Alexey
  • 2,582
  • 3
  • 13
  • 31
1
vote
1 answer

How to converting 8085 code to z80 assembly

I have 8085 assembly code for dividing 2 data 8 bit : MVI C,FFH LXI H,1900H MOV A,M (A=08) INX H MOV B,M (B=3) REPEAT: INR C SUB B JNC REPEAT ADD B INX H …
谢RenS
  • 21
  • 2
1
vote
0 answers

can SDCC override operators?

I've been trying to use SDCC to compile extremely lightweight C programs to run on a TI83 calculator (yes, you can do that). Being an old calculator, it doesn't have much RAM to store the program, and the processor is extremely slow. I wrote code…
pi_squared
  • 91
  • 6
1
vote
5 answers

ZX Spectrum - Issue with RS232 (Serial Port)

I recently got hold of a ZX Spectrum +3 and am trying to get RS232 working with the spectrum. I’ve built a cable (‘BT’ style connector <-> DB9 serial) following the pin out of the cable (Spectrum 128 RS232 data cable) here. The other end of the…
cobbm
  • 11
  • 3
1
vote
1 answer

Is there any pattern to the z80's opcode layout?

I'm trying to write an emulator for the z80, and am wondering if there is any specific opcode layout (i.e. do all the ld instructions have a specific bit set). I've looked here but if there's an indication of a pattern, I haven't found it yet. Is…
S.S. Anne
  • 15,171
  • 8
  • 38
  • 76
1
vote
1 answer

What does a LD statement passed a single argument do when the HL register is used as a 16-bit accumulator?

I'm learning z80 assembly. I'm using the Zaks textbook "Programming the Z80," and he includes the following as an elementary example of 32-bit addition after introducing how to use the HL registers as an accumulator for 16-bit operations: LD…
Duncan W
  • 149
  • 7
1
vote
1 answer

Load to 16bit register, least significant bit in first or second register?

I am programming in Z80 assembly; I'm confused about endianness. Regarding the following instruction: LD HL,d16 Will the bytes 21 FF DF result in H = FF and L = DF or H = DF and L = FF?
Shane
  • 659
  • 1
  • 9
  • 19
1
vote
2 answers

Whatis the difference in this case between doing dw and db?

value db 0h, 10h value dw 10h Are they the same? What is the difference? If I used, for example, ld A, (value) What would happen in both cases?
1
vote
2 answers

GBZ80 - Code shortcomings

this kind of stems of gbz80 - IF statements I have a code that loops 0x167 times, writing to the screen. What I'd like to happen is for the script to loop three times. My script: d322 21A0C3 LD HL,C3A0h d323 016801 LD BC,0168h d324…
1
vote
3 answers

Is there a way to add code to an infinite z80 assembly loop?

A while ago, I asked what the fastest infinite loop was on a TI-84. One of the answers I got involved using an assembly infinite loop with this code: AsmPrgm 18FE However, this is a bit impractical, because it can only be exited with the reset…
Johnny Dollard
  • 708
  • 3
  • 11
  • 26
1
vote
2 answers

Can I use two complement for SUB instruction gameboy emulation?

Hello I'm writing an emulator for Game Boy. And I'm struggling with SUB intruction SUB a, 0x92 given a = 0x90. What I am doing is : 0x90 + (-0x92) I use 2 complement method for substraction. -0x92 <=> 2_complement(0x92) <=> 2_complement(10010010)…
Demeter Purjon
  • 373
  • 1
  • 12
1
vote
1 answer

Understanding Z80 dollar signs and labels

I was researching Brandon W's "fake" application for the ti-84 to see how it worked. (http://brandonw.net/calculators/fake/) While looking through the code I noticed many labels and jump instructions that I didn't understand. I would like to learn…
user5175352