|
|
Power 6/32 Unix version 1.2b
LL0:
.data
.set SBR,0
.set SLR,1
.set P0BR,2
.set P0LR,3
.set P1BR,4
.set P1LR,5
.set P2BR,6
.set P2LR,7
.set IPL,8
.set MAPEN,9
.set MME,9
.set TBIA,10
.set TBIS,11
.set DCK,12
.set CCK,13
.set PCBB,14
.set KSP,19
.set USP,20
.set CPMDCB,21
.set PADC,25
.set DCR,27
.set DC_ON,1
.set DC_OFF,2
.set TB_ON,256
.set TB_OFF,512
.align 2
.globl _ocnt
_ocnt:
.long 0
.align 2
.globl _icnt
_icnt:
.long 0
.text
.align 1
.globl _writec
_writec:
.word L15
#
# #include "definitions"
#
# /* I/O ROUTINES TO CPU2 CONSOLE */
#
# #define MAXC 1000 /* MAX 1000 chars per line */
# #define OUTADR 0x20000 /* Address of output buffer */
# #define INADR 0x20100 /* Address of input buffer */
#
# long ocnt = 0; /* Next location in output buffer */
# long icnt = 0; /* Next location in input buffer */
# extern long savvec7;
#
# writec(c) /* VERSION to run on the simmulator */
# char c;
# {
jbr L17
L18:
# putchar(c);
pushb 7(fp)
callf $8,_putchar
# }
ret
.set L15,0x0
L17:
jbr L18
.data
.text
.align 1
.globl _readc
_readc:
.word L21
#
# readc(c)
# char *c;
# { char *cptr;
jbr L23
L24:
#
# asm("mfpr $MME,_savvec7");
mfpr $MME,_savvec7
# savvec7 = savvec7 & 0x1;
andl3 $1,_savvec7,r0
movl r0,_savvec7
# asm("mtpr $0,$MME"); /* Disable MME */
mtpr $0,$MME
# cptr = (char *)(INADR+ icnt++);
addl3 $131328,_icnt,r0
movl r0,-56(fp)
incl _icnt
# *c = *cptr;
movb *-56(fp),*4(fp)
# asm("mtpr _savvec7,$MME"); /* Restore MME */
mtpr _savvec7,$MME
# }
ret
.set L21,0x0
L23:
subl3 $56,fp,sp
jbr L24
.data
.text
.align 1
.globl _writes
_writes:
.word L26
#
# writes(s)
# char *s;
# {
jbr L28
L29:
# putstr(s);
pushl 4(fp)
callf $8,_putstr
# }
ret
.set L26,0x0
L28:
jbr L29
.data
.text
.align 1
.globl _reads
_reads:
.word L32
#
# /* This function read a string of characters.
# calling sequence : nochar = reads(s);
# input argument : char *s;
# return value : no. of char read; excluding NULL or CR.
# */
# reads(s)
# char *s;
# { char *str;
jbr L34
L35:
# int ix;
#
# str = s;
movl 4(fp),-56(fp)
# for(ix=0;ix<ALINE;ix++)
clrl -60(fp)
L38:
cmpl -60(fp),$80
jgeq L37
# {
# readc(str);
pushl -56(fp)
callf $8,_readc
# if ((*str==NULL)||(*str==CR))
tstb *-56(fp)
jeql L9999
cmpb *-56(fp),$10
jneq L39
L9999:
# { *str = NULL;
clrb *-56(fp)
# break;
jbr L37
# }
# else str++;
L39:
incl -56(fp)
# }
L36:
incl -60(fp)
jbr L38
L37:
# icnt = 0; /* For simulator only */
clrl _icnt
#
# return(ix);
movl -60(fp),r0
ret
# }
ret
.set L32,0x0
L34:
subl3 $60,fp,sp
jbr L35
.data
.text
.align 1
.globl _writeh
_writeh:
.word L41
# /* This function read a string of HEX digit and
# convert it to integer value.
# calling sequence : stat = readh(ix);
# input parameter : long *ix;
# return value : (stat < 0) if error else (stat = 0);
# */
#
# /*
# readh(ix)
# long *ix;
# { char line[ALINE], *getnum(), *del;
# int nochar;
#
# if ( (nochar = reads(line)) > 8 ) return(-1);
# if ( (del = getnum(line,ix,del,HEX)) < 0 ) return(-1);
# else return(0);
# }
#
# */
#
#
#
# writeh(ix) /* 32 bits HEX */
# long ix;
# { long iy, temp, mask;
jbr L43
L44:
# int count;
# char c;
#
# iy=1; count = 28;
movl $1,-56(fp)
movl $28,-68(fp)
# mask = 0xf0000000;
movl $-268435456,-64(fp)
# while (mask)
L45:
tstl -64(fp)
jeql L46
# {
# c = ( (ix&mask) >> count )&0xf;
andl3 -64(fp),4(fp),r0
movl -68(fp),r1
shar r1,r0,r1
andl2 $15,r1
cvtlb r1,-69(fp)
# count -= 4;
subl2 $4,-68(fp)
# mask = mask >> 4;
shar $4,-64(fp),r0
movl r0,-64(fp)
# if (iy)
tstl -56(fp)
jeql L47
# { mask = 0xf000000;
movl $251658240,-64(fp)
# iy=0;
clrl -56(fp)
# }
# if ((c>=0)&&(c<=9)) c=c+'0';
L47:
tstb -69(fp)
jlss L48
cmpb -69(fp),$9
jgtr L48
cvtbl -69(fp),r0
addl2 $48,r0
cvtlb r0,-69(fp)
# else c=c+'7';
jbr L49
L48:
cvtbl -69(fp),r0
addl2 $55,r0
cvtlb r0,-69(fp)
L49:
# writec(c);
pushb -69(fp)
callf $8,_writec
# }
jbr L45
L46:
# }
ret
.set L41,0x0
L43:
subl3 $72,fp,sp
jbr L44
.data
.text
.align 1
.globl _writed
_writed:
.word L51
#
# /* This function read a string of DEC digit and
# convert it to integer value.
# calling sequence : stat = readd(ix);
# input parameter : long *ix;
# return value : (stat < 0) if error else (stat = 0);
# */
#
# /*
# readd(ix)
# long *ix;
# { char line[ALINE], *getnum(), *del;
# int nochar;
#
# if ( (nochar = reads(line)) > 11 ) return(-1);
# if ( (del = getnum(line,ix,del,DEC)) < 0 ) return(-1);
# else return(0);
# }
# */
#
#
# writed(ix) /* 32 bits DECIMAL */
# long ix;
# { char c;
jbr L53
L54:
# long div;
# float divi;
# int lead0;
#
# /*
# if (ix<0)
# { writes("********");
# return(0); }
# lead0 = 1;
# divi = 1000000000;
# div = divi;
# while (div)
# {
# c = (ix/div)+'0';
# ix = ix%div;
# divi = divi/10;
# div = divi;
# if ((c=='0')&&(lead0)) c=SPACE;
# else lead0 = 0;
# writec(c);
# }
# */
#
# }
ret
.set L51,0x0
L53:
subl3 $68,fp,sp
jbr L54
.data
#
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.