6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Thu Nov 21, 2024 1:29 pm

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: EhBASIC for DOS/65
PostPosted: Sun Oct 23, 2022 3:23 pm 
Offline

Joined: Fri Dec 21, 2018 1:05 am
Posts: 1117
Location: Albuquerque NM USA
I found a port of EhBASIC to DOS/65 here. It seems to work reasonably well except SAVE and LOAD functions are not working. Has anyone ported EhBASIC for DOS/65?
Bill


Top
 Profile  
Reply with quote  
 Post subject: Re: EhBASIC for DOS/65
PostPosted: Sun Oct 23, 2022 4:11 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1385
Well, I haven't ported my CMOS version of EhBasic to DOS/65 as of yet. However, this version might be a bit easier to move over. All of the Page zero space starts at location 0 and is contiguous. It's also quite a bit less page zero usage, has all of Klaus' patches to p5 and is just under 10KB in size.

I did implement LOAD and SAVE within EhBasic, but the supporting routines simply calculate the size of the program and setup the appropriate parameters and pointers, then calls Xmodem routines in my Monitor to LOAD and SAVE. I think it should be fairly easy to modify the LOAD and SAVE routines to setup a filename and make the DOS/65 PEM calls to complete it.

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
 Post subject: Re: EhBASIC for DOS/65
PostPosted: Thu Nov 24, 2022 7:22 pm 
Offline

Joined: Wed Nov 11, 2020 10:42 pm
Posts: 104
Location: Kelowna Canada
On the subject of Basic's for DOS/65, I was running across some sample programs that I have and found this one from an Arduino forum on simulating 6502 for ESP32. I list it below and ran it on BASICE(compiled), Basic(MSversion) and dbasic(Ehbasic) in Bill's DOS/65 version for the CRC65.
Interesting is the lack of accuracy but especially in the versions that are not MS. I'm no expert in numerical analysis and will have to read a bunch of old literature regarding floating point calculations on the 6502 but there is room for investigation here.
Here's the program
5 REM PITO'S TRIGONOMETRIC FUNCTIONS TEST 0..89 DEGREE
6 REM FOR C64 V2 BASIC ROMS
7 REM BASED ON WELLKNOWN "9 DEGREE" CALC FORENSIC TEST
8 REM ASIN(ACOS(ATAN(TAN(COS(SIN(9.0)))))) = 9.0 IN DEGREE
10 PH = 3.1415926536/2.0
15 REM DEFINE ARCSIN AND ARCCOS
20 DEF FN ASN(X) = ATN(X/SQR(1.0-X*X))
30 DEF FN ACS(X) = PH-ATN(X/SQR(1.0-X*X))
35 REM TR, TD - TO RAD, TO DEG
40 TR = 3.1415926536 / 180.0
50 TD = 180.0 / 3.1415926536
55 REM INPUT IN DEGREE (0..89)
60 FOR D = 0 TO 89
70 T = SIN(TR*D)
72 T = COS(TR*T)
74 T = TAN(TR*T)
76 T = TD*ATN(T)
80 T = TD*FN ACS(T)
90 T = TD*FN ASN(T)
100 PRINT D; "="; T; " DELTA="; T-D
110 NEXT D
120 END
I'll zip up the results for each into one zip file. It's interesting to note the errors and the divide by zero error unique to dbasic.
Let the fun begin!


Attachments:
msbtrigtest.zip [5.08 KiB]
Downloaded 83 times
Top
 Profile  
Reply with quote  
 Post subject: Re: EhBASIC for DOS/65
PostPosted: Fri Nov 25, 2022 8:24 am 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1488
Location: Scotland
Trig. accuracy tests are often made worse with a degree to radian (and back) calculation too, so it's always good to know what the internal representation is and work with that if you want an extra digit or 2 accuracy. the calculations above introduce 6 extra conversions.

My old Imperial 99T calculator gives an error of 1.44 in the test above with 9 degrees (0.15708 rad), but converting 9° to radians (once), doing the sin(cos(tan... and back again then back to degrees gives a difference of ... zero.

So it might be interesting to do the conversion once, then do the sin(cos( ... and back again then convert back to degrees.

Then there's the difference between accuracy and precision, but that's another can of worms ;-)

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
 Post subject: Re: EhBASIC for DOS/65
PostPosted: Fri Nov 25, 2022 9:10 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
(I notice we've rather gone off the original topic...)

Just for interest really: the result of the forensic, and the sensitivity of the test, comes from the taking of a cosine of a rather small number, and then later the arccos of the corresponding number rather close to 1. A number rather close to 1, with several leading 9s, offers, in effect, fewer digits to work with. In this case 7 leading 9s.

Here's the page I go to for calculator forensics - it links to a large table of results for different calculators.
http://www.rskey.org/~mwsebastian/miscprj/forensics.htm


Top
 Profile  
Reply with quote  
 Post subject: Re: EhBASIC for DOS/65
PostPosted: Mon Nov 28, 2022 10:32 pm 
Offline

Joined: Wed Nov 11, 2020 10:42 pm
Posts: 104
Location: Kelowna Canada
Hi BigEd Thanks for pointing out the reference to the Calculator precision page. As a dedicated HP calc user, I can appreciate the comparisons listed. It appears that the accuracy differences between the MS basic version and the other two is likely due to it being a 9 digit version compared to the 6 digit version used in EhBasic and BasicE. Hidden in the details of the comparisons is the fact that EhBasic in plasmo's DOS/65 does in fact have LOAD and SAVE implemented but the syntax is different from the MSbasic version. I pointed this out in viewtopic.php?f=6&t=6440&start=120 but it might have been overlooked because it was posted in a topic unrelated to this one.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 24 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: