mirror of
https://github.com/RevCurtisP/C02.git
synced 2024-06-08 06:29:32 +00:00
Replaced goto loops with for(), and do() in slibtest.c02
This commit is contained in:
parent
132eb22944
commit
c3bc2c619e
|
@ -81,18 +81,16 @@ char maxmpd, divdnd, divisr, quotnt;
|
||||||
putstr("DIV()");
|
putstr("DIV()");
|
||||||
mltplr = 255;
|
mltplr = 255;
|
||||||
maxmpd = 1;
|
maxmpd = 1;
|
||||||
drloop:
|
while (mltplr) {
|
||||||
mltpnd = 1;
|
for (mltpnd=1; mltpnd < maxmpd; mltpnd++) {
|
||||||
ddloop:
|
|
||||||
prodct = mult(mltplr, mltpnd);
|
prodct = mult(mltplr, mltpnd);
|
||||||
quotnt = div(prodct, mltpnd);
|
quotnt = div(prodct, mltpnd);
|
||||||
if (quotnt <> mltplr) goto diverr;
|
if (quotnt <> mltplr) goto diverr;
|
||||||
mltpnd++;
|
}
|
||||||
if (mltpnd < maxmpd) goto ddloop;
|
|
||||||
mltplr>>;
|
mltplr>>;
|
||||||
maxmpd<<;
|
maxmpd<<;
|
||||||
if (mltplr <> 0) goto drloop;
|
}
|
||||||
prtok();
|
prtok();
|
||||||
|
|
||||||
tstrnd: //Test rand() and rands()
|
tstrnd: //Test rand() and rands()
|
||||||
char countr, rndnum, rndtbl[255];
|
char countr, rndnum, rndtbl[255];
|
||||||
|
@ -100,20 +98,16 @@ char countr, rndnum, rndtbl[255];
|
||||||
putstr("RAND()");
|
putstr("RAND()");
|
||||||
rands(1); //Seed Random Number Generator;
|
rands(1); //Seed Random Number Generator;
|
||||||
|
|
||||||
countr = 0;
|
countr = 0;
|
||||||
|
do {rndtbl[countr] = 0; countr++;} while (countr);
|
||||||
riloop:
|
|
||||||
rndtbl[countr] = 0;
|
do {
|
||||||
countr++;
|
|
||||||
if (countr <> 0) goto riloop;
|
|
||||||
|
|
||||||
rnloop:
|
|
||||||
rndnum = rand();
|
rndnum = rand();
|
||||||
if (rndtbl[rndnum] > 0) goto rnderr;
|
if (rndtbl[rndnum] > 0) goto rnderr;
|
||||||
rndtbl[rndnum] = $FF;
|
rndtbl[rndnum] = $FF;
|
||||||
countr++;
|
countr++;
|
||||||
if (countr < 255) goto rnloop;
|
} while (countr < 255);
|
||||||
prtok();
|
prtok();
|
||||||
|
|
||||||
tstros: //Test rotatl(), rotatr(), swap()
|
tstros: //Test rotatl(), rotatr(), swap()
|
||||||
char lbyte, rbyte, obyte, sbyte, tbyte, scount;
|
char lbyte, rbyte, obyte, sbyte, tbyte, scount;
|
||||||
|
@ -183,5 +177,5 @@ swperr:
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
c2aerr:
|
c2aerr:
|
||||||
putstr("CTOA("); prbyte(srcchr); putstr(")="); prbyte(dstchr); newlin();
|
newlin(); putstr("CTOA("); prbyte(srcchr); putstr(")="); putstr(tststr); newlin();
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user