Post Reply 
HP-71B BASIC Question
03-19-2021, 07:07 PM
Post: #11
RE: HP-71B BASIC Question
(03-19-2021 09:01 AM)J-F Garnier Wrote:  
(03-18-2021 11:02 AM)Sylvain Cote Wrote:  I have decided to use the GOSUB/LABEL route, here is a snippet of code to show what it look like ...
Code:
 400 DEF FNB(S1)=IP(FP(S1/2^6)*2) ! IsDriveBusy(StatusByte)       : returns 0=normal or 1=busy  : mask 00100000
 405 DEF FNE(S1)=IP(FP(S1/2^5)*2) ! IsDriveInError(StatusByte)    : returns 0=normal or 1=error : mask 00010000
 410 DEF FNC(S1)=FP(S1/2^4)*2^4   ! GetDriveErrorCode(StatusByte) : returns 0...15=error code   : mask 00001111
 415 DEF FND(D1)=IP(D1/2^4)       ! GetDeviceClass(AccessoryID)   : returns 0...15=device class : mask 11110000 4>> 00001111

Sylvain, may I suggest some improvements?
You may implement or even replace these UDFs using the more efficient binary functions of the HP-IL ROM, for instance:
replace IP(FP(S1/2^6)*2) with BIT(S1,5)
replace FP(S1/2^4)*2^4 with BINAND(S1,15)
There is no bit binary shift operation in the HP-71 BASIC but the integer division can be used, and you can rewrite IP(D1/2^4) as just (D1 DIV 16).

J-F
Bonjour Jean-François,
The last time I have done serious programming on the HP-71B was in the 1980's.
After spending a lot more hours than intended on that project, it is starting to come back, but man I am seriously rusted on that platform.
Nice optimizations, tank you very much.
Sylvain
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP-71B BASIC Question - Sylvain Cote - 03-16-2021, 12:53 AM
RE: HP-71B BASIC Question - toml_12953 - 03-16-2021, 01:42 AM
RE: HP-71B BASIC Question - J-F Garnier - 03-16-2021, 09:34 AM
RE: HP-71B BASIC Question - Sylvain Cote - 03-17-2021, 02:28 PM
RE: HP-71B BASIC Question - Sylvain Cote - 03-17-2021, 07:30 PM
RE: HP-71B BASIC Question - toml_12953 - 03-18-2021, 07:56 AM
RE: HP-71B BASIC Question - Sylvain Cote - 03-18-2021, 11:02 AM
RE: HP-71B BASIC Question - J-F Garnier - 03-19-2021, 09:01 AM
RE: HP-71B BASIC Question - Sylvain Cote - 03-19-2021 07:07 PM
RE: HP-71B BASIC Question - J-F Garnier - 03-20-2021, 09:23 AM
RE: HP-71B BASIC Question - Sylvain Cote - 03-20-2021, 01:03 PM
RE: HP-71B BASIC Question - Sylvain Cote - 03-22-2021, 10:31 PM
RE: HP-71B BASIC Question - J-F Garnier - 03-24-2021, 10:05 AM
RE: HP-71B BASIC Question - rprosperi - 03-24-2021, 12:40 PM
RE: HP-71B BASIC Question - J-F Garnier - 03-24-2021, 04:51 PM
RE: HP-71B BASIC Question - rprosperi - 03-24-2021, 07:36 PM



User(s) browsing this thread: 1 Guest(s)