m_a_i_n --> _m_a_i_n
This commit is contained in:
parent
76d79cf17a
commit
b893ec7013
|
@ -8,7 +8,7 @@ The remaining way to interact, interrupts, will be treated
|
|||
together with traps in chapter 9.
|
||||
.S2 "Program starting and stopping"
|
||||
EM user programs start with a call to a procedure called
|
||||
m_a_i_n.
|
||||
_m_a_i_n.
|
||||
The assembler and backends look for the definition of a procedure
|
||||
with this name in their input.
|
||||
The call passes three parameters to the procedure.
|
||||
|
@ -45,7 +45,7 @@ The
|
|||
is terminated by a zero pointer.
|
||||
.P
|
||||
An EM user program stops if the program returns from the first
|
||||
invocation of m_a_i_n.
|
||||
invocation of _m_a_i_n.
|
||||
The contents of the function return area are used to procure a
|
||||
wordsized program return code.
|
||||
EM programs also stop when traps and interrupts occur that are
|
||||
|
|
|
@ -545,7 +545,7 @@ stackpointer are set to 0x1000 and 0x8000 respectively.
|
|||
.br
|
||||
Other systems require other values.
|
||||
.IP 2)
|
||||
In 'head_em': before calling "_m_a_i_n", the environment
|
||||
In 'head_em': before calling "__m_a_i_n", the environment
|
||||
pointer, argument vector and argument count will have to be pushed
|
||||
onto the stack.
|
||||
Since this back-end is tested on a system without any knowledge
|
||||
|
|
|
@ -36,7 +36,7 @@ stackpointer are set to 0x1000 and 0x7ffe respectivally.
|
|||
The latter because it could run on a 32K machine as well.
|
||||
Other systems require other values.
|
||||
.IP 2)
|
||||
In \fIhead_em\fP: before calling "_m_a_i_n", the environment
|
||||
In \fIhead_em\fP: before calling "__m_a_i_n", the environment
|
||||
pointer, argument vector and argument count will have to be pushed
|
||||
onto the stack.
|
||||
Since this back-end is tested on a system without any knowledge
|
||||
|
|
|
@ -182,8 +182,8 @@ combine() {
|
|||
if (nhol)
|
||||
printf(" hol %d,0,0\n", nhol);
|
||||
copy(name1);
|
||||
printf(" exp $m_a_i_n\n");
|
||||
printf(" pro $m_a_i_n,%d\n", nlocals);
|
||||
printf(" exp $_m_a_i_n\n");
|
||||
printf(" pro $_m_a_i_n,%d\n", nlocals);
|
||||
printf(" loc 123\n");
|
||||
printf(" loc -98\n");
|
||||
copy(name2);
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/* Author: E.G. Keizer */
|
||||
|
||||
mes 2,_EM_WSIZE,_EM_PSIZE
|
||||
|
||||
exa environ
|
||||
|
@ -27,8 +25,8 @@
|
|||
_penvp
|
||||
bss _EM_PSIZE,0,0
|
||||
|
||||
exp $m_a_i_n
|
||||
pro $m_a_i_n,0
|
||||
exp $_m_a_i_n
|
||||
pro $_m_a_i_n,0
|
||||
loc 1336 ; EIOVFL | EIUND | ECONV | EFOVFL | EFUNFL
|
||||
sim ; ignored
|
||||
lal _EM_WSIZE+_EM_PSIZE
|
||||
|
|
|
@ -28,8 +28,8 @@ environ
|
|||
_penvp
|
||||
bss EM_PSIZE,0,0
|
||||
|
||||
exp $m_a_i_n
|
||||
pro $m_a_i_n,0
|
||||
exp $_m_a_i_n
|
||||
pro $_m_a_i_n,0
|
||||
#if EM_WSIZE==1
|
||||
ldc 1336 ; EIOVFL | EIUND | ECONV | EFOVFL | EFUNFL
|
||||
#else
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
bkillbss
|
||||
bss EM_PSIZE,0,0
|
||||
|
||||
exp $m_a_i_n
|
||||
pro $m_a_i_n, 0
|
||||
exp $_m_a_i_n
|
||||
pro $_m_a_i_n, 0
|
||||
|
||||
lor 0
|
||||
lae MainLB
|
||||
|
|
|
@ -118,8 +118,8 @@ CodeBeginBlock(df)
|
|||
|
||||
if ( df->df_kind == D_MODULE) /* nothing */ ;
|
||||
else if (df->df_kind == D_PROGRAM ) {
|
||||
C_exp("m_a_i_n");
|
||||
C_pro_narg("m_a_i_n");
|
||||
C_exp("_m_a_i_n");
|
||||
C_pro_narg("_m_a_i_n");
|
||||
C_ms_par((arith) 0);
|
||||
offset = CodeGtoDescr(df->prc_vis->sc_scope);
|
||||
CodeFil();
|
||||
|
|
|
@ -241,7 +241,7 @@ stb_string(df, kind)
|
|||
addc_db_str(':');
|
||||
if (kind == D_MODULE) {
|
||||
adds_db_str(sprint(buf, "M%d;", df->prc_vis->sc_count));
|
||||
C_ms_stb_pnam(db_str.base, N_FUN, proclevel, "m_a_i_n");
|
||||
C_ms_stb_pnam(db_str.base, N_FUN, proclevel, "_m_a_i_n");
|
||||
return;
|
||||
}
|
||||
switch((int)kind) {
|
||||
|
|
|
@ -29,7 +29,7 @@ extern int _gtty();
|
|||
|
||||
struct file **_extfl;
|
||||
int _extflc; /* number of external files */
|
||||
char *_m_lb; /* LB of m_a_i_n */
|
||||
char *_m_lb; /* LB of _m_a_i_n */
|
||||
struct file *_curfil; /* points to file struct in case of errors */
|
||||
int _pargc;
|
||||
char **_pargv;
|
||||
|
|
|
@ -99,7 +99,7 @@ UNSIGN : .space 1 ! is it signed or unsigned arithmetic
|
|||
TRAPVAL: .space 1 ! intermediate storage of the error number
|
||||
|
||||
STACK: .space 1 ! contains the hardware stackpointer on
|
||||
! entering m_a_i_n for a neat return
|
||||
! entering _m_a_i_n for a neat return
|
||||
|
||||
RESERVED: .space 112 ! used by the operating system
|
||||
|
||||
|
@ -174,7 +174,7 @@ start:
|
|||
lda #0
|
||||
ldx #1
|
||||
jsr Push ! push argc
|
||||
jsr _m_a_i_n ! start the real program
|
||||
jsr __m_a_i_n ! start the real program
|
||||
|
||||
lda #0x0FF
|
||||
jsr WRCH ! send end of program to R423
|
||||
|
|
|
@ -140,7 +140,7 @@ next3:
|
|||
ADR R11, argc
|
||||
LDR R11,[R11]
|
||||
STMFD R12<,{R11}
|
||||
BAL.L _m_a_i_n
|
||||
BAL.L __m_a_i_n
|
||||
MOV R11,#0
|
||||
STMFD R12<,{R11}
|
||||
MOV R11,#1
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
.sect .text; .sect .rom; .sect .data; .sect .bss
|
||||
|
||||
.define begtext,begdata,begbss,syscal
|
||||
.define begtext,begdata,begbss
|
||||
.define hol0,.reghp,.limhp,.trppc,.ignmask
|
||||
.define ERANGE,ESET,EHEAP,ECASE,EILLINS,EIDIVZ,EODDZ
|
||||
.extern _end
|
||||
|
||||
ERANGE = 1
|
||||
ESET = 2
|
||||
|
@ -35,7 +34,7 @@ begtext:
|
|||
push ax
|
||||
push bx
|
||||
push cx
|
||||
call _m_a_i_n
|
||||
call __m_a_i_n
|
||||
push ax
|
||||
call __exit
|
||||
.sect .data
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
push h
|
||||
lxi h,0
|
||||
push h
|
||||
call _m_a_i_n
|
||||
call __m_a_i_n
|
||||
.stop: jmp 0xfb52
|
||||
|
||||
.sect .bss
|
||||
|
|
|
@ -26,7 +26,7 @@ begtext:
|
|||
push bx
|
||||
push cx
|
||||
xor bp,bp
|
||||
call _m_a_i_n
|
||||
call __m_a_i_n
|
||||
int 0x81
|
||||
.sect .data
|
||||
begdata:
|
||||
|
|
|
@ -43,7 +43,7 @@ begtext:
|
|||
move.l a0,(8,sp) ! env
|
||||
! move.l a0, environ ! indir is 0 if no env; not 0 if env
|
||||
! jsr (initfpu) ! call to dummy floating point init routine
|
||||
jsr (_m_a_i_n)
|
||||
jsr (__m_a_i_n)
|
||||
move.l d0,(sp) ! no stack cleanup needed
|
||||
EXIT:
|
||||
jsr (__exit)
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
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.
|
||||
At present it does not support floating point operations.
|
||||
(All EM floating point instructions are translated to the
|
||||
68000 "trap" instruction.)
|
||||
The m68k2 back end generates code for the ACK 68000 assembler.
|
||||
(The mnemonics recognized by this assembler can be found in
|
||||
"as/mach3.c").
|
||||
|
@ -32,17 +29,16 @@ on the kind of target 68000 system.
|
|||
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. Note that the program
|
||||
generates no text or bss segments, but only a data segment.
|
||||
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).
|
||||
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
|
||||
a 4-byte argc, while __m_a_i_n expects a 2-byte argc; so the value
|
||||
must be shortened to 2 bytes.
|
||||
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ begtext:
|
|||
! envp pointer.
|
||||
|
||||
add.l #2,sp !convert argc from 4-byte to 2-byte
|
||||
jsr _m_a_i_n
|
||||
jsr __m_a_i_n
|
||||
add #010,sp
|
||||
EXIT:
|
||||
move.w d0,-(sp)
|
||||
|
|
|
@ -50,7 +50,7 @@ begtext:
|
|||
! Now the stack contains an argc (4 bytes), argv-pointer and
|
||||
! envp pointer.
|
||||
|
||||
jsr _m_a_i_n
|
||||
jsr __m_a_i_n
|
||||
add #012,sp
|
||||
EXIT:
|
||||
move.l d0,-(sp)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
.define filb
|
||||
.define _m_a_i_n
|
||||
.define __m_a_i_n
|
||||
.define curproc
|
||||
.define pd
|
||||
.define nproc
|
||||
|
@ -25,7 +25,7 @@
|
|||
! START OF THE PROGRAM
|
||||
!---------------------------------------------------------------------------
|
||||
|
||||
_m_a_i_n:
|
||||
__m_a_i_n:
|
||||
#ifdef __BSD4_2
|
||||
jsr getmask
|
||||
#endif
|
||||
|
|
|
@ -50,7 +50,7 @@ begtext:
|
|||
! Now the stack contains an argc (4 bytes), argv-pointer and
|
||||
! envp pointer.
|
||||
|
||||
jsr _m_a_i_n
|
||||
jsr __m_a_i_n
|
||||
add #012,sp
|
||||
EXIT:
|
||||
move.l d0,-(sp)
|
||||
|
|
|
@ -25,7 +25,7 @@ begtext:
|
|||
push bx
|
||||
push cx
|
||||
xor bp,bp
|
||||
call _m_a_i_n
|
||||
call __m_a_i_n
|
||||
add sp,6
|
||||
call __exit
|
||||
.sect .data
|
||||
|
|
|
@ -37,11 +37,11 @@ begtext:
|
|||
move.l a1,-(sp) ! push environ
|
||||
move.l a0,-(sp) ! push argv
|
||||
move.w d0,-(sp) ! push argc
|
||||
jsr _m_a_i_n
|
||||
jsr __m_a_i_n
|
||||
add #010,sp
|
||||
EXIT:
|
||||
move.w d0,-(sp)
|
||||
jsr _exit
|
||||
jsr __exit
|
||||
L0: bra L0
|
||||
|
||||
.sect .data
|
||||
|
|
|
@ -27,7 +27,7 @@ ECASE = 20
|
|||
movd envp,tos
|
||||
movd argv,tos
|
||||
movd 1,tos
|
||||
jsr @_m_a_i_n
|
||||
jsr @__m_a_i_n
|
||||
.stop:
|
||||
movb 0x7f,tos
|
||||
jsr @.putchar
|
||||
|
|
|
@ -44,7 +44,7 @@ ECASE = 024
|
|||
tst -(r0)
|
||||
1:
|
||||
mov r0,4(sp)
|
||||
jsr pc,_m_a_i_n
|
||||
jsr pc,__m_a_i_n
|
||||
! next two lines for as long as tail needs printf
|
||||
! mov r0,-(sp)
|
||||
! jsr pc,*$_exit
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
.define CERASE,CKILL,CSTOP,CSTART
|
||||
.define .lino,.filn
|
||||
.define F_DUM,EXIT
|
||||
.define EXIT
|
||||
.define begtext,begdata,begbss
|
||||
.define EARRAY,ERANGE,ESET,EIDIVZ,EHEAP,EILLINS,ECASE
|
||||
.define hol0,.reghp,.limhp,.trpim,.trppc
|
||||
|
@ -14,13 +13,6 @@
|
|||
|
||||
|
||||
|
||||
CERASE = 010
|
||||
CKILL = 030
|
||||
CSTART = 021
|
||||
CSTOP = 023
|
||||
F_DUM = 0
|
||||
|
||||
|
||||
LINO_AD = 0
|
||||
FILN_AD = 4
|
||||
|
||||
|
@ -35,7 +27,7 @@ ECASE = 20
|
|||
.sect .text
|
||||
begtext:
|
||||
add.l #2,sp !convert argc from 4-byte to 2-byte
|
||||
jsr _m_a_i_n
|
||||
jsr __m_a_i_n
|
||||
add #010,sp
|
||||
EXIT:
|
||||
move.w d0,-(sp)
|
||||
|
|
|
@ -34,7 +34,7 @@ ECASE = 20
|
|||
|
||||
.sect .text
|
||||
begtext:
|
||||
jsr _m_a_i_n
|
||||
jsr __m_a_i_n
|
||||
add #012,sp
|
||||
EXIT:
|
||||
|
||||
|
|
|
@ -38,10 +38,10 @@ begtext:
|
|||
pea (a0)
|
||||
move.l d2,-(sp)
|
||||
move.l #0,a6
|
||||
jsr _m_a_i_n
|
||||
jsr __m_a_i_n
|
||||
move.l d0,(sp) ! no stack cleanup needed
|
||||
EXIT:
|
||||
jsr _exit
|
||||
jsr __exit
|
||||
|
||||
.sect .data
|
||||
begdata:
|
||||
|
|
|
@ -40,10 +40,10 @@ begtext:
|
|||
move.l d2,-(sp)
|
||||
move.l #0,a6
|
||||
jsr (fsoft_used)
|
||||
jsr (_m_a_i_n)
|
||||
jsr (__m_a_i_n)
|
||||
move.l d0,(sp) ! no stack cleanup needed
|
||||
EXIT:
|
||||
jsr (_exit)
|
||||
jsr (__exit)
|
||||
|
||||
fsoft_used:
|
||||
start_float:
|
||||
|
|
|
@ -38,10 +38,10 @@ begtext:
|
|||
pea (a0)
|
||||
move.l d2,-(sp)
|
||||
move.l #0,a6
|
||||
jsr (_m_a_i_n)
|
||||
jsr (__m_a_i_n)
|
||||
move.l d0,(sp) ! no stack cleanup needed
|
||||
EXIT:
|
||||
jsr (_exit)
|
||||
jsr (__exit)
|
||||
|
||||
.sect .data
|
||||
begdata:
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
pushl r0
|
||||
pushl r2
|
||||
pushl r1
|
||||
calls $3,_m_a_i_n
|
||||
calls $3,__m_a_i_n
|
||||
movl $Im2,ap
|
||||
movl r0,6(ap)
|
||||
chmk (ap)+
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
pushl r0
|
||||
pushl r2
|
||||
pushl r1
|
||||
calls $3,_m_a_i_n
|
||||
calls $3,__m_a_i_n
|
||||
movl $Im2,ap
|
||||
movl r0,6(ap)
|
||||
chmk (ap)+
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
pushl r0
|
||||
pushl r2
|
||||
pushl r1
|
||||
calls $3,_m_a_i_n
|
||||
calls $3,__m_a_i_n
|
||||
movl $Im2,ap
|
||||
movl r0,6(ap)
|
||||
chmk (ap)+
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
.define begtext,begdata,begbss,syscal
|
||||
.define hol0,.reghp,.limhp,.trppc,.ignmask
|
||||
.define ERANGE,ESET,EHEAP,ECASE,EILLINS,EIDIVZ,EODDZ
|
||||
.extern _end
|
||||
.extern endbss
|
||||
|
||||
ERANGE = 1
|
||||
ESET = 2
|
||||
|
@ -42,7 +42,7 @@ begtext:
|
|||
push bx
|
||||
push cx
|
||||
xor bp,bp
|
||||
mov bx,_end
|
||||
mov bx,endbss
|
||||
mov cx,9
|
||||
add bx,1024
|
||||
shr bx,cl
|
||||
|
@ -50,11 +50,11 @@ begtext:
|
|||
call grow
|
||||
xor cx,cx
|
||||
push cx
|
||||
call _sbrk
|
||||
call __sbrk
|
||||
mov (.limhp),ax
|
||||
mov (.reghp),ax ! on Xenix, heap begins above stack!
|
||||
pop ax
|
||||
call _m_a_i_n
|
||||
call __m_a_i_n
|
||||
push ax
|
||||
call __exit
|
||||
.sect .data
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
push bc
|
||||
ld bc,1
|
||||
push bc
|
||||
call _m_a_i_n
|
||||
call __m_a_i_n
|
||||
|
||||
jp 0x20
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
push bc
|
||||
ld bc,1
|
||||
push bc
|
||||
call _m_a_i_n
|
||||
call __m_a_i_n
|
||||
|
||||
jp 0x20
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ EBADMON = 25
|
|||
push *RR14, envp
|
||||
push *RR14, argv
|
||||
push *RR14, $1
|
||||
calr _m_a_i_n
|
||||
calr __m_a_i_n
|
||||
ldl RR14, $0xC00017FC
|
||||
sc $0
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ struct rel { /* for relocation tables */
|
|||
#define DATA_BYTES 9
|
||||
|
||||
/* name of procedure to be called first */
|
||||
#define MAIN "m_a_i_n"
|
||||
#define MAIN "_m_a_i_n"
|
||||
|
||||
/* headers of datablocks written */
|
||||
#define HEADREP 0
|
||||
|
|
Loading…
Reference in a new issue