start = timer dim ar(100),cr(100) dim br(10) cls restore a = -1 if port=1 then a=romver print "rom Version ";a;" Free: ";fre(0) print "Running test of PBASIC 2.1 on "; if port=0 then print "PC" else print "Portfolio" read a,b : if a <> 1 then print "Read Error":stop read a : if a <> 11 then print "Read Error":stop read a : if a <> 12 then print "Data Error":stop y = 11 if y <> 11 then print "Assignment Error":stop for x = 1 to 10 y = y + 2 next x restore 13 read a : if a <> 21 then print "Restore Error":stop if y = 31 then goto 10 else print "Loop Error":stop print "this is never execute" : stop 10 a = 1 a = a + 15 if a <> 16 then print "Addition error":stop a = a * 10 if a <> 160 then print "Multiply error":stop a = a / 20 if a <> 8 then print "divide error":stop a = a - 5 if a <> 3 then print "Subtraction Error":stop a = 10 b = a \ 3 if b <> 3 then print "Int. Division Error":stop b = a % 3 if b <> 1 then print "Mod Error":stop if 2^5 <> 32 then print "Exp Error":stop if int(12^2.5) <> int(498.831) then print "Exp Error":stop if 2^-1 <> .5 then print "Exp Error":stop if fix(1234567.123)<>1234567 then print "Fix Error":stop if int(1234565.123)<>1234565 then print "Int Error":stop 11 data 1,2 12 data 11,12,13,14,15,16,17,18,19,20 13 data 21,22,23,24,25,26,27,28,29,30 a = 1.23e+2 : if a<> 123 then print "Real Number error":stop a = 1.23e-2 : if a <> .0123 then print "Real Number Error":stop for a1 = 0 to 10 ar(a1) = a1 : br(a1) = ar(a1) next if abs(-5)<>5 then print "ABS Error":stop for a1 = 10 to 0 step -1 if ar(a1) <> br(a1) then print "Array Error" : stop next a1 m = 1 n = 2 swap m,n : if m<> 2 then print "Swap Error" :stop swap m,n swap ar(7),br(8) : if br(8) <> 7 then print br(8), "Swap Error":stop swap ar(7),br(8) swap ar(5), m : if m <> 5 then print "Swap Error":stop swap m, ar(5) : if m <> 1 then print "Swap Error":stop y = 12 for x = 10 to 1 step -1 y = y - 2 next x if y = 10 then print "Loop error":stop if y >= 0 then print "loop error":stop if y < 10 then goto 20 print "If Error":stop 20 if y <= -8 then goto 30 print "If error":stop 30 if y <> -8 then print "Loop Error":stop gosub 100 if y = -8 then "Gosub error":stop if &h100 <> 256 then print "Hex error":stop if &o377 <> 255 then print "Octal error":stop if 15 <> &17 then print "Octal error":stop if port=1 then def seg=&hb000 else def seg = &hb800 poke 0,196 if port=1 then refresh if peek(0) <> 196 then print peek(0),"Peek/Poke/Seg Error":stop poke 0,82 if port=1 then refresh abcde = 12345 rem abcde = 0 if abcde <> 12345 then print "Rem error":stop 'abcde = 1 if abcde = 1 then print "Rem Error":stop z = 1+2*3+4/5*6-1 w = 10.8 if z <> w then print z,w,"Precedence error":stop if sqr(100)<>10 then print "SQR Error":stop cx = csrlin : cy = pos(0) locate 5,6 if csrlin <> 5 then print "Locate Error":stop if pos(0) <> 6 then print "Locate Error":stop locate cx, cy on port+1 goto 1000, 2000 'port tests print "On Goto Error":stop 1000 print "End of test - OK" print "Test took " timer-start " seconds" : end end 100 y = 1 : return print "Multiline or Return Error":stop 2000 'port tests status 1 beep status 1 locate 7,14 click print "1-201-555-1234"; locate 7,13 status 0 box 6,11,8,30,1 dial "1-201-555-1234" box 6,11,8,30,0 for ct = 48 to 63 sound ct, 15 next ct locate 3,1 display 2 'static vlocate 1,1 dir = 4:gosub 5000 dir = 2:gosub 5000 vx=vcsrlin:vy=vpos(0) vlocate 11,12 if vcsrlin<>11 then print "VCSRLIN Error":stop if vpos(0)<>12 then print "VPOS Error":stop vlocate vx,vy dir = 3:gosub 5000 dir = 1:gosub 5000 vlocate 1,1 goto 1000 5000 for xx = 1 to 5 vmove dir,1 click next xx return