flat assembler
Message board for the users of flat assembler.

Index > Tutorials and Examples > Hobby BASIC, a toy language interpreter written in fasm

Goto page 1, 2, 3, 4, 5  Next
Author
Thread Post new topic Reply to topic
Picnic



Joined: 05 May 2007
Posts: 1391
Location: Piraeus, Greece
Picnic 05 May 2013, 21:16
Image

Hobby BASIC is a toy language interpreter for the Windows console, written in 32-bit x86 assembly.

Features:

- BASIC-like syntax and a set of specialized commands and functions.
- Supports keyboard and mouse on console.
- Handles ANSI encoding graphics with ease.
- Has a small set of UDP network functions.
- Creates standalone pseudo-executables.
- Runs smoothly on Windows XP/7/10 and 11.


Hobby BASIC interpreter started in 2015 and continues to evolve until nowadays.
My goal is to make a simple-to-use language, suitable for game design in the Windows console.
Guess what, I think it's going well.

Version 2.0.0, November 2024.

Download

Mirror Download Link


A Hobby BASIC program.
Code:

    !  TV.BAS
    !  Hobby BASIC Interpreter

    a$ = 'N  O   S  I  G  N  A  L'

    dim a[8] = 15,14,11,10,13,12,9,0

    view 11
    title 'Channel 4'
    screen 80,25,0
    cursor 0
    color 0,7
    cls

    for x = 0 to 7
        color a[x],0
        paint x*10,0,10,25,-1,-1
    next

    erase 17
    erase 18
    erase 19

    pen 15
    print at 45,18,a$

    do

        copy 0,18,1,1
        move 1,18,79,1,0,18
        paste 79,18

        wait 150

    until KEY(27)

    color 0,7 : cls
    end
    

Image



How to run the examples.

Simply click HB.EXE and select an example.

Image



Alternatively, open the command-line CMD.EXE in the HB folder.
To run the TV.BAS example, type:
Code:
HB EXAMPLES/TV.BAS    


Image



How to create the standalone TV.EXE

Type at the command-line:
Code:

    HB EXAMPLES/TV.BAS -bind TV.EXE
    

A standalone application will be assembled.

Image



Notes for Windows 11 users.

In Windows 11 you have to get back legacy command prompt.
Change to have Windows Console Host instead of Windows Terminal as the default terminal app.
Apply changes and restart the console.
Enable the legacy option.

Image



Showcase

Some games created with Hobby BASIC. Windows 10 console screenshots. Games made with ANSI graphics.


Image Image Image Image

Image Image Image Image

Image Image Image Image

Image Image Image Image

Image Image Image Image

Image Image Image Image

Image Image Image Image

Image Image Image Image


Description: Hobby Basic Interpreter for Windows
Download
Filename: HB.zip
Filesize: 459.85 KB
Downloaded: 3966 Time(s)


_________________
Hobby BASIC Interpreter


Last edited by Picnic on 02 Nov 2024, 10:52; edited 343 times in total
Post 05 May 2013, 21:16
View user's profile Send private message Visit poster's website Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1635
Location: Toronto, Canada
AsmGuru62 05 May 2013, 22:15
Great stuff!
Things like that motivate beginners to start programming.
Post 05 May 2013, 22:15
View user's profile Send private message Send e-mail Reply with quote
MHajduk



Joined: 30 Mar 2006
Posts: 6115
Location: Poland
MHajduk 05 May 2013, 22:28
I suppose that the author's sentiment to QuickBasic was the main inspiration for this project. Nice thing. Smile
Post 05 May 2013, 22:28
View user's profile Send private message Visit poster's website Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 07 May 2013, 04:31
Nice. This prompts me to make a CLI graphics library. Looks pretty neat.
Post 07 May 2013, 04:31
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1391
Location: Piraeus, Greece
Picnic 07 May 2013, 10:10
I am glad you like it guys.
I had some concern whether it can be served as an example or a tutorial, due to the lack of the source code.

Hobby BASIC interpreter partially supports wide characters in the console.
Almost everything can be replaced with wide characters in a Hobby BASIC source program.
For Greek monotone characters, the prerequisite is the choice of the Lucida Console font.
Code:

    view 11
    screen 80,25,0  
    color 0,7
    cls

    print 'Τη γλώσσα μου έδωσαν ελληνική'
    print 'το σπίτι φτωχικό στις αμμουδιές του Ομήρου.'
    print 'Μονάχη έγνοια η γλώσσα μου στις αμμουδιές του Ομήρου.'

    τύπωσε fix print
    ανάποδα fix reverse

    dim Διάταξη$[3] = 'Παλιά','Περιοδικά','Πληροφορικής'

    for ΜΕΤΡΗΤΗΣ = 0 to 2
        τύπωσε ανάποδα(Διάταξη$[ΜΕΤΡΗΤΗΣ])
    next

    inkey 
    end
    

Image

_________________
Hobby BASIC Interpreter


Last edited by Picnic on 11 Jul 2024, 23:43; edited 30 times in total
Post 07 May 2013, 10:10
View user's profile Send private message Visit poster's website Reply with quote
TmX



Joined: 02 Mar 2006
Posts: 841
Location: Jakarta, Indonesia
TmX 07 May 2013, 15:45
This is very nice.
Reminiscent of DOS apps.

Mouse handling would be a nice addition, I think Wink
Post 07 May 2013, 15:45
View user's profile Send private message Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1178
Location: Unknown
HaHaAnonymous 07 May 2013, 20:58
[ Post removed by author. ]


Last edited by HaHaAnonymous on 28 Feb 2015, 20:54; edited 1 time in total
Post 07 May 2013, 20:58
View user's profile Send private message Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 07 May 2013, 23:30
Picnic wrote:
I am glad you like it, i had some concern whether it can be served as helpful example despite the lack of comments in source.


If it can be understood then no worries.

Besides not all examples are aimed at beginners.
Post 07 May 2013, 23:30
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1391
Location: Piraeus, Greece
Picnic 18 Aug 2013, 22:52
I have uploaded a new version with minor improvements and bug fixes.
TmX wrote:
Mouse handling would be a nice addition, I think Wink

Mouse support in Windows console is now available.

Image

_________________
Hobby BASIC Interpreter


Last edited by Picnic on 11 Jul 2024, 23:43; edited 57 times in total
Post 18 Aug 2013, 22:52
View user's profile Send private message Visit poster's website Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1391
Location: Piraeus, Greece
Picnic 15 Dec 2013, 01:37
I have uploaded a new version with minor improvements and bug fixes.

This example displays random colored characters in the console.
Code:

    view 11
    screen 80,30,300
    cursor 0
    color 0,7
    cls

    do

        x = RND() % 24 + 2
        y = RND() % 14 + 2
        c = RND() % 95 + 32

        pen c
        at x,y,CHR(c)

    until KEY(27)

    color 0,7 : cls
    end
    

Image

_________________
Hobby BASIC Interpreter


Last edited by Picnic on 14 Sep 2024, 15:42; edited 46 times in total
Post 15 Dec 2013, 01:37
View user's profile Send private message Visit poster's website Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 15 Dec 2013, 05:58
I get this when I run MOUSE

Image
Post 15 Dec 2013, 05:58
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1391
Location: Piraeus, Greece
Picnic 15 Dec 2013, 10:10
Thanks for the feedback typedef. Can you please tell me your Windows version and if you tried the rest of the samples?
Post 15 Dec 2013, 10:10
View user's profile Send private message Visit poster's website Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 15 Dec 2013, 14:27
Windows 7 64 bit. Actually all the programs except the binary and the the color ones. And why it says print I don't know
Post 15 Dec 2013, 14:27
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1391
Location: Piraeus, Greece
Picnic 15 Dec 2013, 17:28
I will look into the problem as soon as i can. I starting to feel a bit outdated with my windows xp 32-bit.


Last edited by Picnic on 15 Dec 2013, 17:35; edited 1 time in total
Post 15 Dec 2013, 17:28
View user's profile Send private message Visit poster's website Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 15 Dec 2013, 17:34
I see. It's a version difference thing.
Post 15 Dec 2013, 17:34
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1391
Location: Piraeus, Greece
Picnic 18 Dec 2013, 21:33
I think i found what was causing the trouble. Give it a try if you like typedef.
Post 18 Dec 2013, 21:33
View user's profile Send private message Visit poster's website Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 18 Dec 2013, 22:53
They work now Very Happy. Care to share what was causing it to say that?
Post 18 Dec 2013, 22:53
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1391
Location: Piraeus, Greece
Picnic 19 Dec 2013, 21:09
Nice to hear!
Sure, it seems that an improper call to SetConsoleOutputCP function crush the program. By the way, i installed Windows 7.
Post 19 Dec 2013, 21:09
View user's profile Send private message Visit poster's website Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2909
Location: 0x77760000
typedef 20 Dec 2013, 01:13
Picnic wrote:
Nice to hear!
Sure, it seems that an improper call to SetConsoleOutputCP function crush the program. By the way, i installed Windows 7.


Hmm. Nice, what Win7 version?
Post 20 Dec 2013, 01:13
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1391
Location: Piraeus, Greece
Picnic 20 Dec 2013, 20:37
I have uploaded a new version with minor improvements and bug fixes.

A Tetris game for the Windows console.
This is the first Hobby BASIC game made, and it's still working today.

Image

_________________
Hobby BASIC Interpreter


Last edited by Picnic on 11 Jul 2024, 23:43; edited 40 times in total
Post 20 Dec 2013, 20:37
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2, 3, 4, 5  Next

< 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.