Posts about Z80 programming that do not relate to a particular computer
- Posts: 1
- Joined: Tue Sep 15, 2020 8:48 am
I'm new here, thank you for giving me access to this forum. I'm following your lessons here (and watching the videos) but I'm already stuck at lesson two. Here LDIR is used to loop over memory addresses to set them to 0 to clear the screen. In the cheat sheet LDIR is explained as
Code: Select all
Load HL, DE
HL and DE are pointed to two memory locations. So when they are both increased as long as BC has room to decrease, they are just pointing to the next memory location. How is this affecting that memory?
- Posts: 430
- Joined: Mon Apr 22, 2019 3:19 am
Hey there! thanks for the question!
I think you've slightly misread the cheatsheet (unless there's a misprint version out there)
The first line should be:
Notice the brackets ()?
HL means the value in HL
(HL) means the byte at address HL
so "LD (DE),(HL)" copies one byte from address HL to address DE
Note there's no such command as LD (DE),(HL) - it's just explaining what the command does... but the principal is the same as the real commands:
Comedy-Horror 8-bit Bullet Hell shooter! // 「チビ悪魔」
可笑しいゴシックSTG ! // Work in Progress: ChibiAliens
Interested in CPU's :Z80,6502,68000,6809,ARM,8086,RISC-V