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
0
votes
4 answers

How can I correctly type-pun?

Follow-up to extended discussion in How can I determine if I'm overparenthesizing? I'm trying to emulate a Z80 in C, where several 8-bit registers can be combined to create 16-bit registers. This is the logic I'm trying to use: struct { uint8_t…
S.S. Anne
  • 15,171
  • 8
  • 38
  • 76
0
votes
1 answer

Jump without altering the stack

I am trying to make a subroutine that prints a null terminated string, but it doesn't work. in my first attempt: PRINTLN: ld a, (bc) // set bc to start of string before calling add a, 0 // update zero flag jp …
0
votes
2 answers

Z80 Assembly (1MHz) CP/M: How to get correct physical input using buttons

I am a freshman studying computer science. In computer engineering we are working on a Zilog Z80 8-bit microprocessor (1MHz) and a set of components that need to be manually connected using a breadboard and cables. The connecting part doesn't worry…
MichaelP
  • 41
  • 10
0
votes
1 answer

How can I efficiently sort a list of variable sized elements?

My motivation for this is to write some Z80 Assembly code to sort the TI-83+ series' Variable Allocation Table (VAT), but I am also interested in this as a general problem. The part of the VAT that I want to sort is arranged in contiguous memory…
Zeda
  • 382
  • 4
  • 13
0
votes
4 answers

Z80 assembly language - sign flag after INC r

one thing with Z80 assembly language bothers me. Does sign flag always represent the sign of the value of the A register? I mean, when I run 'INC B', the result goes back to B, so is the sign flag taken from the value of the A or B register? Thanks…
user1293910asd
  • 153
  • 1
  • 12
0
votes
0 answers

Finding instruction boundaries for disassembly

Not sure if this the right community for the question, but bear with me... On an old Zilog Z80 CPU, it is possible to jump to whatever byte address you want in memory. So that means it is also possible to jump right in the middle of an…
BinarySpark
  • 125
  • 9
0
votes
2 answers

Where does the instruction "JP ." actually jump?

I have the following instruction in Z80 assembly language: JP . It is not clear to me where it jumps.
Ago
  • 51
  • 4
0
votes
0 answers

Inputting values into memory on z80

I'm using a Z80 "emulator" (Cedar Logic) in Windows, and I would like to develop a program using this chip that takes in an array of 15 numbers, and shows me the max and min of them. I do not know much about machine code. Any help is much…
Lorenzo Battilocchi
  • 862
  • 1
  • 10
  • 26
0
votes
1 answer

Z80 assembly .ADDR

I have the following code START: .ADDR ADDR_1 .ADDR ADDR_2 ADDR_1: LD A,B XOR A LD B, A ADDR_2: JP ADDR_3 ADDR3_:.... I thing if START is at address "0x0000" the ".ADDR" directive indicates the address of the label (i.e.…
Ago
  • 51
  • 4
0
votes
1 answer

Is this z80 division algorithm broken?

http://zxm.speccy.cz/data/Z80%20Bits.html#2.2 Input: HL = Dividend, C = Divisor, A = 0 Output: HL = Quotient, A = Remainder add hl,hl ; unroll 16 times rla ; ... cp c ; ... jr c,$+4 ; ... sub c ; ... inc l ;…
Johan Kotlinski
  • 25,185
  • 9
  • 78
  • 101
0
votes
1 answer

Corrupt .8xp file for TI 84+

I am trying to write a few programs for my TI 84+ calculator. I am writing in a basic text editor on my desktop and then compiling into .8xp files, because it is much easier than typing on the actual device. I would then like to pass the .8xp file…
wcarhart
  • 2,685
  • 1
  • 23
  • 44
0
votes
4 answers

How does XORing the A register clear the carry bit on the F register in the Z80?

I'm reading a book about the Zilog Z80 processor, in which whenever the author wants to clear the carry bit for a possible reason he does any of the following: XOR A AND A OR A How does that affect the C bit which is in the F register? In other…
Abdelrahman Eid
  • 881
  • 2
  • 13
  • 28
0
votes
2 answers

What does IM0/1 mean in z80.info decoding?

I am in the process of writing (yet another) Z80 simulator. I am using the decoding page on the z80.info site. In the section with the lookup/disssambly tables it says that for index 1 and 5 the Interrupt Mode is IM0/1. This table is referred to…
obiwanjacobi
  • 2,413
  • 17
  • 27
0
votes
1 answer

BCD subtraction program for the Z80

This program is taken from the book Programming the Z80, the program is intended to do x-byte BCD subtraction, x could be any integer, and that's by counting the bytes of the two operands and executing the subtraction instruction consequentially…
Abdelrahman Eid
  • 881
  • 2
  • 13
  • 28
0
votes
1 answer

Issue With Using dec to Create a Delay

I've started experimenting with Gameboy programming using Z80 assembly, but I've found something kind of weird. I found a snippet of code used to create a delay: simpleDelay: dec bc ld a,b or c jr nz, simpleDelay ret While playing around with…
user6238236