[Coco] 6309 MULD real and emulators

Walter Zambotti zambotti at iinet.net.au
Fri Oct 25 02:04:15 EDT 2019


Robert

On OVCC it has already been correct in version 1.1.

In my recent 6309 emulator rewrite in X86 assembly I added all the missing ops and corrected some other 6309 ops that I thought were not correct.

I also did this in the C version.  The C version should be backwards portable to VCC with very little effort.

Walter	

Here is the OVCC muld C code

void Muld_M(void)
{ //118F Phase 5 6309
	Q_REG =  (signed short)D_REG * (signed short)IMMADDRESS(PC_REG);
	cc[C] = 0; 
	cc[Z] = ZTEST(Q_REG);
	cc[V] = 0;
	cc[N] = NTEST32(Q_REG);
	PC_REG+=2;
	CycleCounter+=28;
}

-----Original Message-----
From: Coco [mailto:coco-bounces at maltedmedia.com] On Behalf Of Robert Gault
Sent: Friday, 25 October 2019 10:47 AM
To: CoCoList for Color Computer Enthusiasts <coco at maltedmedia.com>
Subject: [Coco] 6309 MULD real and emulators

There was a question posted about the 6309 opcode MULD. That is a multiplication of the content of regD with Immediate, Direct, Extended, or Indexed numbers. What makes it different from the opcode MUL is that MULD is a signed multiplication.

However, be warned that while for a real 6309, and the MAME/MESS emulator MULD is signed, it is unsigned with VCC v2.0.1. VCC should be corrected!
ex.
  real 6309
  ldd #$8001
  muld #$8001
  regQ = $3FFF0001

  VCC
  ldd #$8001
  muld #$8001
  regQ = $40010001     Correct if the multiplication was unsigned.

You can get the same $3FFF0001 answer with real 6309
  ldd #$7FFF
  muld #$7FFF
regQ = $3FFF0001

Now since $10000-$7FFF=$8001 the above signed math makes sense as $8001=-$7FFF.

Robert

--
Coco mailing list
Coco at maltedmedia.com
https://pairlist5.pair.net/mailman/listinfo/coco



More information about the Coco mailing list