HP-71B BASIC Question
|
03-20-2021, 12:51 AM
Post: #12
|
|||
|
|||
RE: HP-71B BASIC Question
(03-19-2021 07:07 PM)Sylvain Cote Wrote: The last time I have done serious programming on the HP-71B was in the 1980's. A few simple additional ones, many of them avoid unnecessary GOTO's (slow and unsightly): 1) Your original (sans comments): 440 'ISMSTYPE': 441 D=DEVAID(A) @ IF FND(D)=1 THEN GOTO 443 442 DISP "Err: Inv Device Type" @ STOP 443 RETURN Somewhat optimized: 440 'ISMSTYPE': 441 D=DEVAID(A) @ IF FND(D)=1 THEN RETURN 442 DISP "Err: Inv Device Type" @ STOP 443 RETURN 2) Your original (sans comments): 450 'BUSYWAIT': 451 S=SPOLL(A) @ IF FNB(S)=1 THEN GOTO 451 452 RETURN Somewhat optimized: 450 'BUSYWAIT': 451 S=SPOLL(A) @ IF FNB(S) THEN 451 452 RETURN If you can use the JPC ROM: 450 'BUSYWAIT': 451 REPEAT @ S=SPOLL(A) @ UNTIL NOT FNB(S) 452 RETURN 3) Your original (sans comments): 460 'READSTAT': 461 S=SPOLL(A) @ B=FNB(S) @ E=FNE(S) @ C=FNC(S) 462 IF E=0 AND B=0 THEN L=0 @ GOTO 465 463 IF E=0 AND B=1 THEN L=1 @ GOTO 465 464 IF C=7 OR C=9 OR C=10 THEN L=1 ELSE L=2 465 RETURN Somewhat optimized: 460 'READSTAT': 461 S=SPOLL(A) @ B=FNB(S) @ E=FNE(S) @ C=FNC(S) 462 IF NOT E AND NOT B THEN L=0 @ RETURN 463 IF NOT E AND B THEN L=1 @ RETURN 464 IF C=7 OR C=9 OR C=10 THEN L=1 ELSE L=2 465 RETURN 4) Your original (sans comments): 470 'BUILDMSG' 471 IF E=0 AND B=0 THEN M$="" @ GOTO 486 472 IF E=0 AND B=1 THEN M$="Drive Busy" @ GOTO 484 473 IF C= 7 THEN M$="New Tape" @ GOTO 484 474 IF C= 9 THEN M$="Rec Number" @ GOTO 484 475 IF C=10 THEN M$="Rec Checksum" @ GOTO 484 476 IF C= 4 THEN M$="No Tape" @ GOTO 484 477 IF C= 8 THEN M$="Time Out" @ GOTO 484 478 IF C= 3 THEN M$="Tape:EOT+TS" @ GOTO 484 479 IF C= 1 THEN M$="End of Tape" @ GOTO 484 480 IF C= 2 THEN M$="Tape Stalled" @ GOTO 484 481 IF C= 5 OR C=6 THEN M$="Device" @ GOTO 484 482 IF C=12 THEN M$="Tape Size" @ GOTO 484 483 M$="Unknown" 484 IF L=1 THEN M$="Wrn:"&STR$(C)&":"&M$ 485 IF L=2 THEN M$="Err:"&STR$(C)&":"&M$ 486 RETURN Somewhat optimized and if you can use the JPC ROM: 470 'BUILDMSG' 471 IF NOT E AND NOT B THEN M$="" @ RETURN 472 IF NOT E AND B THEN M$="Drive Busy" @ GOTO 484 473 SELECT C @ CASE 7 @ M$="New Tape" 474 CASE 9 @ M$="Rec Number" 475 CASE 10 @ M$="Rec Checksum" 476 CASE 4 @ M$="No Tape" 477 CASE 8 @ M$="Time Out" 478 CASE 3 @ M$="Tape:EOT+TS" 479 CASE 1 @ M$="End of Tape" 480 CASE 2 @ M$="Tape Stalled" 481 CASE 5,6 @ M$="Device" 482 CASE 12 @ M$="Tape Size" 483 CASE ELSE @ M$="Unknown" @ END SELECT 484 IF L=1 THEN M$="Wrn:"&STR$(C)&":"&M$ 485 IF L=2 THEN M$="Err:"&STR$(C)&":"&M$ 486 RETURN 5) Your original (sans comments): 490 'REWIND': 491 GOSUB 'BUSYWAIT' @ GOSUB 'READSTAT' 492 IF L=2 THEN GOSUB 'BUILDMSG' @ DISP M$ @ STOP 493 DISP "Rewinding Tape ..." 494 SEND UNT UNL LISTEN A DDL 7 @ GOSUB 'BUSYWAIT'y 495 RETURN Somewhat optimized: 490 'REWIND': 491 GOSUB 'BUSYWAIT' @ GOSUB 'READSTAT' 492 IF L=2 THEN GOSUB 'BUILDMSG' @ DISP M$ @ STOP 493 DISP "Rewinding Tape ..." 494 SEND UNT UNL LISTEN A DDL 7 @ GOTO 'BUSYWAIT' (line 495 is now unnecessary and can be deleted) Hope that helps, make sure and check that they work Ok. Have a nice weekend and best regards. V. All My Articles & other Materials here: Valentin Albillo's HP Collection |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)