Hello,
I am following the lesson and at the beginning on the routine labelled as 'GetScreenPos' I don't understand up to the 'ld e,a' statement. What is being done ?
Thanks,
Regards
Question about lesson S2 - Easy Sprites on the ZX Spectrum
Re: Question about lesson S2 - Easy Sprites on the ZX Spectrum
Can I ask if you've learned Z80 at this stage?
These tutorials assume you already understand Z80 before you try to get graphics on the screen.
You can see the documentation for this lesson here:
https://www.chibiakumas.com/z80/simples ... p#LessonS2
Unfortunately the screen co-ordinates on the ZX spectrum are not particular 'logically organized'... so various bits of the current line number need different multiplications performed on them and added to the final result - that's what's being done in that subroutine
These tutorials assume you already understand Z80 before you try to get graphics on the screen.
You can see the documentation for this lesson here:
https://www.chibiakumas.com/z80/simples ... p#LessonS2
Unfortunately the screen co-ordinates on the ZX spectrum are not particular 'logically organized'... so various bits of the current line number need different multiplications performed on them and added to the final result - that's what's being done in that subroutine
Chibi Akuma(s) Comedy-Horror 8-bit Bullet Hell shooter! // 「チビ悪魔」可笑しいゴシックSTG ! // Work in Progress: ChibiAliens
Interested in CPU's :Z80,6502,68000,6809,ARM,8086,RISC-V
Learning: 65816,ARM,8086,6809
Interested in CPU's :Z80,6502,68000,6809,ARM,8086,RISC-V
Learning: 65816,ARM,8086,6809
Re: Question about lesson S2 - Easy Sprites on the ZX Spectrum
Hello,
I know a little assembler for the Z80. My question comes from looking at the GetScreenPos routine.
I just don't get why the value %00111000 you are anding to the c value in the a register.
Sure this is probably related to the way the screen is layed out , but t I don't understand why that value.
Thanks,
Regards
I know a little assembler for the Z80. My question comes from looking at the GetScreenPos routine.
I just don't get why the value %00111000 you are anding to the c value in the a register.
Sure this is probably related to the way the screen is layed out , but t I don't understand why that value.
Thanks,
Regards
Re: Question about lesson S2 - Easy Sprites on the ZX Spectrum
As you said, that's simply how the screen memory of the spectrum is organized. To my knowledge there's no simpler way of calculating a VRAM position on the speccy.
Try writing a routine that slowly fills the spectrum screen one byte at a time, and you'll see how the areas of the screen are organized in memory.
Try writing a routine that slowly fills the spectrum screen one byte at a time, and you'll see how the areas of the screen are organized in memory.
Chibi Akuma(s) Comedy-Horror 8-bit Bullet Hell shooter! // 「チビ悪魔」可笑しいゴシックSTG ! // Work in Progress: ChibiAliens
Interested in CPU's :Z80,6502,68000,6809,ARM,8086,RISC-V
Learning: 65816,ARM,8086,6809
Interested in CPU's :Z80,6502,68000,6809,ARM,8086,RISC-V
Learning: 65816,ARM,8086,6809