WinAPE and EXX in assembler

Started by ervin, 17:08, 09 September 10

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ervin

Hi all.

I'm having a rather odd problem.

This code causes strange behaviour when assembled and run from WinAPE's assembler:
org &4000

di
exx
ld bc,2
exx
ei

ret


As far as I understand it, this should be ok, as HL, DE & BC all have alternate registers which can be accessed via EXX.
The above code is fine if I use HL or DE instead of BC.

Am I doing something wrong?
Or does WinAPE have a problem with this sort of thing?

Thanks for any help.

arnoldemu

Quote from: ervin on 17:08, 09 September 10
Hi all.

I'm having a rather odd problem.

This code causes strange behaviour when assembled and run from WinAPE's assembler:
org &4000

di
exx
ld bc,2
exx
ei

ret


As far as I understand it, this should be ok, as HL, DE & BC all have alternate registers which can be accessed via EXX.
The above code is fine if I use HL or DE instead of BC.

Am I doing something wrong?
Or does WinAPE have a problem with this sort of thing?

Thanks for any help.
I see you're returning back to basic.
Basic/firmware uses BC' to store the I/O address of the gate-array and the current state of the roms and video mode.

So really you need to store firmware's version of BC' and restore it back before you return.
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

ervin

Quote from: arnoldemu on 17:10, 09 September 10
I see you're returning back to basic.
Basic/firmware uses BC' to store the I/O address of the gate-array and the current state of the roms and video mode.

So really you need to store firmware's version of BC' and restore it back before you return.

Holy cow that was a quick reply!

Okay, I've changed the code to this:
org &4000

di
exx
push bc
ld bc,2
pop bc
exx
ei

ret


and the problem has gone away!

Awesome stuff. Thanks for your help dude.

TFM

You also should save the content of AF' under BASIC. Using CP/M you can use all the registers of the Z80.
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

ervin


Powered by SMFPacks Menu Editor Mod