flat assembler
Message board for the users of flat assembler.

Index > Tutorials and Examples > Hobby BASIC, a simple yet powerful BASIC interpreter

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



Joined: 05 May 2007
Posts: 1454
Location: Piraeus, Greece
Picnic 19 Jan 2021, 20:39
Code:
    ! ----------------------------------------------------------------------------------------
    !  QUIX.BAS
    !  Hobby BASIC Interpreter
    !  Example program from the Hobby BASIC collection
    !
    ! ----------------------------------------------------------------------------------------
    !  GAME DESCRIPTION
    ! ----------------------------------------------------------------------------------------
    !
    !  Original Hobby BASIC game celebrating 10 years of interpreter development!
    !  Form groups of three or more matching colored tiles by moving them along clear paths.
    !  Select start and end points to strategically create matches.
    !
    !  Controls:
    !  - Mouse: Click tile to select, then click empty spot to move
    !  - P: Pause game
    !
    ! ----------------------------------------------------------------------------------------
    


Windows 11 console screenshot.

Image


Last edited by Picnic on 18 Mar 2026, 21:58; edited 8 times in total
Post 19 Jan 2021, 20:39
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20915
Location: In your JS exploiting you and your system
revolution 19 Jan 2021, 22:26
Running unaudited code directly from the Internet.

Nothing could possibly go wrong. Razz
Post 19 Jan 2021, 22:26
View user's profile Send private message Visit poster's website Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 1228
Location: Belarus
DimonSoft 20 Jan 2021, 14:21
Guys, please, don’t say a word about JS Smile
Post 20 Jan 2021, 14:21
View user's profile Send private message Visit poster's website Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1454
Location: Piraeus, Greece
Picnic 22 Jan 2021, 13:12
Code:
    ! ----------------------------------------------------------------------------------------
    !  CRYSTAL.BAS
    !  Hobby BASIC Interpreter
    !  Example program from the Hobby BASIC collection
    !
    ! ----------------------------------------------------------------------------------------
    !  GAME DESCRIPTION
    ! ----------------------------------------------------------------------------------------
    !
    !  Puzzle game where you remove same-color blocks by aligning them.
    !  Limited moves per level - strategy is key!
    !  Warning: Gray blocks cannot be removed.
    !
    !  Controls:
    !  - Arrow Keys: Align and match blocks
    !  - Space: Restart level
    !  - 1: Previous level
    !  - 2: Next level
    !
    ! ----------------------------------------------------------------------------------------
    


Windows 11 console screenshot.

Image


Last edited by Picnic on 18 Mar 2026, 21:59; edited 14 times in total
Post 22 Jan 2021, 13:12
View user's profile Send private message Visit poster's website Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1454
Location: Piraeus, Greece
Picnic 02 Jul 2021, 09:42
Code:
    ! ----------------------------------------------------------------------------------------
    !  MAZEZAM.BAS
    !  Hobby BASIC Interpreter
    !  Example program from the Hobby BASIC collection
    !
    ! ----------------------------------------------------------------------------------------
    !  GAME DESCRIPTION
    ! ----------------------------------------------------------------------------------------
    !
    !  Get the character from left to right by sliding rows of blocks.
    !  Push rows left and right to create a path through the maze.
    !
    !  Controls:
    !  - Arrow Keys: Move and slide rows
    !  - Space: Restart level
    !  - 1: Previous level
    !  - 2: Next level
    !  - 4: Undo move
    !
    ! ----------------------------------------------------------------------------------------
    


Windows 11 console screenshot.

Image


Last edited by Picnic on 18 Mar 2026, 22:00; edited 21 times in total
Post 02 Jul 2021, 09:42
View user's profile Send private message Visit poster's website Reply with quote
pabloreda



Joined: 24 Jan 2007
Posts: 122
Location: Argentina
pabloreda 03 Jul 2021, 00:05
Very nice project picnic!

congrat!
Post 03 Jul 2021, 00:05
View user's profile Send private message Visit poster's website Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1454
Location: Piraeus, Greece
Picnic 14 Feb 2022, 11:48
Code:
    ! ----------------------------------------------------------------------------------------
    !  XONIX.BAS
    !  Hobby BASIC Interpreter
    !  Example program from the Hobby BASIC collection
    !
    ! ----------------------------------------------------------------------------------------
    !  GAME DESCRIPTION
    ! ----------------------------------------------------------------------------------------
    !
    !  Classic Xonix arcade game clone with territory conquest mechanics.
    !  Move Xonix to draw boundaries and conquer 75% of the play area.
    !  Avoid enemies while strategically claiming territory to advance levels.
    !
    !  Controls:
    !  - F1: Start game
    !  - Arrow Keys: Move Xonix
    !  - Q: Exit game
    !
    ! ----------------------------------------------------------------------------------------
    


Windows 11 console screenshot.

Image


Last edited by Picnic on 18 Mar 2026, 22:18; edited 7 times in total
Post 14 Feb 2022, 11:48
View user's profile Send private message Visit poster's website Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1454
Location: Piraeus, Greece
Picnic 30 Nov 2022, 10:01
Code:
    ! ----------------------------------------------------------------------------------------
    !  TILTMAZE.BAS
    !  Hobby BASIC Interpreter
    !  Example program from the Hobby BASIC collection
    !
    ! ----------------------------------------------------------------------------------------
    !  GAME DESCRIPTION
    ! ----------------------------------------------------------------------------------------
    !
    !  Tilt Maze puzzle game - guide the red square to collect all blue squares.
    !  Tilt the board to make the player slide until hitting obstacles.
    !  Original maze designs by Andrea Gilbert with strategic path planning.
    !
    !  Controls:
    !  - Arrow Keys: Tilt board and move player
    !  - Space: Restart current maze
    !  - 1: Previous maze
    !  - 2: Next maze
    !  - ESC: Exit game
    !
    ! ----------------------------------------------------------------------------------------
    


Windows 11 console screenshot.

Image


Last edited by Picnic on 18 Mar 2026, 22:21; edited 11 times in total
Post 30 Nov 2022, 10:01
View user's profile Send private message Visit poster's website Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1454
Location: Piraeus, Greece
Picnic 27 Dec 2022, 14:17
Code:
    ! ----------------------------------------------------------------------------------------
    !  SPY.BAS
    !  Hobby BASIC Interpreter
    !  Example program from the Hobby BASIC collection
    !
    ! ----------------------------------------------------------------------------------------
    !  GAME DESCRIPTION
    ! ----------------------------------------------------------------------------------------
    !
    !  Strategic puzzle game where you navigate numbered tiles while avoiding skulls.
    !  Move onto numbered tiles to shift position by that number, but avoid crossing
    !  skulls, your own trail, or board borders. Complete objectives with limited moves.
    !
    !  Controls:
    !  - Mouse: Click adjacent tiles to move
    !  - Space: Restart game
    !  - ESC: Exit
    !
    ! ----------------------------------------------------------------------------------------
    


Windows 11 console screenshot.

Image


Last edited by Picnic on 18 Mar 2026, 22:05; edited 14 times in total
Post 27 Dec 2022, 14:17
View user's profile Send private message Visit poster's website Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1454
Location: Piraeus, Greece
Picnic 12 Jan 2023, 09:55
Code:
    ! ----------------------------------------------------------------------------------------
    !  BLIX.BAS
    !  Hobby BASIC Interpreter
    !  Example program from the Hobby BASIC collection
    !
    ! ----------------------------------------------------------------------------------------
    !  GAME DESCRIPTION
    ! ----------------------------------------------------------------------------------------
    !
    !  Strategic color-matching puzzle game with scrolling mechanics.
    !  Form vertical columns of same-colored tiles by horizontally scrolling rows.
    !  Balance move economy with strategic tile arrangement for high scores.
    !
    !  Controls:
    !  - 1,2,3,4: Select difficulty level
    !  - Mouse: Click arrow buttons to scroll individual rows
    !  - Space: Random row scrolling (costs 1 move)
    !  - ESC: Exit game
    !
    ! ----------------------------------------------------------------------------------------
    !  LEGACY & PORTS
    ! ----------------------------------------------------------------------------------------
    !
    !  BLIX - A strategic puzzle classic first developed in 2005 with Flash/Actionscript
    !  Multi-platform adaptation spanning consoles, mobile devices, and desktop systems
    !
    !  Platform Ports:
    !  - GP32, GP2X, Wiz, GBA
    !  - Atari ST/STE/TT/Falcon
    !  - iPhone, iPad, Android
    !  - Windows, Linux, Mac
    !  - Intellivision (cartridge)
    !
    ! ----------------------------------------------------------------------------------------
    


Windows 11 screenshot.

Image


Last edited by Picnic on 18 Mar 2026, 22:03; edited 13 times in total
Post 12 Jan 2023, 09:55
View user's profile Send private message Visit poster's website Reply with quote
al_Fazline



Joined: 24 Oct 2018
Posts: 54
al_Fazline 12 Jan 2023, 15:08
Hello, Picnic. Is there a way to run it on GNU+Linux without wine/emulation? Windows is kinda dated by now, people are switching away from it.
Post 12 Jan 2023, 15:08
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1454
Location: Piraeus, Greece
Picnic 13 Jan 2023, 08:05
Code:
    ! ----------------------------------------------------------------------------------------
    !  P2PDRAW.BAS 
    !  Hobby BASIC Interpreter
    !  Example program from the Hobby BASIC collection
    !
    ! ----------------------------------------------------------------------------------------
    !  APPLICATION DESCRIPTION
    ! ----------------------------------------------------------------------------------------
    !
    !  Peer-to-peer collaborative drawing application using UDP sockets.
    !  Draw together with remote users in real-time - left click to paint,
    !  right click to erase. Press SPACE to clear both screens simultaneously.
    !
    !  Controls:
    !  - Left Click: Draw/paint cell
    !  - Right Click: Clear/erase cell
    !  - SPACE: Clear both screens (synchronized)
    !  - ESC: Exit application
    !
    ! ----------------------------------------------------------------------------------------
    !  NETWORK FEATURES
    ! ----------------------------------------------------------------------------------------
    !
    !  - Real-time drawing synchronization
    !  - Peer-to-peer UDP communication
    !  - Coordinate and color encoding
    !  - Synchronized screen clearing with feedback
    !  - Local network or localhost operation
    !
    ! ----------------------------------------------------------------------------------------
    


Windows 11 console screenshot.

Image


Last edited by Picnic on 18 Mar 2026, 22:29; edited 4 times in total
Post 13 Jan 2023, 08:05
View user's profile Send private message Visit poster's website Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1454
Location: Piraeus, Greece
Picnic 23 Jan 2023, 14:48
Code:
    ! ----------------------------------------------------------------------------------------
    !  ZNAX.BAS
    !  Hobby BASIC Interpreter
    !  Example program from the Hobby BASIC collection
    !
    ! ----------------------------------------------------------------------------------------
    !  GAME DESCRIPTION
    ! ----------------------------------------------------------------------------------------
    !
    !  Strategic color-matching puzzle game with geometric challenges.
    !  Form squares and rectangles by selecting four same-colored corner tiles.
    !  Larger shapes yield higher scores in this fast-paced tile-matching classic.
    !
    !  Controls:
    !  - Mouse: Select four same-colored corner tiles to form shapes
    !  - Space: Reset game board
    !  - ESC: Return to main menu
    !
    ! ----------------------------------------------------------------------------------------
    !  LEGACY & PORTS
    ! ----------------------------------------------------------------------------------------
    !
    !  ZNAX - First developed in 2005 with Flash/Actionscript
    !
    !  Platform Ports:
    !  - Windows, Linux, Mac OS
    !  - Amstrad CPC, Atari STFM/STE, Falcon 030
    !  - GameBoy Advance, Nintendo Switch, iPhone
    !  - Android, Pocket PC, Pyra & Pandora
    !  - Steam Deck, JavaScript web version
    !
    ! ----------------------------------------------------------------------------------------
    


ZNAX Platform Ports, all the way from Pocket PCs to the Nintendo Switch.

Windows 11 screenshot.

Image

Image


Last edited by Picnic on 18 Mar 2026, 22:26; edited 42 times in total
Post 23 Jan 2023, 14:48
View user's profile Send private message Visit poster's website Reply with quote
386



Joined: 11 Nov 2023
Posts: 28
Location: Ukraine (Ruthenia)
386 15 Nov 2023, 12:01
Wow! It looks great! Smile

But why the 58,5 KB program running tiny examples uses 397 MB of memory? Sad

Could you reduce it to 39,7 MB or, even better, to 3,97 MB?

My system is Windows 7 x64 SP1.
Post 15 Nov 2023, 12:01
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1454
Location: Piraeus, Greece
Picnic 15 Nov 2023, 17:01
It plays great too, I've tested it on different versions of Windows.
Thanks for the feedback 386 I can definitely reduce it to have very low startup requirements.
Anyway, I uploaded a new version.
The memory footprint should be should be around 30 MB now.


Last edited by Picnic on 15 Nov 2023, 22:48; edited 4 times in total
Post 15 Nov 2023, 17:01
View user's profile Send private message Visit poster's website Reply with quote
386



Joined: 11 Nov 2023
Posts: 28
Location: Ukraine (Ruthenia)
386 15 Nov 2023, 22:32
Thanks, Picnic! 30 MB is much better than 397 MB! Smile

Just curious: is it possible to make 3 MB or 300 KB?
Post 15 Nov 2023, 22:32
View user's profile Send private message Reply with quote
386



Joined: 11 Nov 2023
Posts: 28
Location: Ukraine (Ruthenia)
386 15 Nov 2023, 22:36
I'm trying to understand, what you have changed:
Code:
HB_OLD.EXE                                                               HB_NEW.EXE

00469004:  61                    popad                                |  00469004:  4D                    dec ebp
00469005:  93                    xchg eax, ebx                        |  00469005:  F8                    clc 
00469006:  50                    push eax                             |  00469006:  54                    push esp
00469024:  61                    popad                                |  00469024:  4D                    dec ebp
00469025:  93                    xchg eax, ebx                        |  00469025:  F8                    clc 
00469026:  50                    push eax                             |  00469026:  54                    push esp
0046903C:  61                    popad                                |  0046903C:  4D                    dec ebp
0046903D:  93                    xchg eax, ebx                        |  0046903D:  F8                    clc 
0046903E:  50                    push eax                             |  0046903E:  54                    push esp
------------------------------------------------------------------------------------------------------------------------------------------
00469053:  006193                add byte ptr [ecx-6Dh], ah           |  00469053:  004DF8                add byte ptr [ebp-08h], cl
00469056:  50                    push eax                             |  00469056:  54                    push esp
0046906B:  006193                add byte ptr [ecx-6Dh], ah           |  0046906B:  004DF8                add byte ptr [ebp-08h], cl
0046906E:  50                    push eax                             |  0046906E:  54                    push esp
------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------
004690C5:  0001                  add byte ptr [ecx], al               |  004690C5:  0002                  add byte ptr [edx], al
004690CD:  0001                  add byte ptr [ecx], al               |  004690CD:  0002                  add byte ptr [edx], al
------------------------------------------------------------------------------------------------------------------------------------------
0046920B:  0031                  add byte ptr [ecx], dh               |  0046920B:  0032                  add byte ptr [edx], dh
0046923B:  0031                  add byte ptr [ecx], dh               |  0046923B:  0032                  add byte ptr [edx], dh
------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------
0046E021:  0031                  add byte ptr [ecx], dh               |  0046E021:  0032                  add byte ptr [edx], dh
------------------------------------------------------------------------------------------------------------------------------------------
00471DDF:  0031                  add byte ptr [ecx], dh               |  00471DDF:  0032                  add byte ptr [edx], dh
------------------------------------------------------------------------------------------------------------------------------------------
0047201F:  6800008005            push 05800000h                       |  0047201F:  6800002000            push 00200000h
0047202E:  6800005800            push 00580000h                       |  0047202E:  6800002000            push 00200000h
00472038:  A300494000            mov dword ptr [00404900h], eax       |  00472038:  A308494000            mov dword ptr [00404908h], eax
0047203D:  6800008005            push 05800000h                       |  0047203D:  6800002000            push 00200000h
00472047:  A308494000            mov dword ptr [00404908h], eax       |  00472047:  A3FC484000            mov dword ptr [004048FCh], eax
0047204C:  6800008005            push 05800000h                       |  0047204C:  6800002000            push 00200000h
00472056:  A3FC484000            mov dword ptr [004048FCh], eax       |  00472056:  A30C494000            mov dword ptr [0040490Ch], eax
0047205B:  6800008005            push 05800000h                       |  0047205B:  6800002000            push 00200000h
00472065:  A30C494000            mov dword ptr [0040490Ch], eax       |  00472065:  A300494000            mov dword ptr [00404900h], eax
0047206A:  6800005800            push 00580000h                       |  0047206A:  6800002000            push 00200000h
00472079:  6800005800            push 00580000h                       |  00472079:  6800002000            push 00200000h
00472088:  6800005800            push 00580000h                       |  00472088:  6800002000            push 00200000h
00472097:  6800100000            push 00001000h                       |  00472097:  6800000100            push 00010000h
004720A6:  6800100000            push 00001000h                       |  004720A6:  6800000100            push 00010000h
004720B5:  6800100000            push 00001000h                       |  004720B5:  6800000100            push 00010000h
------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------
00472034:  C08EFFFFA30049        ror byte ptr [esi+00A3FFFFh], 000000 |  00472034:  C08EFFFFA30849        ror byte ptr [esi+08A3FFFFh], 00000049h
0047203F:  008005E8B18E          add byte ptr [eax-714E17FBh], al     |  0047203F:  0020                  add byte ptr [eax], ah
                                                                      |  00472041:  00E8                  add al, ch
                                                                      |  00472043:  B18E                  mov cl, 8Eh
------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------
    
Post 15 Nov 2023, 22:36
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1454
Location: Piraeus, Greece
Picnic 15 Nov 2023, 22:46
Hobby BASIC uses one main internal structure for all data types, 88 bytes in size.
This practically means that, for example, every 1 mb of memory I allocate, I get about 12000 elements (strings, variables, arrays, labels, etc.)
More than enough for a simple toy interpreter.
But maybe I should let the user decide the size of memory they want to use.

I changed a few values in memory allocation calls at startup. That's all. Smile


Last edited by Picnic on 16 Nov 2023, 12:00; edited 3 times in total
Post 15 Nov 2023, 22:46
View user's profile Send private message Visit poster's website Reply with quote
386



Joined: 11 Nov 2023
Posts: 28
Location: Ukraine (Ruthenia)
386 15 Nov 2023, 22:54
Quote:
But maybe I should let the user decide the size of memory they want to use.
Wow! That would be extremely super!

Users do like to decide! Smile
Post 15 Nov 2023, 22:54
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1454
Location: Piraeus, Greece
Picnic 15 Nov 2023, 23:01
It's easy to implement, i'll think about that. Thanks again for your feedback 386. Quite useful !
Post 15 Nov 2023, 23:01
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 Previous  1, 2, 3, 4, 5, 6  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-2026, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.