Beginner's ASM Tutorial: Multiplatform Z80 ASM development videos... with vampires!

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Beginner's ASM Tutorial: Multiplatform Z80 ASM development videos... with vampires!

Post by Nomad »

Hey Keith,

I have a 23" monitor, and the text in the videos is so tiny its unreadable. Is there not some way you can zoom or maximise the window when your showing the code?

Good on you for having a go at the tutorials but unless your watching it on some huge screen / projector I don't see how you can follow along.
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Beginner's ASM Tutorial: Multiplatform Z80 ASM development videos... with vampires!

Post by Nomad »

I am always curious how other people go about development.. can I ask, do you just go straight in and start coding the projects or do you go through an analysis phase/problem definition kinda deal?

Would have thought doing multi platform projects there would have been more need to study the problem first before jumping in.
User avatar
PeterJ
Site Admin
Posts: 6855
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: Beginner's ASM Tutorial: Multiplatform Z80 ASM development videos... with vampires!

Post by PeterJ »

Many thanks [mention]keith56[/mention] for doing this. You have obviously put a lot of time and effort in. It's all very good stuff.

Would it be possible to calm down the text colours on the website? It's all rather bright!

I could not get your Enterprise 128 page to load

http://www.chibiakumas.com/z80/enterprise128.html

There is a type up of a Enterprise 128 Assembly Language book here. If you use Google translate its possible to get the grasp of it:

http://www.ep128.hu/Ep_Konyv/Gepi_kod.htm

Peter
User avatar
PeterJ
Site Admin
Posts: 6855
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: Beginner's ASM Tutorial: Multiplatform Z80 ASM development videos... with vampires!

Post by PeterJ »

Just found 'Print Mode' That looks much better!
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Beginner's ASM Tutorial: Multiplatform Z80 ASM development videos... with vampires!

Post by Nomad »

I would use the whole screen to zoom in on the area that you are currently using and not the whole desktop. That way the font is large enough to be seen easily. Unless you got good eyesight its very difficult to see what is going on with a regular screen.

For example, this fella has the open window zoomed.

[media]https://youtu.be/qBFJgoceljQ[/media]

Length is fine, better to cover something properly than gloss over something important.

I wouldn't worry about focusing on the Amstrad, as long as eventually you are going to cover the memory map, screen layout, and rom calls for msx I think its not an issue. I think that is the interesting point about doing the ports is showing how to find the equivalent rom calls, adjust the memory pokes/peeks for the various platforms. I don't think that has been covered in a youtube tutorial. Sure it all comes down to RTFM in the end but to show the process I figure that will add a lot of value. :lol:

Nice work so far by the way, it must take a lot of time to prepare.

Post edited by admin to change to new media tags.
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Beginner's ASM Tutorial: Multiplatform Z80 ASM development videos... with vampires!

Post by Nomad »

Nice work Keith,

One thing I have noticed that is a 'barrier to entry' with the CPC stuff is none of the books seem to have been scanned (well English language ones anyway). How are you supposed to figure out the system without the books?

I know cpcwiki is there but its not the same as having the primary source material to look at. Were the books really that worthless that nobody thought it was worth preserving them?

The CPC wargaming book looked pretty interesting but so far as I can tell its not been preserved anywhere.
AndyC
Dynamite Dan
Posts: 1388
Joined: Mon Nov 13, 2017 5:12 am

Re: Beginner's ASM Tutorial: Multiplatform Z80 ASM development videos... with vampires!

Post by AndyC »

Nice. I think maybe you missed a trick using self modifying code in the example - it might have been slightly more instructive to pre-stage the HL' register with the address of the colour values and then just let the ISR reset it as and when it needed to. That might have shown another one of the benefits of the alternate register set in that kind of scenario, they can persist values for the ISR allowing you not only to avoid having to PUSH/POP the registers used by the main program, but also to avoid having to reload values needed by your interrupt code.
AndyC
Dynamite Dan
Posts: 1388
Joined: Mon Nov 13, 2017 5:12 am

Re: Beginner's ASM Tutorial: Multiplatform Z80 ASM development videos... with vampires!

Post by AndyC »

keith56 wrote: Sun Mar 11, 2018 7:18 am It's quite curious how the different systems use the shadow registers
in my game, I use DI/EI when I use the shadow registers in a normal loop, but two EXX 'es and DI/EI are pretty much the same speed as a PUSH/POP, so there's rarely any cases it's worthwhile.
it seems interrupt handlers on most do not alter them, but the CPC does, I wonder what the 'best' way to use them overall is?
I think the Amstrad is using them pretty much as Zilog intended, as a sort of precursor to kernel/user mode separation we see on modern CPUs with one set of registers that "belong" to the system and another for user mode. That best explains the rather "all or nothing" swap arrangement, with AF really being singled out as a way of transferring simple values between the two. It's often difficult to make really good use of them under normal cicrumstances (for the reasons you indicate) but often you see more use in cases where a subroutine needs to juggle just ever so slightly more values than normally fit - that does normally preclude from using them in interrupt handlers though (although sometimes using push/pop there instead is preferable if you don't need the full register range).
Wall_Axe
Manic Miner
Posts: 492
Joined: Mon Nov 13, 2017 11:13 pm

Re: Beginner's ASM Tutorial: Multiplatform Z80 ASM development videos... with vampires!

Post by Wall_Axe »

that is pretty interesting thanks

so if a digit is zero and we subtract one, the result will be 255
so does daa fix the result to 9 (and activates the carry flag)?


so daa also allows someone to use nibbles?
AndyC
Dynamite Dan
Posts: 1388
Joined: Mon Nov 13, 2017 5:12 am

Re: Beginner's ASM Tutorial: Multiplatform Z80 ASM development videos... with vampires!

Post by AndyC »

If A was 0, and you subtract 1 (so it's now 255), DAA would reset it to 99 (with Carry).
Wall_Axe
Manic Miner
Posts: 492
Joined: Mon Nov 13, 2017 11:13 pm

Re: Beginner's ASM Tutorial: Multiplatform Z80 ASM development videos... with vampires!

Post by Wall_Axe »

ohh you mean '9 and 9' in 2 nibbles
this does make outputting numbers to the screen a lot easier
AndyC
Dynamite Dan
Posts: 1388
Joined: Mon Nov 13, 2017 5:12 am

Re: Beginner's ASM Tutorial: Multiplatform Z80 ASM development videos... with vampires!

Post by AndyC »

Wall_Axe wrote: Thu May 10, 2018 1:58 am ohh you mean '9 and 9' in 2 nibbles
this does make outputting numbers to the screen a lot easier
Yup. BCD is very handy when it comes to numbers you display on screen.
User avatar
RMartins
Manic Miner
Posts: 776
Joined: Thu Nov 16, 2017 3:26 pm

Re: Beginner's ASM Tutorial: Multiplatform Z80 ASM development videos... with vampires!

Post by RMartins »

keith56 wrote: Sun Mar 11, 2018 7:18 am It's quite curious how the different systems use the shadow registers
in my game, I use DI/EI when I use the shadow registers in a normal loop, but two EXX 'es and DI/EI are pretty much the same speed as a PUSH/POP, so there's rarely any cases it's worthwhile.
it seems interrupt handlers on most do not alter them, but the CPC does, I wonder what the 'best' way to use them overall is?
I believe you are not equating all the variables here, and mixing a few concepts.

DI/EI (4T/4T), just controls if maskable interrupts are enabled or not.
Nothing to do with preserving register contents. You can still receive an NMI in the middle of the loop.

NOTE: This is one of the reasons, why assembly tricks using the stack register (SP) and PUSH/POP can be dangerous on machines that have support for NMIs. Any ZX Spectrum can have NMIs being generated, by an external interface, like DivMMC for example.

EX Af, Af' (4T)
EXX (4T)
These are used to SWAP between the register banks, they do not save anything anywhere.

These were designed/created for REAL TIME applications, where time spent inside an interrupt routine is crucial, and must be very low, so these systems, usually, reserve the shadow registers, to be used inside the interrupt routine, to avoid having to backup the registers before using them.
This obviously reduces the number of register you can use in regular programming.

PUSH RR/ POP RR (11T/10T)
These actually, allow you to save the registers on stack, or somewhere else you might move the stack to.
However, to save the registers, and then restore them, you will need a lot of operations:

Code: Select all

PUSH AF
PUSH BC
PUSH DE
PUSH HL

... do the interrupt magic here

POP HL
POP DE
POP BC
POP AF
For the same registers, that you use EX AF, AF and EXX, you will need:
4 * 11T + 4 * 10T = 44 + 40 = 88T

Which is a lot different from 4 + 4 = 8T, for the Swap instructions.

NOTE: I did not include PUSH/POP for IX and IY, to be fair on the comparison.
User avatar
RMartins
Manic Miner
Posts: 776
Joined: Thu Nov 16, 2017 3:26 pm

Re: Beginner's ASM Tutorial: Multiplatform Z80 ASM development videos... with vampires!

Post by RMartins »

Just a correction, for the Swap instructions, we need 4 instructions, not 2:

Code: Select all

EX AF, AF'
EXX

... do the interrupt magic here

EX AF, AF'
EXX
Which is ( 4 + 4 ) + ( 4 + 4 ) = 16T
Still a long way from the 88T for the PUSH/POP solution.
User avatar
g0blinish
Manic Miner
Posts: 281
Joined: Sun Jun 17, 2018 2:54 pm

Re: Beginner's ASM Tutorial: Multiplatform Z80 ASM development videos... with vampires!

Post by g0blinish »

RMartins wrote: Thu May 24, 2018 6:41 pm Just a correction, for the Swap instructions, we need 4 instructions, not 2:

Code: Select all

EX AF, AF'
EXX

... do the interrupt magic here

EX AF, AF'
EXX
Which is ( 4 + 4 ) + ( 4 + 4 ) = 16T
Still a long way from the 88T for the PUSH/POP solution.
unsafe solution. If you are using music player into interrupt, alt pairs may changed
Post Reply