6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Apr 20, 2024 3:04 pm

All times are UTC




Post new topic Reply to topic  [ 14 posts ] 
Author Message
 Post subject: Ye olde Mandelbrot...
PostPosted: Mon Jan 07, 2019 9:30 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1395
Location: Scotland
So floating about the 'net there is a nice ASCII Mandelbrot program - link here:

https://github.com/RC2014Z80/RC2014-BAS ... brot/Ascii

(from a recent posting)

Anyway - my little SBC runs the usual EHBasic, Applesoft and BBC Basic and the Mandelbrot output is surprisingly different, although it won't run under Applesoft due to an arithmetic overflow (4 byte floats, I guess vs. 5 in EHBasic and BBC Basic.

Anyway this is the EHBasic output:

Code:
...............................,,,,,,,,,,,,,,,,,...............................
...........................,,,,,,,,,,,,,,,,,,,,,,,,,...........................
........................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,........................
......................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,......................
....................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,....................
..................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,~~..................
.................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,';~~'.................
................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'~~~''~................
..............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'~~~''~',,..............
.............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'~~~~''~',,,,.............
............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'^~~~''~',,,,,,............
...........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'!~~~''!'',,,,,,,...........
..........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'~!~~!'';'',,,,,,,,,..........
.........''',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,''^!~~:~~^!',,,,,,,,,,,.........
........''''',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'~:!~~^~~!^'',,,,,,,,,,,,........
........''''''',,,,,,,,,,,,,,,,,,,,,,,,,,,,,'':!!~~^~~^!'',,,,,,,,,,,,,........
.......!^~''''''',,,,,,,,,,,,,,,,,,,,,,,,,''~[!!~!;~~^!'',,,,,,,,,,,,,,,.......
......''!:~''''''''',,,,,,,,,,,,,,,,,,,'''~//!!!!:~~^:~'',,,,,,,,,,,,,,,,......
.....'''^!:~~'''''''''',,,,,,,,,,,,,''''~<;^!!!;:~~^!;'',,,,,,,,,,,,,,,,,,.....
.....''''^!:~~~''''''''''''''''''''''~~ : :!!!#:!~;!:''',,,,,,,,,,,,,,,,,,.....
....''''''^![!~~~~'''''''''''''''~~~~?[ &&::;/:^!:O!~'',,,,,,,,,,,,,,,,,,,,....
....''''''';![!~~~~~~~~~~~~~~~~~~~~/x       ?; /:/ &''',,,,,,,,,,,,,,,,,,,,....
...,'''''''':![^~~~~~~~~~~~~~~~~! O         <  :?<[~''',,,,,,,,,,,,,,,,,,,,,...
...,''''''''<:!<^!~~~~~~~~~~~~!:             [x?X^ '''',,,,,,,,,,,,,,,,,,,,,...
..,,,''''''''<:!?^!~~~~~~~~~!^;                 /[&''',,,,,,,,,,,,,,,,,,,,,,,..
..,,,''''''''<::!?;^!!~~~~!!^^                  /:^''',,,,,,,,,,,,,,,,,,,,,,,..
..,,,''''''''':::! /^^^!!!^^^[                  [:;''',,,,,,,,,,,,,,,,,,,,,,,..
.,,,''''''''''!: :: ?;^^^^^:/                    : ~''',,,,,,,,,,,,,,,,,,,,,,,.
.,,,''''''''''!x[ :/<<[;;;;&                      : ~'',,,,,,,,,,,,,,,,,,,,,,,.
.,,,'''''''''''<     <?<//&                       <^</!,,,,,,,,,,,,,,,,,,,,,,,.
.,,'''''''''''!:      xxOx                         [ :^!,,,,,,,,,,,,,,,,,,,,,,.
,,,'''''''''''![                                    &:!~,,,,,,,,,,,,,,,,,,,,,,,
,,'''''''''''~!                                   [ ~~''',,,,,,,,,,,,,,,,,,,,,,
,,''''''''''~!!                                  X/~~'''',,,,,,,,,,,,,,,,,,,,,,
,~~~~~~'~~~~!!                                     ~'''''',,,,,,,,,,,,,,,,,,,,,
,~^~~~~~~~!!!                                       '''''',,,,,,,,,,,,,,,,,,,,,
~~~&^~~~!!!!?                                    &!!''''''',,,,,,,,,,,,,,,,,,,,
~~~^:^^!!!:<                                     <~~''''''',,,,,,,,,,,,,,,,,,,,
!![^&:;;::?                                    [!!~~~'''''',,,,,,,,,,,,,,,,,,,,
                                             &;:^!~~~''''''',,,,,,,,,,,,,,,,,,,
!![^&:;;::?                                    [!!~~~'''''',,,,,,,,,,,,,,,,,,,,
~~~^:^^!!!:<                                     <~~''''''',,,,,,,,,,,,,,,,,,,,
~~~&^~~~!!!!?                                    &!!''''''',,,,,,,,,,,,,,,,,,,,
,~^~~~~~~~!!!                                       '''''',,,,,,,,,,,,,,,,,,,,,
,~~~~~~'~~~~!!                                     ~'''''',,,,,,,,,,,,,,,,,,,,,
,,''''''''''~!!                                  X/~~'''',,,,,,,,,,,,,,,,,,,,,,
,,'''''''''''~!                                   [ ~~''',,,,,,,,,,,,,,,,,,,,,,
,,,'''''''''''![                                    &:!~,,,,,,,,,,,,,,,,,,,,,,,
.,,'''''''''''!:      xxOx                         [ :^!,,,,,,,,,,,,,,,,,,,,,,.
.,,,'''''''''''<     <?<//&                       <^</!,,,,,,,,,,,,,,,,,,,,,,,.
.,,,''''''''''!x[ :/<<[;;;;&                      : ~'',,,,,,,,,,,,,,,,,,,,,,,.
.,,,''''''''''!: :: ?;^^^^^:/                    : ~''',,,,,,,,,,,,,,,,,,,,,,,.
..,,,''''''''':::! /^^^!!!^^^[                  [:;''',,,,,,,,,,,,,,,,,,,,,,,..
..,,,''''''''<::!?;^!!~~~~!!^^                  /:^''',,,,,,,,,,,,,,,,,,,,,,,..
..,,,''''''''<:!?^!~~~~~~~~~!^;                 /[&''',,,,,,,,,,,,,,,,,,,,,,,..
...,''''''''<:!<^!~~~~~~~~~~~~!:             [x?X^ '''',,,,,,,,,,,,,,,,,,,,,...
...,'''''''':![^~~~~~~~~~~~~~~~~! O         <  :?<[~''',,,,,,,,,,,,,,,,,,,,,...
....''''''';![!~~~~~~~~~~~~~~~~~~~~/x       ?; /:/ &''',,,,,,,,,,,,,,,,,,,,....
....''''''^![!~~~~'''''''''''''''~~~~?[ &&::;/:^!:O!~'',,,,,,,,,,,,,,,,,,,,....
.....''''^!:~~~''''''''''''''''''''''~~ : :!!!#:!~;!:''',,,,,,,,,,,,,,,,,,.....
.....'''^!:~~'''''''''',,,,,,,,,,,,,''''~<;^!!!;:~~^!;'',,,,,,,,,,,,,,,,,,.....
......''!:~''''''''',,,,,,,,,,,,,,,,,,,'''~//!!!!:~~^:~'',,,,,,,,,,,,,,,,......
.......!^~''''''',,,,,,,,,,,,,,,,,,,,,,,,,''~[!!~!;~~^!'',,,,,,,,,,,,,,,.......
........''''''',,,,,,,,,,,,,,,,,,,,,,,,,,,,,'':!!~~^~~^!'',,,,,,,,,,,,,........
........''''',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'~:!~~^~~!^'',,,,,,,,,,,,........
.........''',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,''^!~~:~~^!',,,,,,,,,,,.........
..........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'~!~~!'';'',,,,,,,,,..........
...........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'!~~~''!'',,,,,,,...........
............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'^~~~''~',,,,,,............
.............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'~~~~''~',,,,.............
..............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'~~~''~',,..............
................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'~~~''~................
.................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,';~~'.................
..................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,~~..................
....................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,....................
......................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,......................
........................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,........................
...........................,,,,,,,,,,,,,,,,,,,,,,,,,...........................
...............................,,,,,,,,,,,,,,,,,...............................


and this is the BBC Basic output:

Code:
...............................,,,,,,,,,,,,,,,,,...............................
...........................,,,,,,,,,,,,,,,,,,,,,,,,,...........................
........................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,........................
......................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,......................
....................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,....................
..................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,..................
.................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.................
................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,................
..............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,..............
.............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.............
............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,............
...........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,...........
..........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,..........
.........,,,,,,,,,,,,,,,''''''''''',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.........
........,,,,,,,,,,,,''''''''''''''''''',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,........
........,,,,,,,,,''''''''''''''''''''''''',,,,,,,,,,,,,,,,,,,,,,,,,,,,,........
.......,,,,,,,''''''''''''''''''~~~~!~~~''''',,,,,,,,,,,,,,,,,,,,,,,,,,,.......
......,,,,,,,''''''''''''''''~~~~~! ;!!~~~'''',,,,,,,,,,,,,,,,,,,,,,,,,,,......
.....,,,,,,''''''''''''''''~~~~~~!^;&^^!~~~~'''',,,,,,,,,,,,,,,,,,,,,,,,,,.....
.....,,,,,''''''''''''''''~~~~~~!!^:<[< !~~~~'''',,,,,,,,,,,,,,,,,,,,,,,,,.....
....,,,,''''''''''''''''~~~~~~~!!!:;/ /:^!~~~~''''',,,,,,,,,,,,,,,,,,,,,,,,....
....,,,''''''''''''''''~~~~~~~!!!^;[  <;^!!~~~~''''',,,,,,,,,,,,,,,,,,,,,,,....
...,,,''''''''''''''''~~~~~~~!!!^< x  #O:!!!~~~~''''',,,,,,,,,,,,,,,,,,,,,,,...
...,,''''''''''''''''~~~~~~~!!^^:;o    #;^!!!!~~'''''',,,,,,,,,,,,,,,,,,,,,,...
..,,,'''''''''''''''~~~~~~!!^^^::[      ;:^^!!!~~''''',,,,,,,,,,,,,,,,,,,,,,,..
..,,''''''''''''''~~~~~~!!^:;;;;[/o    ?/[;^^^#!~~''''',,,,,,,,,,,,,,,,,,,,,,..
..,''''''''''''''~~~~~!!!^:? &/          ? ;;;x:!~'''''',,,,,,,,,,,,,,,,,,,,,..
.,,'''''''''''''~~~~!!!!^^:&  O            &oxOx!~'''''',,,,,,,,,,,,,,,,,,,,,,.
.,'''''''''''''~~!!!!!!^^^;/                   [!!~'''''',,,,,,,,,,,,,,,,,,,,,.
.,'''''''''''~~!!!!!!!^^^;o&                   :^!~'''''',,,,,,,,,,,,,,,,,,,,,.
.''''''''''~~!^^^!!!^^^::                     &:^!~~'''''',,,,,,,,,,,,,,,,,,,,.
,'''''''~~~!!:&:::::::::;<                    X[ !~~'''''',,,,,,,,,,,,,,,,,,,,,
,''''~~~~~!!^:x[[;&/;;;;/                       #!~~'''''',,,,,,,,,,,,,,,,,,,,,
'''~~~~~~!!!^:/O &? ?<[[<                      x;^~~''''''',,,,,,,,,,,,,,,,,,,,
''~~~~~~!!!!::[x      ?<?                      o;!~~~'''''',,,,,,,,,,,,,,,,,,,,
'~~~~~~!!!!^:;<#       xO                       :!~~~'''''',,,,,,,,,,,,,,,,,,,,
~~~~~~!!!^:X[/                                  ^!~~~'''''',,,,,,,,,,,,,,,,,,,,
~~~~~^^^^:;&?o                                 ;^!~~~'''''',,,,,,,,,,,,,,,,,,,,
!!^:;:^:;;/o                                  /:^!~~~'''''',,,,,,,,,,,,,,,,,,,,
                                             &;:^!~~~''''''',,,,,,,,,,,,,,,,,,,
!!^:;:^:;;/o                                  /:^!~~~'''''',,,,,,,,,,,,,,,,,,,,
~~~~~^^^^:;&?o                                 ;^!~~~'''''',,,,,,,,,,,,,,,,,,,,
~~~~~~!!!^:X[/                                  ^!~~~'''''',,,,,,,,,,,,,,,,,,,,
'~~~~~~!!!!^:;<#       xO                       :!~~~'''''',,,,,,,,,,,,,,,,,,,,
''~~~~~~!!!!::[x      ?<?                      o;!~~~'''''',,,,,,,,,,,,,,,,,,,,
'''~~~~~~!!!^:/O &? ?<[[<                      x;^~~''''''',,,,,,,,,,,,,,,,,,,,
,''''~~~~~!!^:x[[;&/;;;;/                       #!~~'''''',,,,,,,,,,,,,,,,,,,,,
,'''''''~~~!!:&:::::::::;<                    X[ !~~'''''',,,,,,,,,,,,,,,,,,,,,
.''''''''''~~!^^^!!!^^^::                     &:^!~~'''''',,,,,,,,,,,,,,,,,,,,.
.,'''''''''''~~!!!!!!!^^^;o&                   :^!~'''''',,,,,,,,,,,,,,,,,,,,,.
.,'''''''''''''~~!!!!!!^^^;/                   [!!~'''''',,,,,,,,,,,,,,,,,,,,,.
.,,'''''''''''''~~~~!!!!^^:&  O            &oxOx!~'''''',,,,,,,,,,,,,,,,,,,,,,.
..,''''''''''''''~~~~~!!!^:? &/          ? ;;;x:!~'''''',,,,,,,,,,,,,,,,,,,,,..
..,,''''''''''''''~~~~~~!!^:;;;;[/o    ?/[;^^^#!~~''''',,,,,,,,,,,,,,,,,,,,,,..
..,,,'''''''''''''''~~~~~~!!^^^::[      ;:^^!!!~~''''',,,,,,,,,,,,,,,,,,,,,,,..
...,,''''''''''''''''~~~~~~~!!^^:;o    #;^!!!!~~'''''',,,,,,,,,,,,,,,,,,,,,,...
...,,,''''''''''''''''~~~~~~~!!!^< x  #O:!!!~~~~''''',,,,,,,,,,,,,,,,,,,,,,,...
....,,,''''''''''''''''~~~~~~~!!!^;[  <;^!!~~~~''''',,,,,,,,,,,,,,,,,,,,,,,....
....,,,,''''''''''''''''~~~~~~~!!!:;/ /:^!~~~~''''',,,,,,,,,,,,,,,,,,,,,,,,....
.....,,,,,''''''''''''''''~~~~~~!!^:<[< !~~~~'''',,,,,,,,,,,,,,,,,,,,,,,,,.....
.....,,,,,,''''''''''''''''~~~~~~!^;&^^!~~~~'''',,,,,,,,,,,,,,,,,,,,,,,,,,.....
......,,,,,,,''''''''''''''''~~~~~! ;!!~~~'''',,,,,,,,,,,,,,,,,,,,,,,,,,,......
.......,,,,,,,''''''''''''''''''~~~~!~~~''''',,,,,,,,,,,,,,,,,,,,,,,,,,,.......
........,,,,,,,,,''''''''''''''''''''''''',,,,,,,,,,,,,,,,,,,,,,,,,,,,,........
........,,,,,,,,,,,,''''''''''''''''''',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,........
.........,,,,,,,,,,,,,,,''''''''''',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.........
..........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,..........
...........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,...........
............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,............
.............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.............
..............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,..............
................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,................
.................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.................
..................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,..................
....................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,....................
......................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,......................
........................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,........................
...........................,,,,,,,,,,,,,,,,,,,,,,,,,...........................
...............................,,,,,,,,,,,,,,,,,...............................


I'm sure it's rounding somewhere in the floating point internals or something - not that fussed about it for now, but it does make a good visual test that at least it's all working just fine - more or less...

(BBC Basic is faster than EHBasic but not by much)

Cheers,

-Gordon

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


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 07, 2019 10:35 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1373
Yes, I noticed that too using that particular basic code. There's also one that Bill O posted in an earlier thread in the EhBasic forum:

viewtopic.php?f=5&t=5184#p60638

This one looks better using EhBasic, at least on my SBC. Are you also using the CMOS EhBasic version? Just wondering how much Just wondering how much faster BBC Basic is ;-)

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


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 07, 2019 10:47 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1395
Location: Scotland
floobydust wrote:
Yes, I noticed that too using that particular basic code. There's also one that Bill O posted in an earlier thread in the EhBasic forum:

viewtopic.php?f=5&t=5184#p60638


Ah, I'll check that tomorrow.

Quote:

This one looks better using EhBasic, at least on my SBC. Are you also using the CMOS EhBasic version? Just wondering how much Just wondering how much faster BBC Basic is ;-)


Yes, using (your) cmos version.

bbc basic took 1:10, ehbasic took 1:20 (6502 @ 16Mhz on the PCB) so not that much faster. I'd disabled ctrl-c in ehbasic ( POKE $47F,255) and disabled escape detection in bbc basic as it's rather slow right now.

-Gordon

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


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 07, 2019 10:49 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1373
Good feedback... maybe I should look at porting BBC Basic to my SBC. Do you have a link to the source code? Also wondering if it's larger or smaller than EhBasic. Thanks.

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


Top
 Profile  
Reply with quote  
PostPosted: Tue Jan 08, 2019 12:00 am 
Offline

Joined: Mon May 21, 2018 8:09 pm
Posts: 1462
The 6502 versions of BBC BASIC that I know about are 16KB, so probably somewhat larger than EhBASIC. The tradeoff is that BBC BASIC is a bit faster, less buggy, and much more featureful. BBC BASIC IV is designed for a 65C02; II is designed for NMOS.

The ROM version is mapped and entered at $8000; this will also run (wastefully of RAM) on the Second Processor. The Second Processor version, known as HiBASIC, loads at $B800, just below the 2KB stub ROM of the unit; this leaves more RAM available for use.

It relies on the presence of the Acorn MOS API, whose entry points are in the $FFxx space just below the interrupt vectors. The stubs in the Second Processor ROM implement this API in 2KB, though most of the calls are just passed across the Tube to the full MOS ROM running on the host micro. There's some guidance elsewhere on what parts of MOS are most critical to emulate to get BBC BASIC working; it's somewhat more involved than EhBASIC.


Top
 Profile  
Reply with quote  
PostPosted: Tue Jan 08, 2019 2:05 am 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1923
Location: Sacramento, CA, USA
Applesoft uses 5-byte floats, very similar to the PET/VIC-20/C=64. AFAIK, EhBASIC uses 4-byte floats, which could explain the visible differences in outputs between it and BBC BASIC (which seems quite impressive as far as interpreters go). I believe that the Microsoft versions were coded under considerable time pressure (as was Woz' Integer BASIC), but that could be considered a weak excuse by some.

_________________
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!

Mike B. (about me) (learning how to github)


Top
 Profile  
Reply with quote  
PostPosted: Tue Jan 08, 2019 10:32 am 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1395
Location: Scotland
I'm running BBC Basic 3 from a ROM image and I wrote enough "MOS" to make it work. There is a lot of excellent stuff about it here:

http://mdfs.net/

Including (disassembled, re-constituted) source code for Basic IV - in BBC Asm format which I have converted to ca65 format, however while I can assemble it OK, it's not (yet) working and I'm not sure why. It's not a high priority for me though, so maybe I'll get round to it one day. The ROM image for Basic 3 works fine though - to the limits of the MOS I've implemented though... e.g.

Code:
>10 PRINT "Hello world."
>20 END
>L.
   10 PRINT "Hello world."
   20 END
>SAVE "hw"
osByte 82 0D 00
osFile:
>


so I have put in hooks for all the calls and just print them out and maybe one day I'll implement more/all the OS calls... And while I didn't set out to make a "BBC Clone", I've yet to find anything close in the 6502 world that provides a means to implement virtually everything you might want to do with a "retro" style micro. (And once upon a time I wrote shed-loads of BBC Basic stuff, and used other things on the Beeb like BCPL so it's all very familiar and easy to use)

The above says: Call osByte 82 (which is read machine high order address - I ought to implement that) then osFile which is a filing system call that deals with whole files that in this instance essentially says: "Save entire file, here is the name, start and end addresses in RAM". MOS defines the filing system calls, but not the way data is stored nor hardware used. This made 3rd party filing systems and hardware relatively easy to implement too.

(I'm slowly building my retro collection and have some Beebs/Masters and Apples, but all my original Beeb stuff was stolen many years ago)

Chromatix has given more details, but yes - The BBC Micro had 32K RAM, then 32K ROM (Minus some hardware IO). The ROM was divided into 2; 16K "Language" or "Filing system" ROM and 16K (Minus the IO) OS (Or Machine OS; MOS) ROM. The 16K language ROM was pagable, so you could have many 16K ROMs installed but one active at a time. The MOS would take care of switching for you if you called e.g. a filing system call in a ROM in the same address space as your language (BASIC) ROM. Very quickly 3rd party add-ons enabled RAM in the sideways ROM space to make loading ROMs easier and then the BBC Master implemented that as default.

So BBC Basic was, in-effect much bigger than 16K - it was already 4K bigger than the typical MS or Applesoft BASICs then the MOS did all the stuff like getchar/putchar, graphics operations, filing, serial port, printing and so on, so the actual BASIC part wasn't burdened with that and it made implementing other languages relatively easy - or at least without the burden of what we might now call BIOS...

I'm planning on doing writeups and publishing all my stuff here and on my own blog, but if you want some early code to have a look at, let me know, although if you have a ROM based system then it would require extensive changes to get the MOS jump table installed at the top of page $FF00 as well as some very specific IRQ/BRK handling code - BBC Basic uses BRK to print error messages, after re-directing the MOS BRK vector into itself... My system is all RAM so makes it easier - currently I have $F000-$FFFF for my "monitor" and the MOS handler.

Cheers,

-Gordon

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


Top
 Profile  
Reply with quote  
PostPosted: Tue Jan 08, 2019 10:38 am 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1395
Location: Scotland
barrym95838 wrote:
Applesoft uses 5-byte floats, very similar to the PET/VIC-20/C=64. AFAIK, EhBASIC uses 4-byte floats, which could explain the visible differences in outputs between it and BBC BASIC (which seems quite impressive as far as interpreters go). I believe that the Microsoft versions were coded under considerable time pressure (as was Woz' Integer BASIC), but that could be considered a weak excuse by some.


Hm. you're right - I always though EHbasic was the 5-byte version, but a quick look at it shows e.g.
Code:
LAB_2C7C
      .byte $83,$49,$0F,$DB   ; 6.28319 (2*pi) as floating #


etc.

I didn't get the Applesoft one to run - gave me an overflow error. It was only the ehbasic and BBC Basic ones that ran OK. BBC Basic uses 5-byte floats, so if Applesoft also does then I wonder why it overflowed - of-course since none of this is vaguely IEEE 754 then who knows what the internal format is, although I'm fairly sure it's all documented somewhere. Maybe I'll type it into a real Apple II and check it's not some issue with the Applesoft source code I'm using.

Cheers,

-Gordon

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


Top
 Profile  
Reply with quote  
PostPosted: Tue Jan 08, 2019 12:59 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10791
Location: England
Back to the Mandelbrot question. The EhBasic version looks broken to me, and not just a rounding error. I've just reproduced the problem on my Master with (I realise) an emulated 65C02 on a PiTubeDirect. That's a pretty well-exercised emulation though.

I'm using this EhBasic: http://mdfs.net/Software/6502/EhBasic/

After some old-school addition of PRINT statements, I think it comes down to EhBasic only being sensitive to the first two characters of variable names. So ZREAL and ZR2 refer to the same thing.

Try
Code:
120 Z2=ZM-ZN+CREAL
140 ZREAL=Z2


Top
 Profile  
Reply with quote  
PostPosted: Tue Jan 08, 2019 1:36 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1395
Location: Scotland
BigEd wrote:
Back to the Mandelbrot question. EhBasic looks broken to me. I've just reproduced the problem on my Master with (I realise) an emulated 65C02 on a PiTubeDirect. That's a pretty well-exercised emulation though.

I'm using this EhBasic: http://mdfs.net/Software/6502/EhBasic/

After some old-school addition of PRINT statements, I think it comes down to EhBasic only being sensitive to the first two characters of variable names. So ZREAL and ZR2 refer to the same thing.

Try
Code:
120 Z2=ZM-ZN+CREAL
140 ZREAL=Z2


Doh! I never even noticed that. The things you take for granted now... (Also change COUNT into CT for BBC Basic)

And as an added bonus the Applesoft version now works too and all 3 produce identical results.

I soldered up a few PiTube boards recently - one of these days I might even use one... Almost tempted to write an '816 emulator for it rather than build real 816 hardware...

Cheers,

-Gordon

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


Top
 Profile  
Reply with quote  
PostPosted: Tue Jan 08, 2019 2:18 pm 
Offline

Joined: Wed Jan 08, 2014 3:31 pm
Posts: 559
The ehBasic not only produces weird output, but it is slow. On my 1 MHz machine it takes 21 minutes 48 seconds to complete. So I rewrote it in Forth using fixed point and it takes 6 minutes 4 seconds to produce a better output.

Source: https://github.com/Martin-H1/Forth-CS-1 ... delbrot.fs

Discussion in my Forth CS-101 thread: viewtopic.php?f=9&t=3706


Top
 Profile  
Reply with quote  
PostPosted: Tue Jan 08, 2019 2:44 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10791
Location: England
Amusing to see that the video which prompted you to write the Forth version is exhibiting the same Mandelbrot rendering bug that drogon noticed in the head post! It's a Mandelbrot, but not as we know it.


Top
 Profile  
Reply with quote  
PostPosted: Tue Jan 08, 2019 5:39 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10791
Location: England
On the topic of hosting a BBC Basic on a minimal Beeb-like OS, I've just found this blog post:
http://danceswithferrets.org/geekblog/?p=961


Top
 Profile  
Reply with quote  
PostPosted: Tue Jan 08, 2019 5:46 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1395
Location: Scotland
BigEd wrote:
On the topic of hosting a BBC Basic on a minimal Beeb-like OS, I've just found this blog post:
http://danceswithferrets.org/geekblog/?p=961


Ah, not seen that, but it essentially refers to the same source material I used - http://mdfs.net/ and I think Jonathan has posted here on occasion. It's a brilliant site for all things BBC Micro - and more.

-Gordon

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


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 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: