fixup commit for tag 'distr3'
This commit is contained in:
@@ -1,49 +0,0 @@
|
||||
.define hol0, argv, envp, begbss
|
||||
.define .ignmask,.reghp,.trapproc,.fra
|
||||
.define .retadr,.retadr1,.areg,.bcreg,.tmp1
|
||||
.define block1, block2, block3
|
||||
.define .stop
|
||||
|
||||
.base 0x1000
|
||||
.text
|
||||
lxi h,0x1000 ! stack will grow from 0x1000 downwards
|
||||
sphl
|
||||
lxi h,begbss ! clear bss
|
||||
lxi d,endbss-begbss
|
||||
mvi c,0
|
||||
|
||||
2: mov m,c
|
||||
inx h
|
||||
dcx d
|
||||
mov a,e
|
||||
ora d
|
||||
jnz 2b
|
||||
|
||||
lxi h,envp ! call main
|
||||
push h
|
||||
lxi h,argv
|
||||
push h
|
||||
lxi h,0
|
||||
push h
|
||||
call _m_a_i_n
|
||||
.stop: jmp 0xfb52
|
||||
|
||||
.bss
|
||||
begbss:
|
||||
.trapproc: .space 2
|
||||
.ignmask: .space 2
|
||||
.data
|
||||
hol0: .space 8
|
||||
.reghp: .word endbss
|
||||
argv: .word 0
|
||||
envp: .word 0
|
||||
.retadr: .space 2 ! used to save return address
|
||||
.retadr1: .space 2 ! reserve
|
||||
.bcreg: .space 2 ! used to save localbase
|
||||
.areg: .space 1
|
||||
.tmp1: .space 2
|
||||
.fra: .space 8 ! 8 bytes function return area
|
||||
block1: .space 4 ! used by 32 bits divide and
|
||||
block2: .space 4 ! multiply routines
|
||||
block3: .space 4
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
.define endtext, enddata, endbss
|
||||
.text
|
||||
endtext: .align 2
|
||||
.data
|
||||
enddata: .align 2
|
||||
.bss
|
||||
endbss: .align 2
|
||||
@@ -1,9 +0,0 @@
|
||||
The mach?.c files in this directory were made for an earlier version of
|
||||
the universal assembler and are too dependent on its innards.
|
||||
I have no idea in what way they should be changed.
|
||||
|
||||
Duk Bekema
|
||||
|
||||
I adapted them to the new framework. It appears to work now.
|
||||
|
||||
Ceriel Jacobs
|
||||
@@ -1,16 +0,0 @@
|
||||
.define endtext,enddata,endbss
|
||||
.define _end,_etext,_edata
|
||||
|
||||
! $Header$
|
||||
.text
|
||||
endtext:
|
||||
_etext:
|
||||
.align 2
|
||||
.data
|
||||
enddata:
|
||||
_edata:
|
||||
.align 2
|
||||
.bss
|
||||
_end:
|
||||
endbss:
|
||||
.align 2
|
||||
@@ -1,170 +0,0 @@
|
||||
/*
|
||||
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include "out.h"
|
||||
|
||||
#ifndef NORCSID
|
||||
static char rcs_id[] = "$Header$" ;
|
||||
#endif
|
||||
|
||||
#define ASSERT(x) switch (2) { case 0: case (x): ; }
|
||||
|
||||
/*
|
||||
* Header and section table of new format object file.
|
||||
*/
|
||||
struct outhead outhead;
|
||||
struct outsect outsect[S_MAX];
|
||||
|
||||
char *output_file;
|
||||
int output_file_created;
|
||||
|
||||
char *program ;
|
||||
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
register int nsect;
|
||||
register struct outsect *sectp;
|
||||
register FILE *input;
|
||||
register FILE *output;
|
||||
|
||||
ASSERT(sizeof(struct outhead) == SZ_HEAD);
|
||||
ASSERT(sizeof(struct outsect) == SZ_SECT);
|
||||
|
||||
input = stdin; output = stdout;
|
||||
program= argv[0] ;
|
||||
switch (argc) {
|
||||
case 1: break;
|
||||
case 3: if ((output = fopen(argv[2], "w")) == (FILE *)0)
|
||||
fatal("Can't write %s.\n", argv[2]);
|
||||
output_file = argv[2];
|
||||
output_file_created = 1;
|
||||
/* FALLTHROUGH */
|
||||
case 2: if ((input = fopen(argv[1], "r")) == (FILE *)0)
|
||||
fatal("Can't read %s.\n", argv[1]);
|
||||
break;
|
||||
default:fatal("Usage: %s <as object> <dl object>.\n", argv[0]);
|
||||
}
|
||||
if ( !rhead(input,&outhead) )
|
||||
fatal("Reading header failed.\n");
|
||||
if (BADMAGIC(outhead))
|
||||
fatal("Not an ack object file.\n");
|
||||
if (outhead.oh_nrelo > 0)
|
||||
fprintf(stderr, "Warning: relocation information present.\n");
|
||||
for ( nsect=0 ; nsect<outhead.oh_nsect ; nsect++ )
|
||||
if ( !rsect(input,&outsect[nsect]) )
|
||||
fatal("Reading section table failed.\n");
|
||||
nsect = outhead.oh_nsect;
|
||||
sectp = outsect;
|
||||
while (nsect--) {
|
||||
register long flen;
|
||||
#ifdef DO_BSS
|
||||
register long zero;
|
||||
#endif DO_BSS
|
||||
long base;
|
||||
short cnt;
|
||||
char buffer[BUFSIZ];
|
||||
|
||||
base = sectp->os_base;
|
||||
flen = sectp->os_flen;
|
||||
#ifdef DO_BSS
|
||||
zero = sectp->os_size - flen;
|
||||
#endif DO_BSS
|
||||
|
||||
while (flen) {
|
||||
cnt = flen > BUFSIZ ? BUFSIZ : flen;
|
||||
if (fread((char *)buffer, 1, cnt, input) != cnt)
|
||||
fatal("Reading code bytes failed.\n");
|
||||
if (fwrite((char *)&base, 4, 1, output) != 1)
|
||||
fatal("Writing start address failed.\n");
|
||||
if (fwrite((char *)&cnt, 2, 1, output) != 1)
|
||||
fatal("Writing byte count failed.\n");
|
||||
if (fwrite((char *)buffer, 1, cnt, output) != cnt)
|
||||
fatal("Writing byte count failed.\n");
|
||||
base += cnt;
|
||||
flen -= cnt;
|
||||
}
|
||||
#ifdef DO_BSS
|
||||
while (zero) {
|
||||
cnt = zero > BUFSIZ ? BUFSIZ : zero;
|
||||
if (fwrite((char *)&base, 4, 1, output) != 1)
|
||||
fatal("Writing start address failed.\n");
|
||||
if (fwrite((char *)&cnt, 2, 1, output) != 1)
|
||||
fatal("Writing byte count failed.\n");
|
||||
if (fseek(output, (long)cnt, 1) < (long)0)
|
||||
fatal("Fseek failed.\n");
|
||||
base += cnt;
|
||||
zero -= cnt;
|
||||
}
|
||||
#endif DO_BSS
|
||||
sectp++;
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
rhead(f,head) struct outhead *head ; FILE *f ; {
|
||||
char buf[SZ_HEAD] ;
|
||||
if ( fread(buf,SZ_HEAD,1,f)!=1 ) return 0 ;
|
||||
iconvert(buf,(char *)head,SF_HEAD) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
rsect(f,sect) struct outsect *sect ; FILE *f ; {
|
||||
char buf[SZ_SECT] ;
|
||||
if ( fread(buf,SZ_SECT,1,f)!=1 ) return 0 ;
|
||||
iconvert(buf,(char *)sect,SF_SECT) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
rrelo(f,relo) struct outrelo *relo ; FILE *f ; {
|
||||
char buf[SZ_RELO] ;
|
||||
if ( fread(buf,SZ_RELO,1,f)!=1 ) return 0 ;
|
||||
iconvert(buf,(char *)relo,SF_RELO) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
rname(f,name) struct outname *name ; FILE *f ; {
|
||||
char buf[SZ_NAME] ;
|
||||
if ( fread(buf,SZ_NAME,1,f)!=1 ) return 0 ;
|
||||
iconvert(buf,(char *)name,SF_NAME) ;
|
||||
return 1 ;
|
||||
}
|
||||
|
||||
iconvert(buf,str,fmt) char *buf, *str, *fmt ; {
|
||||
register char *nf, *ni, *no ;
|
||||
int last, i ;
|
||||
long value ;
|
||||
ni=buf ; no=str ; nf=fmt ;
|
||||
while ( last = *nf++ ) {
|
||||
last -= '0' ;
|
||||
if ( last<1 || last >9 ) fatal("illegal out.h format string\n");
|
||||
value=0 ;
|
||||
i=last ;
|
||||
while ( i-- ) {
|
||||
value = (value<<8) + (ni[i]&0xFF) ;
|
||||
}
|
||||
switch ( last ) {
|
||||
case 0 : break ;
|
||||
case 1 : *no= value ; break ;
|
||||
case 2 : *(unsigned short *)no = value ; break ;
|
||||
case 4 : *(long *)no = value ; break ;
|
||||
default :
|
||||
fatal("illegal out.h format string\n");
|
||||
}
|
||||
ni += last ; no += last ;
|
||||
}
|
||||
}
|
||||
|
||||
/* VARARGS1 */
|
||||
fatal(s, a1, a2)
|
||||
char *s;
|
||||
{
|
||||
fprintf(stderr,"%s: ",program) ;
|
||||
fprintf(stderr, s, a1, a2);
|
||||
if (output_file_created)
|
||||
unlink(output_file);
|
||||
exit(-1);
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
static char rcsid[] = "$Header$";
|
||||
/*
|
||||
* (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
*
|
||||
* This product is part of the Amsterdam Compiler Kit.
|
||||
*
|
||||
* Permission to use, sell, duplicate or disclose this software must be
|
||||
* obtained in writing. Requests for such permissions may be sent to
|
||||
*
|
||||
* Dr. Andrew S. Tanenbaum
|
||||
* Wiskundig Seminarium
|
||||
* Vrije Universiteit
|
||||
* Postbox 7161
|
||||
* 1007 MC Amsterdam
|
||||
* The Netherlands
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <a.out.h>
|
||||
|
||||
/*
|
||||
* NOTE: Beware that the a.out.h file included here should be the a.out.h
|
||||
* file of the TARGET machine, not of the SOURCE machine.
|
||||
*/
|
||||
|
||||
struct bhdr s_exec;
|
||||
|
||||
main(argc,argv) char **argv; {
|
||||
unsigned short losh,hish;
|
||||
long addr,maxaddr;
|
||||
short count;
|
||||
|
||||
maxaddr=0;
|
||||
if (argc != 3) {
|
||||
fprintf(stderr,"Usage: %s VU-a.out Bleasdale-a.out\n",argv[0]);
|
||||
exit(-1);
|
||||
}
|
||||
if (freopen(argv[1],"r",stdin)==NULL) {
|
||||
perror(argv[1]);
|
||||
exit(-1);
|
||||
}
|
||||
if (freopen(argv[2],"w",stdout)==NULL) {
|
||||
perror(argv[2]);
|
||||
exit(-1);
|
||||
}
|
||||
while (fread(&hish,sizeof(short),1,stdin)==1) {
|
||||
if (fread(&losh,sizeof(short),1,stdin)!=1)
|
||||
exit(fprintf(stderr,"foo\n"));
|
||||
addr=losh+(((long)hish)*65536L);
|
||||
addr -= 0x20000; /* entry point is 0x20000 on Bleasdale */
|
||||
if (fread(&count,sizeof(short),1,stdin)!=1)
|
||||
exit(fprintf(stderr,"bar\n"));
|
||||
fseek(stdout,addr+sizeof(s_exec),0);
|
||||
while (count--) {
|
||||
putchar(getchar());
|
||||
addr++;
|
||||
}
|
||||
if (addr>maxaddr)
|
||||
maxaddr = addr;
|
||||
}
|
||||
s_exec.fmagic = FMAGIC;
|
||||
s_exec.dsize = maxaddr;
|
||||
s_exec.entry = 0x20000;
|
||||
fseek(stdout,0L,0);
|
||||
fwrite(&s_exec,sizeof(s_exec),1,stdout);
|
||||
chmod(argv[2],0755);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
The original EM library routines saved all registers
|
||||
(including scratch registers) in global data; hence they
|
||||
were not reentrant.
|
||||
The new routines do not save registers d0,d1,d2,a0 and a1.
|
||||
They are reentrant.
|
||||
@@ -1,36 +0,0 @@
|
||||
.define .outch1,.outch2,.inch1,.inch2
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
|
||||
! a0,d0 used
|
||||
! character in d1
|
||||
|
||||
.sect .text
|
||||
.inch1:
|
||||
move.l #acia1,a0
|
||||
bra .inch
|
||||
.inch2:
|
||||
move.l #acia2,a0
|
||||
.inch:
|
||||
move.b (a0),d1
|
||||
asr #1,d1
|
||||
bcc .inch
|
||||
move.b 2(a0),d1
|
||||
and #0x7f,d1
|
||||
rts
|
||||
|
||||
.outch1:
|
||||
move.l #acia1,a0
|
||||
bra .outch
|
||||
.outch2:
|
||||
move.l #acia2,a0
|
||||
.outch:
|
||||
move.b (a0),d0
|
||||
asr #2,d0
|
||||
bcc .outch
|
||||
move.b d1,2(a0)
|
||||
rts
|
||||
|
||||
.align 2
|
||||
@@ -1,101 +0,0 @@
|
||||
.define .sar
|
||||
.define .lar
|
||||
.define .aar
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
|
||||
!register usage:
|
||||
! a0 : descriptor address
|
||||
! d0 : index
|
||||
! a1 : base address
|
||||
.sect .text
|
||||
.aar:
|
||||
move.l 4(sp),a0 ! descriptor address
|
||||
move.l 8(sp),d0 ! index
|
||||
sub.l (a0),d0 ! index - lower bound : relative index
|
||||
move.l 8(a0),-(sp) ! # bytes / element
|
||||
move.l d0,-(sp)
|
||||
jsr .mlu
|
||||
move.l 12(sp),a1 ! base address
|
||||
add.l d1,a1 ! address of element
|
||||
move.l (sp)+,a0 ! return address
|
||||
add.l #8,sp ! pop arguments
|
||||
move.l a1,(sp) ! returned on stack
|
||||
jmp (a0)
|
||||
|
||||
.lar:
|
||||
! register usage: like .aar
|
||||
|
||||
move.l 4(sp),a0
|
||||
move.l 8(sp),d0
|
||||
move.l 12(sp),a1
|
||||
sub.l (a0),d0
|
||||
move.l d0,-(sp)
|
||||
move.l 8(a0),-(sp)
|
||||
jsr .mlu
|
||||
move.l 12(sp),a1
|
||||
move.l 4(sp),a0
|
||||
add.l d1,a1 ! address of element
|
||||
move.l 8(a0),d0
|
||||
add.l d0,a1 ! a1++ because of predecrement
|
||||
move.l (sp)+,a0 ! return address
|
||||
add.l #12,sp ! pop parameters
|
||||
clr.l d1 !?nodig?
|
||||
asr #1,d0
|
||||
bne 3f
|
||||
move.b -(a1),d1 ! 1 byte element
|
||||
move.l d1,-(sp)
|
||||
bra 5f
|
||||
3:
|
||||
asr #1,d0
|
||||
bne 4f
|
||||
move.w -(a1),d1 ! 2 byte element
|
||||
move.l d1,-(sp)
|
||||
bra 5f
|
||||
4:
|
||||
sub.l #1,d0
|
||||
1:
|
||||
move.l -(a1),-(sp) ! 4n byte element (n = 1,2,...)
|
||||
dbf d0,1b
|
||||
5:
|
||||
jmp (a0)
|
||||
|
||||
.sar:
|
||||
!register usage: same as lar
|
||||
|
||||
move.l 4(sp),a0
|
||||
move.l 8(sp),d0
|
||||
move.l 12(sp),a1
|
||||
sub.l (a0),d0
|
||||
move.l d0,-(sp)
|
||||
move.l 8(a0),-(sp)
|
||||
jsr .mlu
|
||||
move.l 12(sp),a1
|
||||
move.l 4(sp),a0
|
||||
add.l d1,a1
|
||||
move.l 8(a0),d0 ! # bytes / element
|
||||
move.l (sp)+,a0 ! return address
|
||||
add.l #12,sp ! pop parameters
|
||||
clr.l d1 !?nodig?
|
||||
asr #1,d0
|
||||
bne 3f
|
||||
move.l (sp)+,d1
|
||||
move.b d1,(a1) ! 1 byte element
|
||||
bra 4f
|
||||
3:
|
||||
asr #1,d0
|
||||
bne 5f
|
||||
move.l (sp)+,d1
|
||||
move.w d1,(a1) ! 2 byte element
|
||||
bra 4f
|
||||
5:
|
||||
sub.l #1,d0
|
||||
1:
|
||||
move.l (sp)+,(a1)+ ! 4n byte element (n = 1,2,...)
|
||||
dbf d0,1b
|
||||
4:
|
||||
jmp (a0)
|
||||
|
||||
.align 2
|
||||
@@ -1,36 +0,0 @@
|
||||
.define .sari
|
||||
.define .lari
|
||||
.define .aari
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
|
||||
.sect .text
|
||||
.aari:
|
||||
move.l (sp)+,d0 ! return address
|
||||
cmp.l #4, (sp)+ ! size of descriptor elements
|
||||
bne 9f
|
||||
move.l d0,-(sp)
|
||||
jmp .aar
|
||||
|
||||
|
||||
.lari:
|
||||
move.l (sp)+,d0 ! return address
|
||||
cmp.l #4, (sp)+ ! size of descriptor elements
|
||||
bne 9f
|
||||
move.l d0,-(sp)
|
||||
jmp .lar
|
||||
9:
|
||||
move.w #EILLINS,-(sp)
|
||||
jmp .fat
|
||||
|
||||
|
||||
.sari:
|
||||
move.l (sp)+,d0 ! return address
|
||||
cmp.l #4, (sp)+ ! size of descriptor elements
|
||||
bne 9b
|
||||
move.l d0,-(sp)
|
||||
jmp .sar
|
||||
|
||||
.align 2
|
||||
@@ -1,13 +0,0 @@
|
||||
.define .savd0
|
||||
.define .savret
|
||||
.define .savreg
|
||||
|
||||
.data
|
||||
.savd0:
|
||||
.long 0
|
||||
.savret:
|
||||
.long 0
|
||||
.savreg:
|
||||
.space 128
|
||||
.text
|
||||
.align 2
|
||||
@@ -1,62 +0,0 @@
|
||||
.extern _errno
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .data
|
||||
_errno:
|
||||
.extern _lseek
|
||||
.short 0
|
||||
.sect .text
|
||||
_lseek:
|
||||
link a6,#-0
|
||||
.sect .data
|
||||
_13:
|
||||
.short 29561
|
||||
.short 29489
|
||||
.short 11875
|
||||
.short 0
|
||||
.sect .text
|
||||
move.l #_13,.filn
|
||||
move.w #8,.lino
|
||||
move.w #0,-(sp)
|
||||
move.w #0,-(sp)
|
||||
move.l (sp)+,d0
|
||||
unlk a6
|
||||
rts
|
||||
.extern _close
|
||||
_close:
|
||||
link a6,#-0
|
||||
move.l #_13,.filn
|
||||
move.w #12,.lino
|
||||
move.w #0,-(sp)
|
||||
move.w (sp)+,d0
|
||||
unlk a6
|
||||
rts
|
||||
.extern _ioctl
|
||||
_ioctl:
|
||||
link a6,#-0
|
||||
move.l #_13,.filn
|
||||
move.w #18,.lino
|
||||
move.w #0,-(sp)
|
||||
move.w (sp)+,d0
|
||||
unlk a6
|
||||
rts
|
||||
.extern _read
|
||||
_read:
|
||||
link a6,#-0
|
||||
move.l #_13,.filn
|
||||
move.w #24,.lino
|
||||
move.w #-1,-(sp)
|
||||
move.w (sp)+,d0
|
||||
unlk a6
|
||||
rts
|
||||
.extern _open
|
||||
_open:
|
||||
link a6,#-0
|
||||
move.l #_13,.filn
|
||||
move.w #30,.lino
|
||||
move.w #-1,-(sp)
|
||||
move.w (sp)+,d0
|
||||
unlk a6
|
||||
rts
|
||||
@@ -1,11 +0,0 @@
|
||||
.extern _exit
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
! Fake system call for 68000 running MACSBUG
|
||||
|
||||
.sect .text
|
||||
|
||||
_exit:
|
||||
jmp 0x0200f6
|
||||
@@ -1,8 +0,0 @@
|
||||
!definitions
|
||||
!#define lword
|
||||
!#define FLTRAP
|
||||
#define opfreq 0
|
||||
#define last 1
|
||||
#define test 1
|
||||
#define count 0
|
||||
#define flow 0
|
||||
@@ -1,11 +0,0 @@
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
.sect .text
|
||||
end:
|
||||
.sect .bss
|
||||
endbss:
|
||||
.sect .data
|
||||
enddata:
|
||||
@@ -1,3 +0,0 @@
|
||||
rm -f temp.c
|
||||
cat header deffile $1 >> temp.c
|
||||
../../../lib/cpp -P temp.c >$2
|
||||
@@ -1,135 +0,0 @@
|
||||
#ifndef NORCSID
|
||||
static char rcsid[] = "$Header$";
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
* (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
*
|
||||
* This product is part of the Amsterdam Compiler Kit.
|
||||
*
|
||||
* Permission to use, sell, duplicate or disclose this software must be
|
||||
* obtained in writing. Requests for such permissions may be sent to
|
||||
*
|
||||
* Dr. Andrew S. Tanenbaum
|
||||
* Wiskundig Seminarium
|
||||
* Vrije Universiteit
|
||||
* Postbox 7161
|
||||
* 1007 MC Amsterdam
|
||||
* The Netherlands
|
||||
*
|
||||
* Author: Hans van Staveren
|
||||
*/
|
||||
|
||||
char buf[512];
|
||||
char *index();
|
||||
|
||||
main() {
|
||||
register n,sa;
|
||||
register char *p;
|
||||
|
||||
sa=0;
|
||||
for (;;) {
|
||||
getline(buf);
|
||||
if (n=stackadjust()) {
|
||||
sa += n;
|
||||
continue;
|
||||
}
|
||||
if (nullinstruction())
|
||||
continue;
|
||||
if (sa) {
|
||||
if (buf[0]=='t' && buf[1]=='s' && buf[2]=='t' && buf[3]==' ') {
|
||||
sa -= 2;
|
||||
buf[0]='m';
|
||||
buf[1]='o';
|
||||
buf[2]='v';
|
||||
strcat(buf,",(sp)+");
|
||||
} else if (buf[0]=='m' && buf[1]=='o' && buf[2]=='v' &&
|
||||
buf[3]==' ' && (p=index(&buf[5],','))!=0 &&
|
||||
p[1]=='-' && p[2]=='(' && p[3]=='s') {
|
||||
sa -= 2;
|
||||
p[1]=' ';
|
||||
}
|
||||
}
|
||||
switch(sa) {
|
||||
case 0:break;
|
||||
case 2:puts("tst (sp)+");sa=0;break;
|
||||
case 4:puts("cmp (sp)+,(sp)+");sa=0;break;
|
||||
case 6:puts("add $06,sp");sa=0;break;
|
||||
}
|
||||
puts(buf);
|
||||
}
|
||||
}
|
||||
|
||||
getline(buf) register char *buf; {
|
||||
register c;
|
||||
|
||||
while ((c=getchar())==' ' || c=='\t')
|
||||
;
|
||||
if (c==EOF)
|
||||
exit(0);
|
||||
do *buf++=c;
|
||||
while ((c=getchar())!='\n');
|
||||
*buf=0;
|
||||
}
|
||||
|
||||
stackadjust() {
|
||||
|
||||
if (buf[0]=='t' &&
|
||||
buf[1]=='s' &&
|
||||
buf[2]=='t' &&
|
||||
buf[3]==' ' &&
|
||||
buf[4]=='(' &&
|
||||
buf[5]=='s' &&
|
||||
buf[6]=='p' &&
|
||||
buf[7]==')' &&
|
||||
buf[8]=='+') return(2);
|
||||
if (buf[0]=='c' &&
|
||||
buf[1]=='m' &&
|
||||
buf[2]=='p' &&
|
||||
buf[3]==' ' &&
|
||||
buf[4]=='(' &&
|
||||
buf[5]=='s' &&
|
||||
buf[6]=='p' &&
|
||||
buf[7]==')' &&
|
||||
buf[8]=='+' &&
|
||||
buf[9]==',' &&
|
||||
buf[10]=='(' &&
|
||||
buf[11]=='s' &&
|
||||
buf[12]=='p' &&
|
||||
buf[13]==')' &&
|
||||
buf[14]=='+') return(4);
|
||||
if (buf[0]=='a' &&
|
||||
buf[1]=='d' &&
|
||||
buf[2]=='d' &&
|
||||
buf[3]==' ' &&
|
||||
buf[4]=='$' &&
|
||||
buf[5]=='0' &&
|
||||
buf[6]=='6' &&
|
||||
buf[7]==',' &&
|
||||
buf[8]=='s' &&
|
||||
buf[9]=='p' &&
|
||||
buf[10]==0) return(6);
|
||||
return(0);
|
||||
}
|
||||
|
||||
nullinstruction() {
|
||||
register char *p;
|
||||
|
||||
if (buf[4]=='$' && buf[5]=='0' && buf[6]=='0' && buf[7]==',') {
|
||||
p=index(buf,'-');
|
||||
if (p!=0 && p[1]=='(')
|
||||
return(0);
|
||||
p=index(buf,'+');
|
||||
if (p!=0 && p[-1]==')')
|
||||
return(0);
|
||||
if (buf[0]=='b' && buf[1]=='i' && (buf[2]=='s' || buf[2]=='c'))
|
||||
return(1);
|
||||
if (buf[0]=='a' && buf[1]=='d' && buf[2]=='d')
|
||||
return(1);
|
||||
if (buf[0]=='s' && buf[1]=='u' && buf[2]=='b')
|
||||
return(1);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/ $Header$
|
||||
.globl blm~
|
||||
.globl save~,retu~
|
||||
|
||||
/ Size in r0
|
||||
blm~:
|
||||
jsr pc,save~
|
||||
mov (sp)+,r2
|
||||
mov (sp)+,r3
|
||||
mov r0,r1
|
||||
asr r0
|
||||
beq 2f
|
||||
/ Now avoid wrong copy.
|
||||
/ The pieces may overlap !
|
||||
cmp r3,r2
|
||||
beq 2f
|
||||
blt 3f
|
||||
1:
|
||||
mov (r3)+,(r2)+
|
||||
sob r0,1b
|
||||
2:
|
||||
jmp retu~
|
||||
3:
|
||||
add r1,r3
|
||||
add r1,r2
|
||||
4:
|
||||
mov -(r3),-(r2)
|
||||
sob r0,4b
|
||||
br 2b
|
||||
@@ -1,21 +0,0 @@
|
||||
MAKEFILE=../../proto/libg/Makefile
|
||||
MACHDEF="MACH=pdp -Rbe-p2" "SUF=s" "ASAR=ar"
|
||||
PCDEF="PREF=pc" "SUB=" "SRC=lang/pc/libpc"
|
||||
LIBDIR=../lib
|
||||
|
||||
install:
|
||||
make -f $(MAKEFILE) $(PCDEF) $(MACHDEF) cp
|
||||
|
||||
cmp:
|
||||
make -f $(MAKEFILE) $(PCDEF) $(MACHDEF) all
|
||||
cmp head_pc $(LIBDIR)/head_pc
|
||||
cmp tail_pc $(LIBDIR)/tail_pc
|
||||
|
||||
clean:
|
||||
-rm -f *.old *.[ce$(SUF)] tail* head*
|
||||
|
||||
opr:
|
||||
make pr | opr
|
||||
|
||||
pr:
|
||||
@pr Makefile
|
||||
@@ -1,205 +0,0 @@
|
||||
#ifndef NORCSID
|
||||
static char rcsid[] = "$Header$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
||||
*
|
||||
* This product is part of the Amsterdam Compiler Kit.
|
||||
*
|
||||
* Permission to use, sell, duplicate or disclose this software must be
|
||||
* obtained in writing. Requests for such permissions may be sent to
|
||||
*
|
||||
* Dr. Andrew S. Tanenbaum
|
||||
* Wiskundig Seminarium
|
||||
* Vrije Universiteit
|
||||
* Postbox 7161
|
||||
* 1007 MC Amsterdam
|
||||
* The Netherlands
|
||||
*
|
||||
* Author: Hans van Staveren
|
||||
*/
|
||||
|
||||
/*
|
||||
* machine dependent back end routines for the PDP-11
|
||||
*/
|
||||
|
||||
con_part(sz,w) register sz; word w; {
|
||||
|
||||
while (part_size % sz)
|
||||
part_size++;
|
||||
if (part_size == 2)
|
||||
part_flush();
|
||||
if (sz == 1) {
|
||||
w &= 0xFF;
|
||||
if (part_size)
|
||||
w <<= 8;
|
||||
part_word |= w;
|
||||
} else {
|
||||
assert(sz == 2);
|
||||
part_word = w;
|
||||
}
|
||||
part_size += sz;
|
||||
}
|
||||
|
||||
con_mult(sz) word sz; {
|
||||
long l;
|
||||
|
||||
if (sz != 4)
|
||||
fatal("bad icon/ucon size");
|
||||
l = atol(str);
|
||||
fprintf(codefile,"\t%o;%o\n",(int)(l>>16),(int)l);
|
||||
}
|
||||
|
||||
con_float() {
|
||||
double f;
|
||||
register short *p,i;
|
||||
|
||||
/*
|
||||
* This code is correct only when the code generator is
|
||||
* run on a PDP-11 or VAX-11 since it assumes native
|
||||
* floating point format is PDP-11 format.
|
||||
*/
|
||||
|
||||
if (argval != 4 && argval != 8)
|
||||
fatal("bad fcon size");
|
||||
f = atof(str);
|
||||
p = (short *) &f;
|
||||
i = *p++;
|
||||
if (argval == 8) {
|
||||
fprintf(codefile,"\t%o;%o;",i,*p++);
|
||||
i = *p++;
|
||||
}
|
||||
fprintf(codefile,"\t%o;%o\n",i,*p++);
|
||||
}
|
||||
|
||||
#ifdef REGVARS
|
||||
|
||||
char Rstring[10];
|
||||
full lbytes;
|
||||
struct regadm {
|
||||
char *ra_str;
|
||||
long ra_off;
|
||||
} regadm[2];
|
||||
int n_regvars;
|
||||
|
||||
regscore(off,size,typ,score,totyp) long off; {
|
||||
|
||||
/*
|
||||
* This function is full of magic constants.
|
||||
* They are a result of experimentation.
|
||||
*/
|
||||
|
||||
if (size != 2)
|
||||
return(-1);
|
||||
score -= 1; /* allow for save/restore */
|
||||
if (off>=0)
|
||||
score -= 2;
|
||||
if (typ==reg_pointer)
|
||||
score *= 17;
|
||||
else if (typ==reg_loop)
|
||||
score = 10*score+50; /* Guestimate */
|
||||
else
|
||||
score *= 10;
|
||||
return(score); /* 10 * estimated # of words of profit */
|
||||
}
|
||||
|
||||
i_regsave() {
|
||||
|
||||
Rstring[0] = 0;
|
||||
n_regvars=0;
|
||||
}
|
||||
|
||||
f_regsave() {
|
||||
register i;
|
||||
|
||||
if (n_regvars==0 || lbytes==0) {
|
||||
fprintf(codefile,"mov r5,-(sp)\nmov sp,r5\n");
|
||||
if (lbytes == 2)
|
||||
fprintf(codefile,"tst -(sp)\n");
|
||||
else if (lbytes!=0)
|
||||
fprintf(codefile,"sub $0%o,sp\n",lbytes);
|
||||
for (i=0;i<n_regvars;i++)
|
||||
fprintf(codefile,"mov %s,-(sp)\n",regadm[i].ra_str);
|
||||
} else {
|
||||
if (lbytes>6) {
|
||||
fprintf(codefile,"mov $0%o,r0\n",lbytes);
|
||||
fprintf(codefile,"jsr r5,PR%s\n",Rstring);
|
||||
} else {
|
||||
fprintf(codefile,"jsr r5,PR%d%s\n",lbytes,Rstring);
|
||||
}
|
||||
}
|
||||
for (i=0;i<n_regvars;i++)
|
||||
if (regadm[i].ra_off>=0)
|
||||
fprintf(codefile,"mov 0%lo(r5),%s\n",regadm[i].ra_off,
|
||||
regadm[i].ra_str);
|
||||
}
|
||||
|
||||
regsave(regstr,off,size) char *regstr; long off; {
|
||||
|
||||
fprintf(codefile,"/ Local %ld into %s\n",off,regstr);
|
||||
strcat(Rstring,regstr);
|
||||
regadm[n_regvars].ra_str = regstr;
|
||||
regadm[n_regvars].ra_off = off;
|
||||
n_regvars++;
|
||||
}
|
||||
|
||||
regreturn() {
|
||||
|
||||
fprintf(codefile,"jmp RT%s\n",Rstring);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
prolog(nlocals) full nlocals; {
|
||||
|
||||
#ifndef REGVARS
|
||||
fprintf(codefile,"mov r5,-(sp)\nmov sp,r5\n");
|
||||
if (nlocals == 0)
|
||||
return;
|
||||
if (nlocals == 2)
|
||||
fprintf(codefile,"tst -(sp)\n");
|
||||
else
|
||||
fprintf(codefile,"sub $0%o,sp\n",nlocals);
|
||||
#else
|
||||
lbytes = nlocals;
|
||||
#endif
|
||||
}
|
||||
|
||||
dlbdlb(as,ls) string as,ls; {
|
||||
|
||||
if (strlen(as)+strlen(ls)+2<sizeof(labstr)) {
|
||||
strcat(ls,":");
|
||||
strcat(ls,as);
|
||||
} else
|
||||
fatal("too many consecutive labels");
|
||||
}
|
||||
|
||||
mes(type) word type; {
|
||||
int argt ;
|
||||
|
||||
switch ( (int)type ) {
|
||||
case ms_ext :
|
||||
for (;;) {
|
||||
switch ( argt=getarg(
|
||||
ptyp(sp_cend)|ptyp(sp_pnam)|sym_ptyp) ) {
|
||||
case sp_cend :
|
||||
return ;
|
||||
default:
|
||||
strarg(argt) ;
|
||||
fprintf(codefile,".globl %s\n",argstr) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
default :
|
||||
while ( getarg(any_ptyp) != sp_cend ) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
char *segname[] = {
|
||||
".text", /* SEGTXT */
|
||||
".data", /* SEGCON */
|
||||
".data", /* SEGROM */
|
||||
".bss" /* SEGBSS */
|
||||
};
|
||||
@@ -1,24 +0,0 @@
|
||||
/* $Header$ */
|
||||
|
||||
#define ex_ap(y) fprintf(codefile,".globl %s\n",y)
|
||||
#define in_ap(y) /* nothing */
|
||||
|
||||
#define newplb(x) fprintf(codefile,"%s:\n",x)
|
||||
#define newilb(x) fprintf(codefile,"%s:\n",x)
|
||||
#define newdlb(x) fprintf(codefile,"%s:\n",x)
|
||||
#define newlbss(l,x) fprintf(codefile,"%s:.=.+0%o\n",l,x);
|
||||
|
||||
#define cst_fmt "$0%o"
|
||||
#define off_fmt "0%o"
|
||||
#define ilb_fmt "I%x_%x"
|
||||
#define dlb_fmt "_%d"
|
||||
#define hol_fmt "hol%d"
|
||||
|
||||
#define hol_off "0%o+hol%d"
|
||||
|
||||
#define con_cst(x) fprintf(codefile,"0%o\n",x)
|
||||
#define con_ilb(x) fprintf(codefile,"%s\n",x)
|
||||
#define con_dlb(x) fprintf(codefile,"%s\n",x)
|
||||
|
||||
#define id_first '_'
|
||||
#define BSS_INIT 0
|
||||
2188
mach/pdp/ncg/table
2188
mach/pdp/ncg/table
File diff suppressed because it is too large
Load Diff
@@ -1,41 +0,0 @@
|
||||
/* The format of the a.out files produced by the assemblers
|
||||
is machine dependent.
|
||||
This program acts as a gateway between two machines and it's effect
|
||||
is independent of the machine it executes on.
|
||||
The a.out file is assumed to be made on a pdp-11
|
||||
while the target machine is a Philip Microcomputer Development system
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
main(argc,argv) char **argv ; {
|
||||
char i_addr[4];
|
||||
short count;
|
||||
char i_count[2];
|
||||
|
||||
if (argc != 3) {
|
||||
fprintf(stderr,"Usage: %s pdp-a.out VU-pmds-a.out\n",argv[0]);
|
||||
exit(-1);
|
||||
}
|
||||
if (freopen(argv[1],"r",stdin)==NULL) {
|
||||
perror(argv[1]);
|
||||
exit(-1);
|
||||
}
|
||||
if (freopen(argv[2],"w",stdout)==NULL) {
|
||||
perror(argv[2]);
|
||||
exit(-1);
|
||||
}
|
||||
while (fread(&i_addr,sizeof i_addr,1,stdin)==1) {
|
||||
putchar(i_addr[1]) ; putchar(i_addr[0]) ;
|
||||
putchar(i_addr[3]) ; putchar(i_addr[2]) ;
|
||||
if (fread(&i_count,sizeof i_count,1,stdin)!=1)
|
||||
exit(fprintf(stderr,"foo\n"));
|
||||
putchar(i_count[1]) ; putchar(i_count[0]) ;
|
||||
count= ((i_count[1]&0377)<<8) | (i_count[0]&0377) ;
|
||||
while (count--) {
|
||||
putchar(getchar());
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/* The format of the a.out files produced by the assemblers
|
||||
is machine dependent.
|
||||
This program acts as a gateway between two machines and it's effect
|
||||
is independent of the machine it executes on.
|
||||
The a.out file is assumed to be made on a vax-11
|
||||
while the target machine is a Philips Microcomputer Development system
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
main(argc,argv) char **argv ; {
|
||||
char i_addr[4];
|
||||
short count;
|
||||
char i_count[2];
|
||||
|
||||
if (argc != 3) {
|
||||
fprintf(stderr,"Usage: %s vax-a.out VU-pmds-a.out\n",argv[0]);
|
||||
exit(-1);
|
||||
}
|
||||
if (freopen(argv[1],"r",stdin)==NULL) {
|
||||
perror(argv[1]);
|
||||
exit(-1);
|
||||
}
|
||||
if (freopen(argv[2],"w",stdout)==NULL) {
|
||||
perror(argv[2]);
|
||||
exit(-1);
|
||||
}
|
||||
while (fread(&i_addr,sizeof i_addr,1,stdin)==1) {
|
||||
putchar(i_addr[3]) ; putchar(i_addr[2]) ;
|
||||
putchar(i_addr[1]) ; putchar(i_addr[0]) ;
|
||||
if (fread(&i_count,sizeof i_count,1,stdin)!=1)
|
||||
exit(fprintf(stderr,"foo\n"));
|
||||
putchar(i_count[1]) ; putchar(i_count[0]) ;
|
||||
count= ((i_count[1]&0377)<<8) | (i_count[0]&0377) ;
|
||||
while (count--) {
|
||||
putchar(getchar());
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
--------- $Header$ --------
|
||||
The file "table" is too large. The "cgg" program cannot generate
|
||||
"tables.h" and "tables.c" on a PDP 11/44.
|
||||
Therefore the distribution includes two files "tables1.c" and "tables1.h",
|
||||
which you can copy to "tables.c" and "tables.h".
|
||||
Make sure "tables.c" and "tables.h" are newer than "table",
|
||||
before trying again. They also must be newer than the "cgg" program
|
||||
(../../../lib/cgg).
|
||||
@@ -1,93 +0,0 @@
|
||||
#include "system.h"
|
||||
#include "em_abs.h"
|
||||
#ifdef BSD42
|
||||
#include "/usr/include/syscall.h"
|
||||
#endif BSD42
|
||||
|
||||
# $Header$
|
||||
|
||||
.globl hol0
|
||||
.globl .reghp
|
||||
.globl .trppc
|
||||
.globl .trpim
|
||||
|
||||
# run time startoff
|
||||
.word 0
|
||||
bispsw $0100 # set FU(0100)
|
||||
movl 4(sp),r0
|
||||
clrl -4(r0)
|
||||
movl sp,r0
|
||||
movl (r0)+,r1
|
||||
movl r0,r2
|
||||
a1:
|
||||
tstl (r0)+
|
||||
bneq a1
|
||||
cmpl r0,(r2)
|
||||
blssu a2
|
||||
tstl -(r0)
|
||||
a2:
|
||||
pushl r0
|
||||
pushl r2
|
||||
pushl r1
|
||||
movl $m1,ap
|
||||
chmk (ap)+ # catch floating point exception
|
||||
calls $3,_m_a_i_n
|
||||
movl $m2,ap
|
||||
movl r0,6(ap)
|
||||
chmk (ap)+
|
||||
halt
|
||||
|
||||
.align 1
|
||||
sig8:
|
||||
.word 0x0000
|
||||
pushl 8(ap)
|
||||
movl (sp)+,ap
|
||||
pushl tab [ap]
|
||||
jsb .trp
|
||||
movl $m1,ap
|
||||
chmk (ap)+
|
||||
ret
|
||||
|
||||
.data
|
||||
#ifdef BSD42
|
||||
m1:
|
||||
.word SYS_sigvec
|
||||
.long 3
|
||||
.long 8
|
||||
.long m1a
|
||||
.long 0
|
||||
m1a:
|
||||
.long sig8
|
||||
.long 0
|
||||
.long 0
|
||||
#else BSD42
|
||||
m1:
|
||||
.word 48
|
||||
.long 2
|
||||
.long 8
|
||||
.long sig8
|
||||
#endif BSD42
|
||||
m2:
|
||||
.word 1
|
||||
.long 1
|
||||
.long 0
|
||||
.reghp:
|
||||
.long _end
|
||||
hol0:
|
||||
.space 8
|
||||
.trppc:
|
||||
.space 4
|
||||
.trpim:
|
||||
.long 0
|
||||
tab:
|
||||
.long 0
|
||||
.long EIOVFL
|
||||
.long EIDIVZ
|
||||
.long EFOVFL
|
||||
.long EFDIVZ
|
||||
.long EFUNFL
|
||||
.long EILLINS
|
||||
.long EARRAY
|
||||
.long EFOVFL
|
||||
.long EFDIVZ
|
||||
.long EFUNFL
|
||||
@@ -1,4 +0,0 @@
|
||||
/* $Header$ */
|
||||
/*#define BSD42 */
|
||||
/*#define BSD41c */
|
||||
#define BSD41a
|
||||
@@ -1,167 +0,0 @@
|
||||
/*
|
||||
* Download Z80 load module into the RC702
|
||||
*
|
||||
* Adapted (untested) to new ack.out format by
|
||||
* Ceriel Jacobs, Vrije Universiteit, Amsterdam
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <out.h>
|
||||
|
||||
int disp = 0;
|
||||
|
||||
char hex[] = "0123456789ABCDEF";
|
||||
|
||||
#define DATTYPE 0
|
||||
#define EOFTYPE 1
|
||||
#define SEGTYPE 2
|
||||
#define PCTYPE 3
|
||||
|
||||
#define MAXBYTE 32
|
||||
|
||||
char *progname;
|
||||
|
||||
struct outhead ohead;
|
||||
struct outsect sect[MAXSECT];
|
||||
|
||||
long pc;
|
||||
|
||||
main(argc,argv) char **argv; {
|
||||
register unsigned nd;
|
||||
register char *s;
|
||||
int first = 1;
|
||||
int i;
|
||||
|
||||
progname = argv[0];
|
||||
while (argc > 1 && argv[1][0] == '-') {
|
||||
switch (argv[1][1]) {
|
||||
case 'd':
|
||||
/* displacement at load time */
|
||||
disp = atoi(&argv[1][2]);
|
||||
break;
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
s = "a.out";
|
||||
if (argc == 2)
|
||||
s = argv[1];
|
||||
else if (argc != 1) {
|
||||
fprintf(stderr,"usage: %s [flags] [object file]\n",progname);
|
||||
exit(-1);
|
||||
}
|
||||
if (! rd_open(s)) {
|
||||
fprintf(stderr,"%s: can't open %s\n",progname,s);
|
||||
exit(-1);
|
||||
}
|
||||
rd_ohead(&ohead);
|
||||
if (ohead.oh_flags & HF_LINK) {
|
||||
fprintf(stderr,"%s: %s contains unresolved references\n",progname,s);
|
||||
exit(-1);
|
||||
}
|
||||
rd_sect(sect, ohead.oh_nsect);
|
||||
for (i = 0; i < ohead.oh_nsect; i++) {
|
||||
rd_outsect(i);
|
||||
pc = sect[i].os_base;
|
||||
if (first) {
|
||||
first = 0;
|
||||
putchar('L');
|
||||
putchar('S');
|
||||
}
|
||||
segment(i);
|
||||
while (sect[i].os_size) {
|
||||
unsigned int sz = 8096, fl;
|
||||
extern char *calloc();
|
||||
register char *buf;
|
||||
char *pbuf;
|
||||
|
||||
if (sz > sect[i].os_size) sz = sect[i].os_size;
|
||||
sect[i].os_size -= sz;
|
||||
pbuf = buf = calloc(sz, 1);
|
||||
if (fl = sect[i].os_flen) {
|
||||
if (fl > sz) fl = sz;
|
||||
sect[i].os_flen -= fl;
|
||||
|
||||
rd_emit(buf, (long) fl);
|
||||
}
|
||||
while (sz >= MAXBYTE) {
|
||||
data(MAXBYTE, (int) pc, buf);
|
||||
sz -= MAXBYTE;
|
||||
buf += MAXBYTE;
|
||||
pc += MAXBYTE;
|
||||
}
|
||||
if (sz > 0) {
|
||||
data(sz, (int) pc, buf);
|
||||
}
|
||||
free(pbuf);
|
||||
}
|
||||
}
|
||||
if (first == 0) eof();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
segment(sg) {
|
||||
|
||||
newline(2,0,SEGTYPE);
|
||||
word(sg);
|
||||
endline();
|
||||
}
|
||||
|
||||
data(nd,pc,buf)
|
||||
register char *buf;
|
||||
int pc;
|
||||
{
|
||||
register i;
|
||||
|
||||
newline(nd, pc+disp, DATTYPE);
|
||||
for (i = 0; i < nd; i++) {
|
||||
byte(*buf++);
|
||||
}
|
||||
endline();
|
||||
}
|
||||
|
||||
int check, bytecount;
|
||||
|
||||
newline(n,pc,typ) {
|
||||
|
||||
check = 0;
|
||||
bytecount = n+5;
|
||||
putchar('\n'); /* added instruction */
|
||||
putchar(':');
|
||||
byte(n);
|
||||
word(pc);
|
||||
byte(typ);
|
||||
}
|
||||
|
||||
endline() {
|
||||
|
||||
byte(-check);
|
||||
assert(bytecount == 0);
|
||||
}
|
||||
|
||||
word(w) {
|
||||
|
||||
byte(w>>8);
|
||||
byte(w);
|
||||
}
|
||||
|
||||
byte(b) {
|
||||
|
||||
check += b;
|
||||
bytecount--;
|
||||
putchar(hex[(b>>4) & 017]);
|
||||
putchar(hex[b & 017]);
|
||||
}
|
||||
|
||||
rd_fatal()
|
||||
{
|
||||
fprintf(stderr, "%s: Read error\n", progname);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
eof() {
|
||||
|
||||
newline(0,0,EOFTYPE);
|
||||
byte(0xFF);
|
||||
putchar('\n');
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
/usr/em/mach/z80/as/as -d em.s atof.s fpp.s mli4.s dvu4.s dvi4.s eb.s >em.list
|
||||
dl a.out int.hex
|
||||
dosort int.hex
|
||||
@@ -1,15 +0,0 @@
|
||||
.define endtext,enddata,endbss
|
||||
.define _end,_etext,_edata
|
||||
|
||||
.text
|
||||
endtext:
|
||||
_etext:
|
||||
.align 2
|
||||
.data
|
||||
enddata:
|
||||
_edata:
|
||||
.align 2
|
||||
.bss
|
||||
_end:
|
||||
endbss:
|
||||
.align 2
|
||||
@@ -1,33 +0,0 @@
|
||||
.define putchr
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
! output routine in monitor
|
||||
CRT = 0x013B
|
||||
! output a charcter
|
||||
! entry: ascii character in a
|
||||
putchr:
|
||||
push hl
|
||||
push bc
|
||||
ld hl,tab
|
||||
ld b,5
|
||||
1: cp (hl)
|
||||
jr z,fetch
|
||||
inc hl
|
||||
inc hl
|
||||
djnz 1b
|
||||
2: call CRT
|
||||
pop bc
|
||||
pop hl
|
||||
ret
|
||||
fetch: inc hl
|
||||
ld a,(hl)
|
||||
jr 2b
|
||||
! conversion table for nascom characters
|
||||
tab: .data1 0x0D,0x00
|
||||
.data1 0x1B,0x1E
|
||||
.data1 0x08,0x1D
|
||||
.data1 0x0A,0x1F
|
||||
.data1 0x7F,0x00
|
||||
@@ -1,26 +0,0 @@
|
||||
.define putchr
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
putchr:
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
cp 0x0A
|
||||
jr nz,1f
|
||||
ld a,0x1F
|
||||
1:
|
||||
ld c,a
|
||||
2:
|
||||
in a,0xF1
|
||||
and 4
|
||||
jr z,2b
|
||||
ld a,c
|
||||
out 0xF0,a
|
||||
pop bc
|
||||
pop de
|
||||
pop hl
|
||||
ret
|
||||
@@ -1,202 +0,0 @@
|
||||
.define _read,_write,_ioctl,_getpid,_open,_close,_exit,_errno
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
_read:
|
||||
ld (savebc),bc
|
||||
push af
|
||||
pop bc
|
||||
ld (saveaf),bc ! save all registers in savereg
|
||||
ld (savede),de
|
||||
ld (savehl),hl
|
||||
ld (saveix),ix
|
||||
ex (sp),hl ! return address in hl
|
||||
pop bc ! skip return address
|
||||
pop bc ! get fd
|
||||
ld a,b ! check fd = 0
|
||||
or c
|
||||
jr nz,errrd
|
||||
pop de ! get buffer
|
||||
pop bc ! get count
|
||||
ld ix,0 ! reset counter
|
||||
push bc
|
||||
push de
|
||||
push ix
|
||||
push hl ! return address
|
||||
ex de,hl ! buffer to hl
|
||||
1: ld a,b
|
||||
or c
|
||||
jr z,done ! done if count = 0
|
||||
call getchr
|
||||
ld (hl),a
|
||||
inc hl ! increment pointer
|
||||
inc ix ! increment char counter
|
||||
dec bc ! decrement count
|
||||
cp 0xA
|
||||
jr nz,1b ! done if char = CR
|
||||
done:
|
||||
ld bc,(saveaf)
|
||||
push bc
|
||||
pop af
|
||||
ld bc,(savebc)
|
||||
ld de,(savede)
|
||||
ld hl,(savehl)
|
||||
ld ix,(saveix)
|
||||
ret
|
||||
errrd:
|
||||
push bc
|
||||
push hl ! return address
|
||||
ld bc,(saveaf)
|
||||
push bc
|
||||
pop af
|
||||
ld bc,(savebc)
|
||||
ld de,(savede)
|
||||
ld hl,(savehl)
|
||||
ld ix,(saveix)
|
||||
ld ix,-1
|
||||
ret
|
||||
|
||||
_write:
|
||||
ld (savebc),bc
|
||||
push af
|
||||
pop bc
|
||||
ld (saveaf),bc ! save all registers in savereg
|
||||
ld (savede),de
|
||||
ld (savehl),hl
|
||||
ld (saveix),ix
|
||||
ex (sp),hl ! return address in hl
|
||||
pop de ! skip return address
|
||||
pop de ! get fd
|
||||
ld a,e ! check for fd = 1
|
||||
cp 1
|
||||
jr nz,errwr
|
||||
ld a,d
|
||||
or a
|
||||
jr nz,errwr
|
||||
pop de ! buffer in de
|
||||
pop bc ! count in bc
|
||||
push bc
|
||||
push de
|
||||
push de
|
||||
push hl
|
||||
ex de,hl ! buffer in hl
|
||||
ld e,c
|
||||
ld d,b ! count also in de
|
||||
1: ld a,b
|
||||
or c
|
||||
jr z,exit
|
||||
ld a,(hl)
|
||||
call putchr
|
||||
inc hl
|
||||
dec bc
|
||||
jr 1b
|
||||
errwr:
|
||||
push de
|
||||
push hl
|
||||
ld bc,(saveaf)
|
||||
push bc
|
||||
pop af
|
||||
ld bc,(savebc)
|
||||
ld de,(savede)
|
||||
ld hl,(savehl)
|
||||
ld ix,(saveix)
|
||||
ld ix,-1 ! error in fd
|
||||
ret
|
||||
exit:
|
||||
push de ! count on stack
|
||||
ld bc,(saveaf)
|
||||
push bc
|
||||
pop af
|
||||
ld bc,(savebc)
|
||||
ld de,(savede)
|
||||
ld hl,(savehl)
|
||||
ld ix,(saveix)
|
||||
pop ix ! return count to caller
|
||||
ret
|
||||
|
||||
_ioctl:
|
||||
ret
|
||||
_getpid:
|
||||
ret
|
||||
|
||||
! open return a file descriptor (0,1,2)
|
||||
! depending on 'mode'
|
||||
! mode 2 doesn't work!!
|
||||
_open:
|
||||
ld (savebc),bc
|
||||
push af
|
||||
pop bc
|
||||
ld (saveaf),bc ! save all registers in savereg
|
||||
ld (savede),de
|
||||
ld (savehl),hl
|
||||
ld (saveix),ix
|
||||
pop bc ! return address
|
||||
pop de ! name pointer
|
||||
pop ix ! mode (0 for read,
|
||||
! 1 for write)
|
||||
push ix
|
||||
push de
|
||||
push bc
|
||||
ld bc,(saveaf)
|
||||
push bc
|
||||
pop af
|
||||
ld bc,(savebc)
|
||||
ld de,(savede)
|
||||
ld hl,(savehl)
|
||||
ld ix,(saveix)
|
||||
ret ! return fd = 0 for read
|
||||
! fd = 1 for write
|
||||
|
||||
_close:
|
||||
ld ix,0 ! return succes
|
||||
ret
|
||||
_exit:
|
||||
jp 0x38
|
||||
.sect .data
|
||||
_errno:
|
||||
.data2 0
|
||||
! output routine in monitor
|
||||
CRT = 0x013B
|
||||
! output a charcter
|
||||
! entry: ascii character in a
|
||||
.sect .text
|
||||
!putchr:
|
||||
! push hl
|
||||
! push bc
|
||||
! ld hl,tab
|
||||
! ld b,5
|
||||
!1: cp (hl)
|
||||
! jr z,fetch
|
||||
! inc hl
|
||||
! inc hl
|
||||
! djnz 1b
|
||||
!2: call CRT
|
||||
! pop bc
|
||||
! pop hl
|
||||
! ret
|
||||
!fetch: inc hl
|
||||
! ld a,(hl)
|
||||
! jr 2b
|
||||
!! conversion table for nascom characters
|
||||
!tab: .data1 0x0D,0x00
|
||||
! .data1 0x1B,0x1E
|
||||
! .data1 0x08,0x1D
|
||||
! .data1 0x0A,0x1F
|
||||
! .data1 0x7F,0x00
|
||||
|
||||
KBD = 0x69
|
||||
! get character from keyboard
|
||||
getchr:
|
||||
call KBD
|
||||
jr nc,getchr
|
||||
cp 0x1F
|
||||
jr z,CR
|
||||
cp 0x1D
|
||||
jr z,BS
|
||||
ret
|
||||
CR: ld a,0xA
|
||||
ret
|
||||
BS: ld a,0x8
|
||||
ret
|
||||
@@ -1,33 +0,0 @@
|
||||
.define putchr
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
! output routine in monitor
|
||||
CRT = 0x013B
|
||||
! output a charcter
|
||||
! entry: ascii character in a
|
||||
putchr:
|
||||
push hl
|
||||
push bc
|
||||
ld hl,tab
|
||||
ld b,5
|
||||
1: cp (hl)
|
||||
jr z,fetch
|
||||
inc hl
|
||||
inc hl
|
||||
djnz 1b
|
||||
2: call CRT
|
||||
pop bc
|
||||
pop hl
|
||||
ret
|
||||
fetch: inc hl
|
||||
ld a,(hl)
|
||||
jr 2b
|
||||
! conversion table for nascom characters
|
||||
tab: .data1 0x0D,0x00
|
||||
.data1 0x1B,0x1E
|
||||
.data1 0x08,0x1D
|
||||
.data1 0x0A,0x1F
|
||||
.data1 0x7F,0x00
|
||||
@@ -1,26 +0,0 @@
|
||||
.define putchr
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
|
||||
putchr:
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
cp 0x0A
|
||||
jr nz,1f
|
||||
ld a,0x1F
|
||||
1:
|
||||
ld c,a
|
||||
2:
|
||||
in a,0xF1
|
||||
and 4
|
||||
jr z,2b
|
||||
ld a,c
|
||||
out 0xF0,a
|
||||
pop bc
|
||||
pop de
|
||||
pop hl
|
||||
ret
|
||||
@@ -1,202 +0,0 @@
|
||||
.define _read,_write,_ioctl,_getpid,_open,_close,_exit,_errno
|
||||
.sect .text
|
||||
.sect .rom
|
||||
.sect .data
|
||||
.sect .bss
|
||||
.sect .text
|
||||
_read:
|
||||
ld (savebc),bc
|
||||
push af
|
||||
pop bc
|
||||
ld (saveaf),bc ! save all registers in savereg
|
||||
ld (savede),de
|
||||
ld (savehl),hl
|
||||
ld (saveix),ix
|
||||
ex (sp),hl ! return address in hl
|
||||
pop bc ! skip return address
|
||||
pop bc ! get fd
|
||||
ld a,b ! check fd = 0
|
||||
or c
|
||||
jr nz,errrd
|
||||
pop de ! get buffer
|
||||
pop bc ! get count
|
||||
ld ix,0 ! reset counter
|
||||
push bc
|
||||
push de
|
||||
push ix
|
||||
push hl ! return address
|
||||
ex de,hl ! buffer to hl
|
||||
1: ld a,b
|
||||
or c
|
||||
jr z,done ! done if count = 0
|
||||
call getchr
|
||||
ld (hl),a
|
||||
inc hl ! increment pointer
|
||||
inc ix ! increment char counter
|
||||
dec bc ! decrement count
|
||||
cp 0xA
|
||||
jr nz,1b ! done if char = CR
|
||||
done:
|
||||
ld bc,(saveaf)
|
||||
push bc
|
||||
pop af
|
||||
ld bc,(savebc)
|
||||
ld de,(savede)
|
||||
ld hl,(savehl)
|
||||
ld ix,(saveix)
|
||||
ret
|
||||
errrd:
|
||||
push bc
|
||||
push hl ! return address
|
||||
ld bc,(saveaf)
|
||||
push bc
|
||||
pop af
|
||||
ld bc,(savebc)
|
||||
ld de,(savede)
|
||||
ld hl,(savehl)
|
||||
ld ix,(saveix)
|
||||
ld ix,-1
|
||||
ret
|
||||
|
||||
_write:
|
||||
ld (savebc),bc
|
||||
push af
|
||||
pop bc
|
||||
ld (saveaf),bc ! save all registers in savereg
|
||||
ld (savede),de
|
||||
ld (savehl),hl
|
||||
ld (saveix),ix
|
||||
ex (sp),hl ! return address in hl
|
||||
pop de ! skip return address
|
||||
pop de ! get fd
|
||||
ld a,e ! check for fd = 1
|
||||
cp 1
|
||||
jr nz,errwr
|
||||
ld a,d
|
||||
or a
|
||||
jr nz,errwr
|
||||
pop de ! buffer in de
|
||||
pop bc ! count in bc
|
||||
push bc
|
||||
push de
|
||||
push de
|
||||
push hl
|
||||
ex de,hl ! buffer in hl
|
||||
ld e,c
|
||||
ld d,b ! count also in de
|
||||
1: ld a,b
|
||||
or c
|
||||
jr z,exit
|
||||
ld a,(hl)
|
||||
call putchr
|
||||
inc hl
|
||||
dec bc
|
||||
jr 1b
|
||||
errwr:
|
||||
push de
|
||||
push hl
|
||||
ld bc,(saveaf)
|
||||
push bc
|
||||
pop af
|
||||
ld bc,(savebc)
|
||||
ld de,(savede)
|
||||
ld hl,(savehl)
|
||||
ld ix,(saveix)
|
||||
ld ix,-1 ! error in fd
|
||||
ret
|
||||
exit:
|
||||
push de ! count on stack
|
||||
ld bc,(saveaf)
|
||||
push bc
|
||||
pop af
|
||||
ld bc,(savebc)
|
||||
ld de,(savede)
|
||||
ld hl,(savehl)
|
||||
ld ix,(saveix)
|
||||
pop ix ! return count to caller
|
||||
ret
|
||||
|
||||
_ioctl:
|
||||
ret
|
||||
_getpid:
|
||||
ret
|
||||
|
||||
! open return a file descriptor (0,1,2)
|
||||
! depending on 'mode'
|
||||
! mode 2 doesn't work!!
|
||||
_open:
|
||||
ld (savebc),bc
|
||||
push af
|
||||
pop bc
|
||||
ld (saveaf),bc ! save all registers in savereg
|
||||
ld (savede),de
|
||||
ld (savehl),hl
|
||||
ld (saveix),ix
|
||||
pop bc ! return address
|
||||
pop de ! name pointer
|
||||
pop ix ! mode (0 for read,
|
||||
! 1 for write)
|
||||
push ix
|
||||
push de
|
||||
push bc
|
||||
ld bc,(saveaf)
|
||||
push bc
|
||||
pop af
|
||||
ld bc,(savebc)
|
||||
ld de,(savede)
|
||||
ld hl,(savehl)
|
||||
ld ix,(saveix)
|
||||
ret ! return fd = 0 for read
|
||||
! fd = 1 for write
|
||||
|
||||
_close:
|
||||
ld ix,0 ! return succes
|
||||
ret
|
||||
_exit:
|
||||
jp 0x38
|
||||
.sect .data
|
||||
_errno:
|
||||
.data2 0
|
||||
! output routine in monitor
|
||||
CRT = 0x013B
|
||||
! output a charcter
|
||||
! entry: ascii character in a
|
||||
.sect .text
|
||||
!putchr:
|
||||
! push hl
|
||||
! push bc
|
||||
! ld hl,tab
|
||||
! ld b,5
|
||||
!1: cp (hl)
|
||||
! jr z,fetch
|
||||
! inc hl
|
||||
! inc hl
|
||||
! djnz 1b
|
||||
!2: call CRT
|
||||
! pop bc
|
||||
! pop hl
|
||||
! ret
|
||||
!fetch: inc hl
|
||||
! ld a,(hl)
|
||||
! jr 2b
|
||||
!! conversion table for nascom characters
|
||||
!tab: .data1 0x0D,0x00
|
||||
! .data1 0x1B,0x1E
|
||||
! .data1 0x08,0x1D
|
||||
! .data1 0x0A,0x1F
|
||||
! .data1 0x7F,0x00
|
||||
|
||||
KBD = 0x69
|
||||
! get character from keyboard
|
||||
getchr:
|
||||
call KBD
|
||||
jr nc,getchr
|
||||
cp 0x1F
|
||||
jr z,CR
|
||||
cp 0x1D
|
||||
jr z,BS
|
||||
ret
|
||||
CR: ld a,0xA
|
||||
ret
|
||||
BS: ld a,0x8
|
||||
ret
|
||||
Reference in New Issue
Block a user