News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_Neurox66

Mistake with registers

Started by Neurox66, 07:29, 03 June 23

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Neurox66

Hello everyone, 
I use Pasmo as my compiler and I have a problem with the allocation between registers. 
If I write : 
ld bc, hl 
Pasmo returns an error because it expects a value instead of hl. 
Is there an alternative?
Thanks,
Paolo
CPC 464+ with C4CPC and Gotek HxC USB Drive - 
CPC 6128+ with Nova, FlashGordon,AmsDap, SymbiFace III -
CPC 6128 with M4 ... and other Amstrad computers

trocoloco

Hi Paolo, "ld bc,hl" is not a z80 instruction. If you want to assign hl to bc, you can use the stack like this

push hl
pop bc

or this option which is faster for the same amount of bytes

ld b,h
ld c,l

Neurox66

Hi,
How silly of me :doh:
Thanks for the tip, it obviously works great.

Paolo
CPC 464+ with C4CPC and Gotek HxC USB Drive - 
CPC 6128+ with Nova, FlashGordon,AmsDap, SymbiFace III -
CPC 6128 with M4 ... and other Amstrad computers

andycadley

Easy mistake to make, especially because a lot of assemblers will accept pseudo opcodes like this.

asertus

I always use this table to be sure about "accepted" instructions..

https://clrhome.org/table/


Powered by SMFPacks Menu Editor Mod