ack/mach/m68k2
George Koehler a434749fd9 Widen valu_t in the assembler to 64 bits.
Most machines had undefined valu_t and redefined it to a different
type.  Edit mach/*/as/mach0.c to remove such redefinitions, so the
next change to valu_t will affect all machines.

Edit mach/proto/as/comm0.h to change valu_t to int64_t, and add
uvalu_t and uint64_t.

Remove int64_t y_valu8 from the yacc %union, now that valu_t y_valu
can hold 64 bits.  Replace y_valu8 with y_valu.  The .data8 pseudo
becomes less special; it now accepts absolute expressions.

This change simplifies the assembler and seems to have no effect on
the assembled output.  Among the files in share/ack/examples, the only
changes are in hilo_bas.* and startrek_c.linuxppc, but those files
seem to change whenever I rebuild them.
2019-10-04 18:58:56 -04:00
..
as Widen valu_t in the assembler to 64 bits. 2019-10-04 18:58:56 -04:00
cv Distributions are a pain --- let's not bother any more. Instead, we just tag 2016-09-02 23:00:38 +02:00
dl Distributions are a pain --- let's not bother any more. Instead, we just tag 2016-09-02 23:00:38 +02:00
libem Distributions are a pain --- let's not bother any more. Instead, we just tag 2016-09-02 23:00:38 +02:00
libend Distributions are a pain --- let's not bother any more. Instead, we just tag 2016-09-02 23:00:38 +02:00
libfp Distributions are a pain --- let's not bother any more. Instead, we just tag 2016-09-02 23:00:38 +02:00
libsys Distributions are a pain --- let's not bother any more. Instead, we just tag 2016-09-02 23:00:38 +02:00
ncg Distributions are a pain --- let's not bother any more. Instead, we just tag 2016-09-02 23:00:38 +02:00
top Distributions are a pain --- let's not bother any more. Instead, we just tag 2016-09-02 23:00:38 +02:00
Action cv was made twice 1991-10-25 09:32:18 +00:00
mach_params Fixed mach_params 1991-09-18 09:58:12 +00:00
README m_a_i_n --> _m_a_i_n 1991-03-06 14:26:16 +00:00
Unisoft_bug Replaced references to /usr/tmp with references to /tmp. 2005-06-24 22:08:47 +00:00

The m68k2 back end is an EM code generator for the
Motorola MC68000. It defines an integer to be 16 bits
and a pointer to be 32 bits.
The m68k2 back end generates code for the ACK 68000 assembler.
(The mnemonics recognized by this assembler can be found in
"as/mach3.c").

Some parts of the back end are system dependent, i.e. they depend
on the kind of target 68000 system.
   -	The way to do a Unix system call may vary from system to system.
	For every system call you need to have an assembly routine that
	passes the arguments and the system call number to Unix.
	These routines should be put in the library file "lib/tail_mon".
	The distribution contains a tail_mon file tailored for
	UniSoft Unix (see directory "libsys").
	Beware that several Unix systems (e.g. UniSoft Unix) use 4-byte
	integers, whereas the m68k2 back end produces code for 2-byte
	integers. In this case all system calls having an "int" parameter
	should convert their parameters to "long"s.
   -	Most systems require some sort of "test for enough stack space"
	at the beginning of every procedure, to get around the "back up"
	problem. E.g. UniSoft Unix requires a "tst.b N(sp)" instruction
	This instruction is generated by the routines "prolog()" and
	"save" in "cg/mach.c".
   -	The output of the ACK 68000 linker is an a.out file that
	has a different format as an a.out file on your system. (As most
	68000 systems have different a.out formats, there is no such thing
	as "the" 68000 a.out format). So a program is needed to convert the
	ACK a.out format to your a.out format (as defined in
	"/usr/include/a.out.h"). The program "cv/cv.c" does
	the job for UniSoft Unix. It probably need only be slightly
	modified for your system.
	If your target 68000 does not run Unix, but is e.g. a stand alone
	68000, you will need a program to download the ACK a.out file.
	The program "dl/dl.c" produces Intel Hex format on standard output
	from an a.out file.
   -	The EM runtime start-off ("libsys/head_em.s") may have to be modified.
	It should call the procedure __m_a_i_n with parameters (argc,argv,envp).
	Usually, Unix will put these on top of the stack before starting
	the program. Note, however, that for 4-byte systems Unix will provide
	a 4-byte argc, while __m_a_i_n expects a 2-byte argc; so the value
	must be shortened to 2 bytes.


The m68k2 code generator translates most EM instructions in line.
For some complex EM instructions it uses assembly routines (stored in the
library "libem/libem_s.a").

The generated code does not check for array bound errors, overflow in
arithmetic operations or division by zero (the latter will cause a hardware
trap).

The code generator has the following register conventions:
	a7:		stack pointer
	a6:		local base pointer
	a0,a1,d0,d1,d2:	scratch registers
			(d0 is also used for 2/4 bytes function results;
			 d0 and d1 are used for 8 bytes function results)
	a2-a5,d3-d7:	register variables.