home *** CD-ROM | disk | FTP | other *** search
File List | 1991-07-27 | 7.1 KB | 152 lines |
- PL/M-51 COMPILER 07/27/91 PAGE 1
-
-
- DOS 3.30 (038-N) PL/M-51 V1.2
- COMPILER INVOKED BY: C:\51\PLM51.EXE DEMO.P51
-
-
-
- 1 1 demo$start: do;
- $include(reg51.dcl)
- = /* 8051 REG DECLARE */
- 2 1 = DECLARE
- = P0 BYTE AT (80H) register,
- = P1 BYTE AT (90H) register,
- = P2 BYTE AT (0A0H) register,
- = P3 BYTE AT (0B0H) register,
- = PSW BYTE AT (0D0H) register,
- = ACC BYTE AT (0E0H) register,
- = B BYTE AT (0F0H) register,
- = SP BYTE AT (81H) register,
- = DPL BYTE AT (82H) register,
- = DPH BYTE AT (83H) register,
- = PCON BYTE AT (87H) register,
- = TCON BYTE AT (88H) register,
- = TMOD BYTE AT (89H) register,
- = TL0 BYTE AT (8AH) register,
- = TL1 BYTE AT (8BH) register,
- = TH0 BYTE AT (8CH) register,
- = TH1 BYTE AT (8DH) register,
- = IE BYTE AT (0A8H) register,
- = IP BYTE AT (0B8H) register,
- = SOCN BYTE AT (98H) register,
- = SBUF BYTE AT (99H) register;
- = /* bin reg psw */
- 3 1 = DECLARE
- = CY BIT AT (0D7H) register,
- = AC BIT AT (0D6H) register,
- = FO BIT AT (0D5H) register,
- = RS1 BIT AT (0D4H) register,
- = RS0 BIT AT (0D3H) register,
- = OV BIT AT (0D2H) register,
- = P BIT AT (0D0H) register,
- = /* TCON */
- = TF1 BIT AT (8FH) register,
- = TR1 BIT AT (8EH) register,
- = TF0 BIT AT (8DH) register,
- = TR0 BIT AT (8CH) register,
- = IE1 BIT AT (8BH) register,
- = IT1 BIT AT (8AH) register,
- = IE0 BIT AT (89H) register,
- = IT0 BIT AT (88H) register,
- = /* IE */
- = EA BIT AT (0AFH) register,
- = ES BIT AT (0ACH) register,
- = ET1 BIT AT (0ABH) register,
- = EX1 BIT AT (0AAH) register,
- = ET0 BIT AT (0A9H) register,
- = EX0 BIT AT (0A8H) register,
- = /* IP */
- = PS BIT AT (0BCH) register,
- PL/M-51 COMPILER DEMOSTART 07/27/91 PAGE 2
-
-
- = PT1 BIT AT (0BBH) register,
- = PX1 BIT AT (0BAH) register,
- = PTO BIT AT (0B9H) register,
- = PX0 BIT AT (0B8H) register,
- = /* P3 BIN */
- = RD BIT AT (0B7H) register,
- = WR BIT AT (0B6H) register,
- = T1 BIT AT (0B5H) register,
- = T0 BIT AT (0B4H) register,
- = INT1 BIT AT (0B3H) register,
- = INT0 BIT AT (0B2H) register,
- = TXD BIT AT (0B1H) register,
- = RXD BIT AT (0B0H) register,
- = /* SCON BIN */
- = SM0 BIT AT (9FH) register,
- = SM1 BIT AT (9EH) register,
- = SM2 BIT AT (9DH) register,
- = REN BIT AT (9CH) register,
- = TB8 BIT AT (9BH) register,
- = RB8 BIT AT (9AH) register,
- = TI BIT AT (99H) register,
- = RI BIT AT (98H) register;
- 4 2 int0p: procedure interrupt 0 using 1; end;
- 6 2 int1p: procedure interrupt 2 using 2;
- 7 2 declare (int1v0,int1v1) byte;
- 8 2 int1v0=p1;
- 9 2 if (p1 and 07h)=07h
- then do; sbuf=25h;
- 12 3 end;
- 13 3 else do;
- 14 3 sbuf=20h;
- 15 3 end;
- 16 2 return;
- 17 1 end int1p;
- 18 2 samp: procedure (samp$ch) word;
- 19 2 declare samp$ch byte;
- 20 2 declare startad byte at(0e000h) auxiliary;
- 21 2 declare (ad0,ad1) byte at(0e010h) auxiliary;
- 22 2 p1=samp$ch; call time(100);
- 24 2 return ad0+256*ad1;
- 25 1 end samp;
- 26 2 comput1: procedure(var0,var1,var2) word;
- 27 2 declare (var0,var1,var2,result) word;
- 28 3 do case (p1 and 03h);
- 29 3 result=var0+var1+var2;
- 30 3 result=var0*var1+var2;
- 31 3 result=var0/var1-var2;
- 32 3 result=var0 MOD var1;
- 33 3 end;
- 34 2 return result;
- 35 1 end comput1;
- 36 2 comput2: procedure(count) word;
- 37 2 declare count byte, value word;
- 38 2 value=0;
- 39 3 do while count<>0;
- 40 3 value=value+(count*2-1);
- 41 3 count=count-1;
- PL/M-51 COMPILER DEMOSTART 07/27/91 PAGE 3
-
-
- 42 3 end;
- 43 2 return value;
- 44 1 end comput2;
- 45 2 mprog: do;
- 46 2 declare (v0,v1,v2,v3,v4,v5) byte;
- 47 2 declare (d0,d1,d2,d3,d4,d5) word, b0 bit;
- 48 3 do while 1=1;
- 49 3 v0=1; v1=10; v2=20; v3=25; /* byte */
- 53 3 d1=((d0+v1)*v2)+(v3-v2)*v1-v0; /* byte multiply */
- 54 3 d2=1234; d4=54321; d5=45678; /* word */
- 57 4 do v0=1 to 2; d4=d4+2; d5=d5-3; end; /* loop */
- 61 3 d2=samp(2); d3=comput1(d0,d1,d2); /* procedure */
- 63 3 d4=(((v3+1)*v2+1)*v1+1)+((d1+d2/d3)*3); /* word devide */
- 64 3 d5=comput2(v1); /* procedure */
- 65 4 if b0=1 then do;
- 67 4 d1=(v1+v2+v3)*v4; d4=(d4+10)*d1; /* condition */
- 69 4 p1$7=1; b0=0; d2=samp(3); end; /* bit operate */
- *** ERROR #70, STATEMENT #69, LINE #54, NEAR 'P17', UNDECLARED IDENTIFIER
- 73 4 else do; d1=(v1+v2+v3)/v4; d4=d4+10;
- 76 4 p1$7=0; b0=1; d2=samp(4); end; /* bit operate */
- *** ERROR #71, STATEMENT #76, LINE #56, NEAR 'P17', IDENTIFIER IS OUT OF SCOPE
- 80 3 end;
- 81 1 end mprog;
- 82 1 end demo$start;
-
- 131 LINES READ
- 2 PROGRAM ERROR(S)
- END OF PL/M-51 COMPILATION
-