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

MOV label, HL table

I have instruction MOV label, HL. I only understand the first row, but second I don't, if it's only instruction MOV label, HL, why do we always need to get the address for low and high values of label? What is ZR? And can someone explain to me those…
Rahul
  • 5
  • 3
1
vote
2 answers

z80 Assembly nested loops

I need to write three nested loops in Assembly on a z80 hardware. The first loop (the most internal one) should iterate 70 times, the other two 100 times. This is the code I have come up with, but it seems not to work properly; it iterates until an…
Washery
  • 1,037
  • 1
  • 12
  • 23
1
vote
0 answers

printf() Overflows on TI-83 Plus

I'm following the tutorial here. What I'm doing is to simply print out a string but it is giving me an overflow error: #include int main(){ printf("Hello World\n"); return 0; } I'm compiling the C code with z88dk into a .83p…
Derek 朕會功夫
  • 92,235
  • 44
  • 185
  • 247
1
vote
1 answer

Need help understanding this code (Z80 Assembler)

I tried going through the documentation I have but it's really confusing, I need to understand this for an exam but I'm having lots of troubles. aseg org 100h start: ld ix, vector ld B, amount ld A, 0 cycle: add A,…
YoTengoUnLCD
  • 600
  • 7
  • 15
1
vote
1 answer

How do I take operands as registers from the byte value?

I have a fairly simple program so far to start off my emulation experience. I load in an instruction and determine how many (if any) operands there are, then I grab those operands and use them. For things like jumps and pushes it's somewhat…
Christopher Wirt
  • 1,108
  • 1
  • 10
  • 21
1
vote
1 answer

How does AND operation in Z80 cpu overflow?

I am referencing zilog z80 manual and i am little puzzled reading at AND instruction. It says in the 'condition bits affected' section, P/V flag is set if the operation overflows. I can understand how add or sub instruction overflows but it doesn't…
kofhearts
  • 3,607
  • 8
  • 46
  • 79
1
vote
0 answers

HP to TI calculator link... Is it possible with/without assembly programming?

I have a HP50g and TI84 calculator, and was curious about the possibility to link them, writing a program to send numbers/strings/data. Both can be linked via USB, but the TI uses its own special protocol, and the HP uses Xmodem/kermit. The HP…
NoBugs
  • 9,310
  • 13
  • 80
  • 146
0
votes
0 answers

Porting from Santaka ZX Spectrum clone code to Z80 to compile a Santaka game - how to translate to this dialect?

This is a continuation of https://retrocomputing.stackexchange.com/questions/27077 I am trying to port my father's game for the Z80 compiler. I have managed to read up on the tutorials and other resources (like other BASIC programming examples) to…
Sir Muffington
  • 309
  • 1
  • 8
  • 14
0
votes
1 answer

Which registers are callee-save in routines called via USR function in MSX BASIC?

In machine-language routines to be called via USR function in MSX BASIC, values of which registers should be preserved and which registers can be used without saving their original values? I tried Google and Perplexity AI, but they didn't work well…
MikeCAT
  • 73,922
  • 11
  • 45
  • 70
0
votes
1 answer

Should I sacrifice readability for speed using inline code vs function calls in C# NET4?

I am writing a Z80 Emulator in C#, second time. First time was incredibly slow using a bunch of if statements and function calls, so I am rewriting using using switch/case instead. VS2019 C# .NET 4 For simple instruction execution there aren't many…
Mike Sr
  • 511
  • 1
  • 5
  • 15
0
votes
2 answers

Z80 16-Bit Load Instruction and Endianness

I'm writing a ZX Spectrum emulator in C# "for fun" (I think I regret starting already). I know the Z80 is little endian, so in RAM the low-order byte is stored first. What I can't seem to find a definitive answer to, is how it behaves with a 16-bit…
Stevo
  • 1,424
  • 11
  • 20
0
votes
1 answer

Unexpected garbage pixels in logo demo for Amstrad CPC emulator

I'm "emulating" the Nintendo Gameboy logo demo in an Amstrad CPC Emulator (WinApe) in mode video 1, encoded in assembly for the Z80. When I "paint" only the logo (until the line 25 and comment the others lines in main loop), It paints good, but when…
reymagnus
  • 327
  • 2
  • 17
0
votes
2 answers

Load value of register in 2 by 2 bytes to another register

I am learning Z80 assembly programming for the Amstrad CPC, and then I need to get the address from a list of two byte hex values, but for the moment I know how to get 1 by 1 byte (using 'A' register). I have a "table" of addresses named 'map' that…
reymagnus
  • 327
  • 2
  • 17
0
votes
0 answers

Z80 load immediate instruction

I'm curently starting to learn Z80 assembly language and I have the following snipet of code : LD A, 53H LD B, F5H ADD A, B halt It simply loads two immediates into the registers A and B, and adds them up. The problem I have is with the sencond…
Ait-Gacem Nabil
  • 165
  • 3
  • 12
0
votes
1 answer

How can I get the range of numbers that would produce certain flag conditions when subtracted from 43h in Z80 assembly?

I started learning Z80 recently, but I'm struggling with flags. I want to get the range of register "B" in Z80 assembly. This is the problem that I faced. Register "A" is 43H (in Hexadecimal number) and I want to sub register "B" from that, doing in…
Kir
  • 11
  • 3