flat assembler
Message board for the users of flat assembler.

Index > High Level Languages > OS-independent version of MIKEOS BASIC

Author
Thread Post new topic Reply to topic
neville



Joined: 13 Jul 2008
Posts: 507
Location: New Zealand
neville 15 Apr 2011, 21:41
I've created an "os-independent" version of Mike Saunders' MIKEOS BASIC interpreter. Then I added an ORG 0100H and embedded some test source code to allow it to run under DOS as a COM program.

MIKEOS BASIC is a well-structured implementation of the good old BASIC programming language which I'm planning to use as a scripting language in my own OS, FAMOS. With some further development it will also provide a high-level programming alternative to my native assembly language IDE (which uses my port of FASM v1.48 to FAMOS).

It could be described as a Tiny Integer Basic with some nice features but also some severe limitations. The executable is only 8681 bytes (assembled with fasm 1.66) and it could certainly still be "size optimised" but I prefer to retain the source code's logical structure which makes it very easy to follow and hopefully very easy to develop further. The first thing I want to do is to extend the integers from 16-bit to 32-bit, or maybe by adding some new variable classes, including "LONG_INTEGER".

In MIBASIC.ASM I've made fairly minimal changes to Mike Saunders' original code I obtained from http://prdownload.berlios.de/mikeos/mikeos-4.1.1.zip , and I've incorporated directly into the code only those MIKEOS function calls which are actually required to make it independent of MIKEOS. I found the required MIKEOS functions in various sources in the source\features folder from the archive above.

The changes include:
- added support for source data created using conventional text editors with CRLF line terminations (originally only Unix-style text editors were supported)
- commented out the MIKEOS-specific LOAD and SAVE commands

Does anybody know if Mike Saunders is on this board? (Of course he should not be confused with Mike Gonta who has recently done a 32-bit PM version of MikeOS, ported to use with his aeBIOS - see http://board.flatassembler.net/topic.php?t=12381 ).


Description: OS-independent MIKEOS BASIC source
Download
Filename: MIBASIC.ASM
Filesize: 67.21 KB
Downloaded: 1258 Time(s)


_________________
FAMOS - the first memory operating system
Post 15 Apr 2011, 21:41
View user's profile Send private message Visit poster's website Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 796
Location: Massachusetts, USA
bitshifter 15 Apr 2011, 23:21
> Does anybody know if Mike Saunders is on this board?

He is a nasm guy who hangs out at osdev
Post 15 Apr 2011, 23:21
View user's profile Send private message Reply with quote
Mike Gonta



Joined: 26 Dec 2010
Posts: 243
Mike Gonta 17 Apr 2011, 19:09
Mike Saunders wrote:
That's really cool! I've added a link in the News section of the MikeOS website

_________________
Mike Gonta
look and see - many look but few see

https://mikegonta.com


Last edited by Mike Gonta on 10 Jun 2014, 10:05; edited 1 time in total
Post 17 Apr 2011, 19:09
View user's profile Send private message Visit poster's website Reply with quote
roboman



Joined: 03 Dec 2006
Posts: 122
Location: USA
roboman 18 Apr 2011, 03:31
Interesting. I did a DexOS port a while ago. With out the save / load and ability to load up a program it makes it a bit like a run time for a basic to be compiled in fasm.

include "mibasic.asm" ; chop it off at basic_prog:
; then just add the basic program and compile...
DB ' CLS',13,10
DB ' PRINT " Please type your name: " ;',13,10
DB ' INPUT $N',13,10
DB ' PRINT ""',13,10
DB ' PRINT " Hello " ;',13,10
DB ' PRINT $N ;',13,10
DB ' PRINT ", welcome to MikeOS Basic!"',13,10
DB ' PRINT ""',13,10
DB ' PRINT " It supports FOR...NEXT loops and simple integer maths..."',13,10
DB ' PRINT ""',13,10
DB ' FOR I = 1 TO 15',13,10
DB ' J = I * I',13,10
DB ' K = J * I',13,10
DB ' L = K * I',13,10
DB ' PRINT I ;',13,10
DB ' PRINT " " ;',13,10
DB ' PRINT J ;',13,10
DB ' PRINT " " ;',13,10
DB ' PRINT K ;',13,10
DB ' PRINT " " ;',13,10
DB ' PRINT L',13,10
DB ' NEXT I',13,10
DB ' PRINT ""',13,10
DB ' PRINT " ...and IF...THEN and GOSUB and lots of other stuff. Bye!"',13,10
DB ' END',13,10
Post 18 Apr 2011, 03:31
View user's profile Send private message Visit poster's website Reply with quote
neville



Joined: 13 Jul 2008
Posts: 507
Location: New Zealand
neville 18 Apr 2011, 03:41
@roboman
Even better, use the FILE directive instead of INCLUDE, and create your source using your text editor. Then you don't have to bother with all the DB '....' s around every line. Cool

_________________
FAMOS - the first memory operating system
Post 18 Apr 2011, 03:41
View user's profile Send private message Visit poster's website Reply with quote
neville



Joined: 13 Jul 2008
Posts: 507
Location: New Zealand
neville 22 Apr 2011, 21:34
So here's Mike Saunder's BASIC Tron game added to the MIBASIC interpreter as a FILE directive and I've renamed the original MIBASIC source to MIKETRON.ASM. It assembles to 9880 bytes.

Combining roboman's suggestion above, MIKETRON.ASM could be rewritten as just 2 lines:
Code:
INCLUDE 'MIBASIC.ASM'
FILE 'TRON.BAS'    


MIBASIC now supports program source files created with any text editor, not just Unix-style editors.

Note: Mike's original Tron source wouldn't run because it used the command CURSORCHAR but the intepreter expects CURSCHAR. CURSCHAR is also confirmed in the MikeOS documentation.


Description: MIBASIC Tron Game FASM Source!
Download
Filename: MIKETRON.ZIP
Filesize: 14 KB
Downloaded: 1003 Time(s)


_________________
FAMOS - the first memory operating system
Post 22 Apr 2011, 21:34
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 25 Apr 2011, 12:50
I think this site has been slashdotted (read: fasmboarded) Sad
http://mikeos.berlios.de/
Doesn't respond
Post 25 Apr 2011, 12:50
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
neville



Joined: 13 Jul 2008
Posts: 507
Location: New Zealand
neville 25 Apr 2011, 20:15
Madis731 wrote:
I think this site has been slashdotted (read: fasmboarded) Sad
http://mikeos.berlios.de/
Doesn't respond
Your link works fine for me.

_________________
FAMOS - the first memory operating system
Post 25 Apr 2011, 20:15
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 28 Apr 2011, 06:31
Now it works!
Weird that some of my posts have disappeared (rollback?) from yesterday and the day before that.
EDIT: Answer found - http://board.flatassembler.net/topic.php?t=12803
Post 28 Apr 2011, 06:31
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
IanSeyler



Joined: 03 May 2011
Posts: 3
IanSeyler 03 May 2011, 18:11
Is it ok if I port this to BareMetal OS? I would like to try BASIC in 64-bit mode.

Thanks,
-Ian
Post 03 May 2011, 18:11
View user's profile Send private message Reply with quote
neville



Joined: 13 Jul 2008
Posts: 507
Location: New Zealand
neville 04 May 2011, 02:37
Hi Ian
AFAIK Mike Saunders' code has a BSD-like licence so there's no problem to port it anywhere you like.

I'm intending to further develop MIBASIC into a useable HLL for FAMOS, so it will be 32-bit but running in a 16-bit flat-real environment.

All the best with BareMetal. I'm interested in creating a 64-bit version of FAMOS one day too. Meanwhile I'll have a look at your ethernet code because I would like to eventually have TCP/IP and a simple web browser running in the existing version of FAMOS.

_________________
FAMOS - the first memory operating system
Post 04 May 2011, 02:37
View user's profile Send private message Visit poster's website Reply with quote
IanSeyler



Joined: 03 May 2011
Posts: 3
IanSeyler 11 May 2011, 18:36
Mike OS spawned the creation of BareMetal OS so the system API is pretty similar. I actually contributed a bit of code to Mike OS a while back. I really liked it but wanted something more modern (16-bit real mode vs 64-bit protected mode).

I've gotten it to the point where MIBASIC.ASM compiles and runs on BareMetal OS. Using the inline sample program it correctly does the CLS and PRINT but the INPUT fails with "Error: unknown command". Probably a pointer or something is off. Still working on it.

The network code works well. Intel PRO/1000 Gigabit cards are supported and I am also writing a driver for the Realtek 8169/8110 family of Gigabit cards. TCP is on our road-map but it will be quite the undertaking.
Post 11 May 2011, 18:36
View user's profile Send private message Reply with quote
IanSeyler



Joined: 03 May 2011
Posts: 3
IanSeyler 27 May 2011, 16:57
The port was a success!

Code is here: http://code.google.com/p/baremetal/source/browse/trunk/programs/mbasic.asm
Screenshot here: http://www.cl.ly/769M

Is this the first 64-bit BASIC interpreter?

-Ian
Post 27 May 2011, 16:57
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u 27 May 2011, 19:21
Very cool.
IanSeyler wrote:

Is this the first 64-bit BASIC interpreter?
-Ian

The first i have heard of.
Post 27 May 2011, 19:21
View user's profile Send private message Reply with quote
me239



Joined: 06 Jan 2011
Posts: 200
me239 17 Jul 2011, 22:42
Hey, I ported it to my OS xOS. Now you can specify the BAS file to be run via the CLI. Screenshot of a simple Celsius to Fahrenheit program (no floating point Sad maybe that should be added ):
Image
Post 17 Jul 2011, 22:42
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
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 vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.