Some questions about the MC6839

Sean Conner spc at conman.org
Mon Jun 27 20:35:58 CDT 2016


(My original message to cctech has yet to appear.  I thought I might try the
cctalk list).

  While Motorola never shipped the MC6839 [1] the binary is available [2]
and I've been playing around with it [3].  While it's not producing the
exact same results as I get on a more modern machine, it appears to be
"close enough" for me to be happy with it.  But I am having one issue that I
can't figure out.

  The documentation for the FMOV operation says:

	FMOV	Move (or convert) arg1 -> arg2.  This function is useful for
		changing precisions (e.g. single to double) with full
		exception processing for possible overflow and underflow.

  Okay.  And to call it [4]:

	------------------------------------------------------------------------------
        |Function|Opcode|  Register entry conditions   | Stack entry conditions
	------------------------------------------------------------------------------
        | FMOV   | $1A  | U =  precision parameter word| push arg
        |        |      | Y -> argument                | push precision param word
        |        |      | D -> fpcb                    | push ptr to fpcb
        |        |      | X -> result                  | call FPO9
        |        |      |                              | pull result
	------------------------------------------------------------------------------

        For moves, U contains a parameter word describing the size of the
        source and destination arguments.  The bits are as follows, where
        the size is as defined in the fpcb control byte

        Bits 0-2  : Destination size
        Bits 3-7  : unused
        Bits 8-10 : Source size
        Bits 11-15: unused

  And the size bits are defined as:

	111 = reserved
	110 = reserved
	101 = reserved
	100 = extended - round result to double
	011 = extended - round result to single
	010 = extended - no forced rounding
	001 = double
	000 = single

  It appears that to convert from single to double, I would set U to $0001,
but the results are *so* far out of whack it's not even funny.  I've tried
setting U to point to the value $0001 and that doesn't work. I've tried
shifting the bits (because in the FPCB they're the upper three bits) and
that doesn't work.  I've tried reversing the registers and that doesn't
work.  Does anyone have the actual source code [4]?  Or know what I might be
doing wrong?

  -spc

[1]	A ROM with position independent 6809 object code that conforms (to
	what I can find) with IEEE 754 Draft 8.

[2]	Available in the file fpo9.lzh here
	https://ftplike.com/browser/os9archive.rtsi.com/OS9/OS9_6X09/PROG/

[3]	Using a 6809 emulator library I wrote: https://github.com/spc476/mc6809
	Not much documentation I'm afraid.

[4]	Register entry: ROM base address + $003D
	Stack entry:    ROM base address + $003F

[5]	I'm lead to believe that Motorola release the code into the public
	domain.



More information about the cctech mailing list