flat assembler
Message board for the users of flat assembler.
Index
> Tutorials and Examples > Hobby BASIC, a simple yet powerful BASIC interpreterGoto page Previous 1, 2, 3, 4, 5, 6 |
| Author |
|
|
dosmancer 15 Jun 2025, 21:22
Hi, hi.
Sorry. I tried starting it with `wine HB.EXE` at first but starting it by running `wineconsole HB.EXE` works much better. I see some minor artifacts in Breakout but most of the games I've tried works perfectly! Last edited by dosmancer on 15 Jun 2025, 22:34; edited 1 time in total |
|||
|
|
Picnic 15 Jun 2025, 22:17
That is very interesting. Thank you for testing it. The “Use Legacy Console” option must be enabled on Windows 10 and 11 for proper functionality in some of the programs. I am not sure how this setting behaves under Wine. Thank you again!
|
|||
|
|
Picnic 23 Jun 2025, 00:18
Hello everyone,
Hobby BASIC is quietly shaping up as a small game development platform for the Windows console, combining real-time ASCII graphics and animation with a spirit rooted in the '80s, a look inspired by the '90s, and a simplicity fit for today. Hobby BASIC v2.3.4 — a stable release with FPU string math support and sample code included. The online Get Started guide has been updated: • New examples have been added • The Troubleshooting section is improved • A brief note on the new FPU library is included More detailed documentation about the FPU functions can be found in the full Hobby BASIC manual. Console-only visuals with character-based rendering — 100% ASCII/ANSI. Windows 11 Console screenshots.
![]() |
|||
|
|
Picnic 08 Aug 2025, 19:55
Hello everyone,
A Boulder Dash-like game featuring ANSI graphics for the Windows 11 console, written in Hobby BASIC. 🔹Collect all gems to unlock the exit door. 🔹A door appears randomly in a different quadrant from the player. 🔹Reach the door before the countdown timer reaches zero. 🔹Remaining time is converted into extra time bonus. 🔹Runs on Windows 10/11 without requiring "Use legacy console" mode. The game's source code can be found in the folder: EXAMPLES\GAMES\WIN11\BDASH.BAS. Graphics created with DRAW, the Hobby BASIC graphics tool. Windows 11 console screenshots. ![]()
![]()
![]()
![]() |
|||
|
|
Picnic 26 Aug 2025, 22:56
Hello everyone,
Hobby BASIC v2.3.5 — a stable release that now supports direct Win32 API calls via the syscall command. There are still limitations (32-bit environment, Wide API only, simple structures), but the new capabilities should be quite useful for the size and philosophy of Hobby BASIC. The syntax is simple: Code: syscall "dllname", "functionname", [arguments...] Notes and limitations: • Wide-character (W) API calls only • All integers are passed as 32-bit values (DWORD or handles) • Structures are supported only if fields are DWORD or pointers • You can simulate structures with DIM arrays and pass them BYREF • For smaller fields (e.g., WORD), use shifts and masks • The return value is always stored in system variable V0 syscall command – a few simple examples Code: ! simple message box syscall "user32.dll", "MessageBoxW", 0, "Hello from BASIC!", "Title", 0 Code: ! get current user name x = 256 syscall "advapi32.dll","GetUserNameW", byref a$, byref x print "User Name: ", a$ Code: ! launch calculator syscall "shell32.dll", "ShellExecuteW", 0, "open", "calc.exe", 0, 0, 1 Code: ! milliseconds since boot syscall "kernel32.dll","GetTickCount" print "Milliseconds since boot: ", V0 Code: ! RECT structure (4 DWORDs: left, top, right, bottom) dim rect[4].ZERO syscall "kernel32.dll","GetConsoleWindow" hwnd = V0 syscall "user32.dll","GetWindowRect", hwnd, byref rect[] width = rect[2] - rect[0] height = rect[3] - rect[1] print "Width:", width, " Height:", height To test the new feature, I’ve added a new folder with API examples, including BALLOON.BAS, a simple animated scene running in the Windows 11 console, just for demonstration purposes. ![]() |
|||
|
|
Picnic 01 Oct 2025, 22:28
Hello everyone,
New projects recently added to the Hobby BASIC EXAMPLES collection: • Super Tiny BASIC - A minimalist 80s-style BASIC interpreter written entirely in Hobby BASIC. • Lunar Lander - A modern implementation of the classic game with physics simulation and graphics. • Retro Climber - A classic platform game featuring puzzle challenges with pushing and climbing. • Chain Reaction - A puzzle game where the goal is to match either color or shape to clear the board. All programs are written entirely in Hobby BASIC 2.3.5. For Chain Reaction, as with Lunar Lander, the "Use Legacy Console" option must be enabled under Windows 10/11. Windows 11 Console Screenshots. ![]() |
|||
|
|
chastitywhiterose 06 Nov 2025, 05:40
QBASIC was my first programming language and got me started on my path to C and Assembly. I will recommend this as one of the BASIC interpreters for people new to programming. I haven't used BASIC for a long time, but it certainly has enough power to write almost anything.
|
|||
|
|
Picnic 06 Nov 2025, 12:33
Thanks for sharing your experience!
QBASIC definitely has its place in history, many of us started there. Hobby BASIC is something quite different though: it’s my own small project for Windows, built just for fun and learning. I’m developing it in my spare time, so it’s not really about comparing, just exploring and keeping the BASIC spirit alive. |
|||
|
|
Picnic 08 Nov 2025, 03:26
Hello everyone,
Laser League is a faithful remake of an original PuzzleScript game, rewritten in Hobby BASIC with ANSI graphics for the Windows 11 console. Lead a team of three heroes to solve laser puzzles and recover the stolen jewels from the Robber Baron! This remake was created with permission from the original PuzzleScript author, Tim Knauf. The heroes: 🔹 Bridget – strong and steady, pushes crates to block laser beams 🔹 Sophie – agile acrobat, rolls safely under active lasers 🔹 Zelda – small and quick, slips through tight spaces others can’t How it plays: 🔹 Lasers travel across rooms until they hit a wall or crate 🔹 Switches turn lasers on and off 🔹 Includes movable crates, collectible gems, tutorial screens, and a final boss 🔹 Each character has a unique death animation when hit by a laser Tech details: 🔹 ANSI-style graphics with 16 colors 🔹 Smooth tile-based rendering 🔹 Undo system – go back up to 1000 moves 🔹 13 levels with increasing challenge 🔹 Sound effects for actions and events Source code: EXAMPLES\GAMES\WIN11\LASER.BAS Graphics: Created with DRAW, an ANSI art editor written entirely in Hobby BASIC Screenshot: Taken directly from the Windows 11 console ![]() Last edited by Picnic on 13 Jan 2026, 23:22; edited 2 times in total |
|||
|
|
Picnic 30 Nov 2025, 22:31
Hello everyone,
Stephen’s Deadly Rooms of Death is a faithful remake of an original PuzzleScript game, rewritten in Hobby BASIC with ANSI graphics for the Windows 11 console. Become a master of swordsmanship in this turn-based tactical puzzle game. Move strategically and use your sword to defeat your enemies. Features: 🔹 ANSI graphics with 16 colors 🔹 Smooth tile-based rendering 🔹 Sword handling (pick up, rotate, push) 🔹 Enemies that move toward the player when in line of sight 🔹 Combat system with different rules for enemies and bosses 🔹 9 levels with increasing difficulty 🔹 Sound effects for actions and events 🔹 Full UNDO system Source code: Located in EXAMPLES\GAMES\WIN11\SWORD.BAS Graphics: Created using DRAW, the ANSI art program written entirely in Hobby BASIC Screenshot: Taken directly from the Windows 11 console ![]() Last edited by Picnic on 13 Jan 2026, 23:22; edited 2 times in total |
|||
|
|
Picnic 10 Dec 2025, 23:31
Good day, everyone.
Upcoming version 2.4.1 of Hobby BASIC enhances the continuation character, the backslash (\), adding new capabilities. This seemingly minor but significant extension fundamentally reshapes Hobby BASIC syntax moving forward. ► Continuation character example prior to version 2.4.1: Code: print \ "hello" Equivalent to: print "hello" The limitation in previous versions: The line immediately after the \ character could not be empty nor contain comments - it had to directly continue the command. Examples causing syntax errors: Code: print \ ← empty line "hello" Code: print \ ! This is a comment "hello" I hadn't anticipated this syntax, even though it's absolutely logical and expected by users. The new version 2.4.1 corrects this oversight. Let's see the example again: Code: print \ ! Continue to next line ! <-- This empty space is now allowed in 2.4.1 "Hello world" ! Command completes here The difference is significant: it provides greater flexibility in code and, by extension, for the programmer, while simultaneously improving readability. ► Line Continuation Support for the TIMES command! The TIMES command: • Executes commands multiple times in one line • Uses the V3 variable as counter (zero-based: 0 to n-1) • Accepts multiple commands separated by colon : • Creates inline loops without needing separate FOR/NEXT lines Example: Code: times repeatCount swap 0, 0, 80, 11, 0, 12 : title repeatCount-V3 : wait 120 Equivalent to: Code: FOR i = 0 TO repeatCount-1 swap 0, 0, 80, 11, 0, 12 title repeatCount-i wait 120 NEXT i TIMES didn't support the continuation character. With version 2.4.1 we can break loops into multiple lines using the backslash (\) character! Old syntax (up to 2.4.0): Code: times 10 print "Hello" : print "World" : wait 100 Or even worse for nested loops: Code: times 5 times 5 print "X:", V3;" Y:", V3 New syntax (2.4.1): Code: times 10 \ print "Hello" : \ print "World" : \ wait 100 ► TIMES continuation examples: Test 1: Basic test with single line Code: times 3 print "Hello" Test 2: Multi-line with backslash Code: times 3 \ print "Line 1" : \ print "Line 2" : \ print "Line 3" Test 3: Backslash inside quotes Code: times 2 \ print "This has backslash \\ in string" : \ print "Another with '\' quote" Test 4: Complex expressions with arithmetic Code: times 4 \ x = V3 * 10 : \ print "Iteration ", V3, " value ", x Test 5: Nested commands with graphics Code: times 5 \ color \ RND(15), RND(15) : \ paint V3*5, V3*5, 5, 5, -1, 1 Test 6: With empty line continuation Code: times 3 \ print "Start" : \ \ print "Middle" : \ \ print "End" Test 7: Multiple backslashes on different lines Code: times 2 \ a = 1 : b = 2 : \ \ c = a + b : \ \ print "Sum = ", c : \ \ wait 100 Test 8: Backslash at end without space Code: times 3 print "Test"\ : print "Continued" Test 9: Backslash with empty lines and comments Code: times 3 \ ! Comment \ print "Hello" : \ print "World" Test 10: Zero count Code: times 0 \ print "This should not print" print "Skipped" ► Advanced TIMES continuation examples: Nested TIMES Code: print "Nested TIMES test:" times 2 \ print "Outer ", V3, ":" : \ times 3 \ print " Inner ", V3 inkey Nested FOR/TIMES with Full Continuation Support Code: for \ outer = 1 \ to 3 \ print "┌─ OUTER ITERATION ", outer, " ───────────────────────┐" : \ for \ middle = 1 \ to 4 \ print "│ Middle: ", middle, " " : \ times \ 2 \ print "│ Times[", V3, "] " : \ if \ V3 = 0 \ then \ print "First " : \ else \ print "Second" : \ print "│" next \ middle : \ print "└──────────────────────────────────────────────┘" : \ print ! Blank line next \ outer Dynamic Array Average Calculation Code: forever# dim data[5,5].RND 10000 data[].SIZE array_length = V0 times array_length : \ sum = 0 : \ times 5 \ value = data[V3,V3] : \ sum = sum + value : \ average = sum / 5 : \ print "row ", V3, " average: ", average goto forever With each iteration, I aim to make Hobby BASIC's syntax more programmer-friendly while keeping its BASIC DNA intact. Hobby BASIC is built from scratch in 100% Win32 Assembly, hand-coded parser, zero dependencies, straight byte crunching. ► New Examples in version 2.4.1 Two new examples have been added in the 2.4.1 update: CIRCLES.BAS - Multiple Random Circles Generator Creates random circles with different sizes, colors, and positions. EQUALIZER.BAS - Fully Parameterizable Equalizer / VU Meter Visual equalizer simulation with moving bars that react to random values. Screenshots from Windows 11 console. ![]() |
|||
|
|
Picnic 25 Dec 2025, 21:12
Hello, Merry Christmas.
Some personal notes i'd like to share with the forum. Hobby BASIC is now entering its second decade. It continues to grow with new programs and games, while slowly evolving along the way. Looking back at projects made for Windows XP and comparing them with those running on Windows 11, the progress feels very real to me. As it moves forward, the future of the interpreter feels encouraging. Hobby BASIC was never meant to replace a daily programming language — it has always been a personal, hobby-driven project. It grew out of my time spent learning and experimenting with assembly using fasm, and it remains a simple BASIC-style language with a few unique and unconventional features, designed specifically for the Windows console. ► New Examples in version 2.4.2 Football with friends is a faithful remake of an original PuzzleScript game, rewritten in Hobby BASIC with ANSI graphics for the Windows 11 console. It's going to take some fancy footwork to solve these football themed logic-puzzles. Coordinate your team-mates to strike a perfect goal, but do take care not to lose a ball in the long grass! Can you solve every puzzle before the final whistle? Features: 🔹 ANSI graphics with custom 16-color palette 🔹 Tile-based rendering 🔹 Efficient redraw system (only changed tiles) 🔹 Complete UNDO system with move history 🔹 Ball physics with realistic movement 🔹 Team coordination mechanics (adjacent players) 🔹 Opponent AI with two behaviors: direct hit and adjacent pass 🔹 Goal system with win/lose conditions 🔹 Sound effects for kicks, goals, and collisions Source code: Located in EXAMPLES\GAMES\WIN11\FOOTBALL.BAS Graphics: Created using DRAW, the ANSI art program written entirely in Hobby BASIC Screenshot: Taken directly from the Windows 11 console ![]() Last edited by Picnic on 13 Jan 2026, 23:22; edited 1 time in total |
|||
|
|
Picnic 04 Jan 2026, 16:58
The first interpreter update of 2026
With this update, Hobby BASIC 2.4.3 brings expressive power that previously required multiple lines of code, without sacrificing the simplicity and ease of classic BASIC. Additionally, two new commands for array handling have been added: MIN and MAX. Code: ! Some methods return a value, which is stored in V0. ! These are: COUNT, FIND, MATCH, SIZE, SUM, MIN, MAX, FILE, and COMPARE. ! Other methods perform an in-place operation and do not return a value. ! STRING ARRAYS (Strings only) ! a$[].FILE dpath$ - List dir content ! a$[].FILE fpath$ - Read file lines ! a$[].SORT - Sort array alphabetically ! STRING/INTEGER ARRAYS (Both types) ! a$[].ZERO - Fill with zeros/empty strings ! a$[].SHUFFLE - Shuffle array elements ! a$[].REVERSE - Reverse element order ! a$[].COPY b$[] - Copy b[] into a[] ! a$[].SWAP b$[] - Swap contents with b[] ! a$[].DELETE idx [, ...] - Delete elements by index ! a$[].INSERT idx, v [...] - Insert values at index ! a$[].FIND x - Find first index of value ! a$[].SIZE - Return array dimensions ! a$[].OUT [indent] - Print full array ! INTEGER ARRAYS (Integers only) ! a[].FILL value - Fill with a value ! a[].RND max - Fill with random values ! a[].SET start - Fill with consecutive values ! a[].COUNT x - Count occurrences ! a[].SUM - Sum of array values ! a[].MIN - Minimum array element (0 if empty) ! a[].MAX - Maximum array element (0 if empty) ! a[].MATCH x [...] - 1 if match found, else 0 ! a[].REPLACE a, b - Replace a with b ! a[].ASSIGN b[] x [...] - Store matches from b[] ! a[].COMPARE b[] - Compare with b[] ! a[].SORTA - Sort ascending ! a[].SORTD - Sort descending ► Basic Examples Code: ! BEFORE: Indirectly with variables a[].SUM if V0 > 100 then print "Large total" ! AFTER: Directly in expression if a[].SUM > 100 then print "Large total" ! NEW: MIN and MAX print "Range:", a[].MAX - a[].MIN ► In Conditions Code: ! BEFORE: Multiple intermediate variables data[].SUM sum = V0 data[].MAX max = V0 if sum > 50 and max < 20 then print "OK" ! AFTER: All in one line if data[].SUM > 50 and data[].MAX < 20 then print "OK" ! NEW: In SELECT CASE select case values[].MIN case < 0: print "Contains negatives" case > 100: print "All above 100" endsel ► Reading Files Code: ! BEFORE: Two steps dim lines$[1000] lines$[].FILE path$ count = SIZE(lines$[]) - 1 ! AFTER: One command count = lines$[].FILE path$ ! returns the line count if count > 0 then print "Lines: ", count ► Compare Arrays Code: ! BEFORE: Via function COMPARE(a[], b[]) result = V0 if result = 1 then print "Equal" ! AFTER: Directly as condition if a[].COMPARE b[] then print "Arrays are identical" ! NEW: Combinations if a[].COMPARE b[] and a[].MAX < 100 then print "Valid" ► The New Additions: MIN and MAX Code: ! Finding value range dim temps[7] = 15, 22, 18, 25, 20, 16, 24 range = temps[].MAX - temps[].MIN ! 25 - 15 = 10 ! Boundary checking if temps[].MAX > 30 then print "Heat warning!" if temps[].MIN < 10 then print "Cold warning!" ! With empty array they return 0 dim empty[] print empty[].MIN ! 0 print empty[].MAX ! 0 Hobby BASIC combines the nostalgia of the 486 era with modern language features, through clean design and assembly implementation. Below we see an example that contains: 🔹Low-level: Syscall, Stack operations 🔹High-level: Array methods, Subroutines 🔹Data types: Int arrays, String arrays, Stack arrays 🔹Math: Integer, Floating-point (FPU) 🔹Control flow: Conditions, Loops (times) 🔹I/O: Debug output, Color control 🔹Type conversion: Automatic int→string for FPU Code: ! Hobby BASIC: Peak expressiveness push -1,-2,-3 ! stack values dim data[] = RND()%100, \ ! array with random init RND()%100, POW(2,8) sub stats(arr[]) ! user subroutine syscall "kernel32","GetTickCount" ! Windows API call debug("Ticks:",V0," Min:",arr[].MIN," Max:",arr[].MAX) rets arr[].SUM>100 ! array method in return ends if stats(data[]) ! subroutine as condition dim a[3] : a[].COPY stack[] ! copy stack to regular array dim words$[] = "Alpha","Beta","Gamma" ! string array color 12,0 : debug("SUM="+STR(data[].SUM)," Stack:",stack[V3]) a[].REVERSE ! reverse integer array words$[].REVERSE ! reverse string array ! FPU string math: calculate average with floating point debug("Avg:",FDIV(STR(data[].SUM), STR(SIZE(data[])))) times 3 : debug(a[V3], "=", words$[V3]) ! parallel iteration inkey ! wait for any key press endif |
|||
|
|
Picnic 13 Jan 2026, 00:26
Hello, everyone.
Spikes 'n' Stuff is a new adventure game written in Hobby BASIC. It is a port of a game that was originally created in PuzzleScript to my interpreter. The game pushes the interpreter a little further. Hobby BASIC is now stable and mature enough to handle even more demanding and complex games. You move through dangerous levels, avoiding deadly spikes and arrow traps, using the undo system to find the safe path. The first part is ready. It is a complete, standalone puzzle game. The core mechanics (spikes, arrows, undo system) are fully implemented. There are ideas for future expansions, such as the GEM mechanics (second part). Features: 🔹Turn-based gameplay 🔹ANSI graphics with 16 colors 🔹Tile-based rendering 🔹Simple pseudo-3D effects on walls 🔹Fast redraw only where needed 🔹Full UNDO system 🔹Arrow traps that activate when they see you 🔹Bullet movement and collision 🔹Spikes with simple animation 🔹Level transitions 🔹Simple player death animation 🔹Optional sounds Source code: Located in EXAMPLES\GAMES\WIN11\SPIKES.BAS Graphics: Created using DRAW, the ANSI art program written entirely in Hobby BASIC Screenshots: Taken directly from the Windows 11 console ![]() |
|||
|
| Goto page Previous 1, 2, 3, 4, 5, 6 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.