FAQ  •  Register  •  Login

asm context issue?

<<

britlion

Posts: 680

Joined: Mon Apr 27, 2009 7:26 pm

Location: Slough, Berkshire, UK

Post Tue Oct 25, 2011 9:41 pm

asm context issue?

  Code:
asm
sub a,3
end asm


I think this is expecting sub to be the basic context subroutine, not the asm subtract command, so fails to compile?

zxb 1.2.8-s758
<<

boriel

Site Admin

Posts: 1158

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Tue Oct 25, 2011 10:01 pm

Re: asm context issue?

According to the ZX Spectrum manual, the Z80 syntax instruction is sub N not sub a, N for 8 bits.
So:
  Code:
asm
sub 3
end asm

should work ok.
Try this and tell me :?:
<<

britlion

Posts: 680

Joined: Mon Apr 27, 2009 7:26 pm

Location: Slough, Berkshire, UK

Post Wed Oct 26, 2011 9:39 am

Re: asm context issue?

Ugh.

Looks like my reference may be incorrect:

  Code:
SUB A,imm8
Operation Subtracts the immediate value from A.
Op Code 11010110 : [imm8]
Flags S Z H C are affected as defined
P/V detects overflow
N is set
T States 7


You're right. It looks like Zilog officially use SUB N - which is inconsistent with all their other instructions! How bizarre!
<<

boriel

Site Admin

Posts: 1158

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Wed Oct 26, 2011 10:47 am

Re: asm context issue?

I used the speccy user manual to get the asm mnemonics! :mrgreen:
Anyway, I will try to make de ASM to allow SUB A, N also. :roll:

Return to Help & Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.

phpBB SEO