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 Previous 1, 2, 3, 4, 5 Next |
Author |
|
revolution 19 Jan 2021, 22:26
Running unaudited code directly from the Internet.
Nothing could possibly go wrong. |
|||
19 Jan 2021, 22:26 |
|
DimonSoft 20 Jan 2021, 14:21
Guys, please, don’t say a word about JS
|
|||
20 Jan 2021, 14:21 |
|
Picnic 22 Jan 2021, 13:12
I can't do much at the moment other than leave it as is, or disable it.
There's more ways to the interpreter for the downloading and running a program located on a remote server. Code: url$ ='https://files.catbox.moe/3cmzo2.BAS' Code: load url$,1 if V0 = -1 then ? 'load error' : end run '3cmzo2.BAS' or even Code: run url$ get the source code Code: a$ = GETURL(url$) Last edited by Picnic on 14 Sep 2024, 15:54; edited 8 times in total |
|||
22 Jan 2021, 13:12 |
|
Picnic 02 Jul 2021, 09:42
Hi all,
I have uploaded a new version with minor improvements and bug fixes. Passing arguments by value and by reference. Code: sub foo(var,string$,array[]) ends foo(x,a$,a[]) ! by value foo(byref x, byref a$, byref a[]) ! by reference Passing arguments by value and by reference example. Code: a = 100 b = 200 print "Before swap, value of a: ",a print "Before swap, value of b: ",b swap_func(byref a, byref b) print "After swap, value of a: ",a print "After swap, value of b: ",b end sub swap_func(x,y) local temp temp = x x = y y = temp ends Select..Case..Endsel has been added. Code: x = 1 select x case is 1: ? "Choice is 1" case is 2: ? "Choice is 2" case is 3: ? "Choice is 3" case : ! default case ? "Choice is other than 1,2, or 3" endsel Last edited by Picnic on 11 Jul 2024, 23:46; edited 17 times in total |
|||
02 Jul 2021, 09:42 |
|
pabloreda 03 Jul 2021, 00:05
Very nice project picnic!
congrat! |
|||
03 Jul 2021, 00:05 |
|
Picnic 14 Feb 2022, 11:48
pabloreda wrote: Very nice project picnic! Thank you pabloreda. Note for everyone, I will continue to update the interpreter, but I will stop adding new posts here. |
|||
14 Feb 2022, 11:48 |
|
Picnic 30 Nov 2022, 10:01
Images moved to fist post 15394
Last edited by Picnic on 14 Sep 2024, 16:51; edited 6 times in total |
|||
30 Nov 2022, 10:01 |
|
Picnic 27 Dec 2022, 14:17
Images moved to fist post 15394
Last edited by Picnic on 14 Sep 2024, 16:51; edited 7 times in total |
|||
27 Dec 2022, 14:17 |
|
Picnic 12 Jan 2023, 09:55
Images moved to fist post 15394
Last edited by Picnic on 14 Sep 2024, 16:51; edited 8 times in total |
|||
12 Jan 2023, 09:55 |
|
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.
|
|||
12 Jan 2023, 15:08 |
|
Picnic 13 Jan 2023, 08:05
Hello al_Fazlinem
I'm afraid (i think) that is not possible, Hobby BASIC oriented exclusively to Windows, it heavily uses Windows console functions. |
|||
13 Jan 2023, 08:05 |
|
Picnic 23 Jan 2023, 14:48
Code: ! DSTAR.BAS ! Hobby BASIC Interpreter ! D-Star puzzle was originally written for TI-83/84 calculator. ! The object of the game is to collect the yellow diamonds. ! You move all the way to the next wall with every move. ! You may use spacebar to switch places with the red block. ! Try to clear the board in the least number of moves. ! You have 1024 moves limit to complete 10 mazes. ! Use the arrow keys to play. ! Press the spacebar to switch places with the red block. ! Press 1 to restart the maze. ! Enable the option "Use Legacy Console" in Windows 10. ! Right-click on the application title bar and choose the Properties menu option. ! Restart the console. Code:
! SAME.BAS
! Hobby BASIC Interpreter
! Move fast and make bunches of the same colors.
! Left mouse click to replace a tile with its neighbor.
! Press the spacebar to collect colored bunches.
! Press 1 to reset the board.
Code: ! LIGHTSOUT.BAS ! Hobby BASIC Interpreter ! The game consists of a 5 by 5 grid of light bulbs. ! When the game starts, a stored pattern of these lights is switched on. ! Clicking any of the lights will toggle this, and its adjacent lights. ! The goal is to switch all the lights off, preferably with as few clicks as possible. ! Press the spacebar to restart room. ! Press 2 to skip to the next room. ! Press 1 for previous room. ! Enable the option "Use Legacy Console" in Windows 10. ! Right-click on the application title bar and choose the Properties menu option. ! Restart the console. Code: ! TILTMAZE.BAS ! Hobby BASIC Interpreter ! Guide the red square around the board and collect all the blue squares. ! Use the arrow keys to play. ! Press the spacebar to restart maze. ! Press 2 to skip to the next maze. ! Press 1 for previous maze. ! Tilt Maze requires Windows 7 or later. ! Enable the option "Use Legacy Console" in Windows 10. ! Right-click on the application title bar and choose the Properties menu option. ! Restart the console. Code: ! OTHELLO.BAS ! Hobby BASIC Interpreter ! Othello game in Hobby BASIC. ! Player vs CPU (which chooses random moves). ! Version 0.2, Aug 2024. ! Othello requires Windows 7 or later. ! Enable the option "Use Legacy Console" in Windows 10. ! Right-click on the application title bar and choose the Properties menu option. ! Restart the console. Code: ! BOXUP.BAS ! Hobby BASIC Interpreter ! BoxUp is a puzzle similar to traditional sokoban. ! But here all the boxes are hollow and open on one side. ! They can only be moved by pushing from the inside. ! There are two sizes of boxes, small and large. ! The aim is to push the small red box inside the blue box. ! Black boxes may help or hinder your progress. ! A small box inside a large box can be pushed together. ! Use the arrow keys to play. ! Press the spacebar to restart level. ! Press 2 to skip to the next level. ! Press 1 for previous level. ! Box Up requires Windows 7 or later. ! Enable the option "Use Legacy Console" in Windows 10. ! Right-click on the application title bar and choose the Properties menu option. ! Restart the console. Code: ! FREEFALL.BAS ! Hobby BASIC Interpreter ! Freefall is a remake of an old Java puzzle. ! The goal is to remove all colored blocks from the board. ! Keep in mind that colored blocks are always subject to gravity first. ! The number of moves you can make in each level is limited. ! Click on a block and slide the mouse right or left, then release the mouse. ! Press the spacebar to restart the room. ! Press 2 to skip to the next room. ! Press 1 for previous room. ! Enable the option "Use Legacy Console" in Windows 10. ! Right-click on the application title bar and choose the Properties menu option. ! Restart the console. Code: ! Q.BAS ! Hobby BASIC Interpreter ! Q is a hidden puzzle game inside Ericsson T68i. ! The goal is to place the colored marbles in their respective holes. ! Click and hold mouse on a marble, choose direction and release the mouse. ! Press the spacebar to restart room. ! Press 2 to skip to the next room. ! Press 1 for previous room. ! Press 0 to change window size (default is small). ! Enable the option "Use Legacy Console" in Windows 10. ! Right-click on the application title bar and choose the Properties menu option. ! Restart the console. Code: ! BLIX.BAS ! Hobby BASIC Interpreter ! BLIX is a game with a simple target. ! Form columns of same-color tiles by scrolling the rows. ! Each scroll costs 2 moves, and each cleared column wins you 1 move. ! The game ends when you run out of moves. ! Press 1,2,3,4 to restart level anytime: EASY,NORMAL,HARD,EXPERT. ! Press the spacebar to scroll the rows randomly (it costs 1 move). ! Click on the arrow buttons to scroll a row. ! BLIX requires Windows 7 or later. ! Enable the option "Use Legacy Console" in Windows 10. ! Right-click on the application title bar and choose the Properties menu option. ! Restart the console. Code: ! ELIMINATOR.BAS ! Hobby BASIC Interpreter ! Eliminator is a remake of an old java applet. ! Remove all balls of the same color by lining them up against each other. ! You have a few number of moves on each level. ! The gray balls cannot be removed! ! Use the arrow keys to play. ! Press the spacebar to restart level. ! Press 2 to skip to the next level. ! Press 1 for previous level. ! Press 0 to change window size (default is small). ! Eliminator requires Windows 7 or later. ! Enable the option "Use Legacy Console" in Windows 10. ! Right-click on the application title bar and choose the Properties menu option. ! Restart the console. Code: ! THEME.BAS ! Hobby BASIC Interpreter ! Console Theme Creator for Hobby BASIC. ! Press 1 to 7 to change the theme. ! Click mouse to select and edit a color. ! Press the spacebar to reload theme. ! Press 0 to export theme. ! Press Esc to exit. Code: ! CONNECT4.BAS ! Hobby BASIC Interpreter ! Play 4 in a row against the computer. ! Click the mouse to drop the discs into the grid. ! Use strategy to block the computer while aiming to be the first to get 4 in a row to win. ! The row can be up and down (vertical), across (horizontal), or diagonal. ! Enable the option "Use Legacy Console" in Windows 10. ! Right-click on the application title bar and choose the Properties menu option. ! Restart the console. Code: ! POUX.BAS ! Hobby BASIC Interpreter ! Poux is a fast and challenging arcade game. ! You have to click on adjacent tiles of the same color to remove them. ! Enable the option "Use Legacy Console" in Windows 10. ! Right-click on the application title bar and choose the Properties menu option. ! Restart the console. Code: ! BLOCKS.BAS ! Hobby BASIC Interpreter ! Move the white block to the exit. ! Use the mouse to play. ! Press the spacebar to restart level. ! Press 2 to skip to the next level. ! Press 1 for previous level. ! Blocks requires Windows 7 or later. ! Enable the option "Use Legacy Console" in Windows 10. ! Right-click on the application title bar and choose the Properties menu option. ! Restart the console. Code: ! WORDS.BAS ! Hobby BASIC Interpreter ! Find as many words as you can in a limited time. ! Click the letters of each word in their correct order. ! Use the mouse to play. ! Press the spacebar to get a new word. ! Enable the option "Use Legacy Console" in Windows 10. ! Right-click on the application title bar and choose the Properties menu option. ! Restart the console. Code: ! POKER.BAS ! Hobby BASIC Interpeter ! Poker Hand Rankings. ! Royal flush: A, K, Q, J, 10, all the same suit. ! Straight flush: Five cards in a sequence, all in the same suit. ! Four of a Kind: All four cards of the same rank. ! Full House: Three of a kind with a pair. ! Flush: Any five cards of the same suit, but not in a sequence. ! Straight: Five cards in a sequence, but not of the same suit. ! Three of a Kind: Three cards of the same rank. ! Two Pair: Two different pairs. ! One Pair: One pair. ! Enable the option "Use Legacy Console" in Windows 10. ! Right-click on the application title bar and choose the Properties menu option. ! Restart the console. Code: ! PUZZLE.BAS ! Hobby BASIC Interpreter ! Works with ANSI images of size 80x40. ! Enable the option "Use Legacy Console" in Windows 10. ! Right-click on the application title bar and choose the Properties menu option. ! Restart the console. Code: ! SPY.BAS ! Hobby BASIC Interpreter ! Spy is an original puzzle game. ! On an NxN board, there are numbers and skulls. ! The player can move in all four directions and also diagonal movements are possible. ! Entering a number field, the players position is automatically moved further by the amount of ! fields like the number stated (e.g. entering a field "4", the position is moved further by four fields). ! Crossing a skull, the own trail or reaching the border without the stated number of moves ends the game. ! The goal is to cross a given amount of fields. ! Press the spacebar to restart the game. ! Enable the option "Use Legacy Console" in Windows 10. ! Right-click on the application title bar and choose the Properties menu option. ! Restart the console. Code: ! MINES.BAS ! Hobby BASIC Interpreter ! Minesweeper logic puzzle. ! The rules are simple. ! The board is divided into cells, with mines randomly distributed. ! To win, you need to open all the cells. ! The number on a cell shows the number of mines adjacent to it. ! Using this information, you can determine cells that are safe, and cells that contain mines. ! Cells suspected of being mines can be marked with a flag using the right mouse button. ! Press the spacebar to restart the game. ! Enable the option "Use Legacy Console" in Windows 10. ! Right-click on the application title bar and choose the Properties menu option. ! Restart the console. Code: ! DRAGON.BAS ! Hobby BASIC Intepreter ! Baud Dude Vs. DragonNinja. ! Use the arrows keys Q,W,A,S,D Code: ! LEDIX2.BAS ! Hobby BASIC Interpreter ! Ledix 2 (Ledix Adventure) is a Sokoban-style game. ! Your goal is to push the blue shiny orbs into the holes. ! Orbs of other colors give you a score. ! You gain a life every 1000 points. ! Don't push the deadly skulls into the holes. ! Ledix can push many items at once. ! Use the arrow keys to play. ! Press the spacebar to restart the room (it will cost you one life). ! Press 2 to skip to the next room. ! Press 1 for previous room. ! Enable the option "Use Legacy Console" in Windows 10. ! Right-click on the application title bar and choose the Properties menu option. ! Restart the console. Code: ! TILEMAZE.BAS ! Hobby BASIC Interpreter ! The object of the game is to collect all the items. ! You move all the way to the next wall with every move. ! You may use spacebar to switch place with the stop tile. ! In each room there are three doors leading to other rooms. ! There are 20 rooms in total, creating a dodecahedron. ! Use the arrow keys to play. ! Press spacebar to switch place with the stop tile. ! Press 1 to restart room. ! Press 0 to restart game. ! Tile Maze requires Windows 7 or later. ! Enable the option "Use Legacy Console" in Windows 10. ! Right-click on the application title bar and choose the Properties menu option. ! Restart the console. Code: ! FORMULA1.BAS ! Hobby BASIC Interpreter ! Use the arrow keys to play. ! Enable the option "Use Legacy Console" in Windows 10. ! Right-click on the application title bar and choose the Properties menu option. ! Restart the console. Code: ! XOLAN.BAS ! Hobby BASIC Intepreter ! P2P Tic-Tac-Toe Game via UDP sockets. ! To run it on a local network, you will need to set the REMOTE_IP$ ! of the remote computer and swap the ports. ! To run it on a single computer, run two instances of the program ! with "localhost" instead of IP in both and just swap the ports. ! Enable the option "Use Legacy Console" in Windows 10. ! Right-click on the application title bar and choose the Properties menu option. ! Restart the console. Code: ! MEMORY.BAS ! Hobby BASIC Interpreter ! ANSI memory game. ! Enable the option "Use Legacy Console" in Windows 10. ! Right-click on the application title bar and choose the Properties menu option. ! Restart the console. Code: ! CUBILUS.BAS ! Hobby BASIC Interpreter ! Cubilus is a clone of an old flash game called Cubeoban. ! The objective is to place the colored blocks into their corresponding places. ! Click and hold mouse on a block, choose direction and release the mouse. ! Press the spacebar to restart the room. ! Press 2 to skip to the next room. ! Press 1 for previous room. ! Enable the option "Use Legacy Console" in Windows 10. ! Right-click on the application title bar and choose the Properties menu option. ! Restart the console. Code: ! RGBTILT.BAS ! Hobby BASIC Interpreter ! Version 1.0, Aug 2024. ! 3x3 RBG tilt mazes. ! Tiny-meany tilt-mazes! ! Tilt the tray and let the fun begin. ! Red, blue and green must reach their own goal, all at the same time. ! Use the arrow keys to play. ! Press the spacebar to restart level. ! Press 2 to skip to the next level. ! Press 1 for previous level. ! Enable the option "Use Legacy Console" in Windows 10. ! Right-click on the application title bar and choose the Properties menu option. ! Restart the console. Last edited by Picnic on 26 Aug 2024, 13:29; edited 28 times in total |
|||
23 Jan 2023, 14:48 |
|
386 15 Nov 2023, 12:01
Wow! It looks great!
But why the 58,5 KB program running tiny examples uses 397 MB of memory? Could you reduce it to 39,7 MB or, even better, to 3,97 MB? My system is Windows 7 x64 SP1. |
|||
15 Nov 2023, 12:01 |
|
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 |
|||
15 Nov 2023, 17:01 |
|
386 15 Nov 2023, 22:32
Thanks, Picnic! 30 MB is much better than 397 MB!
Just curious: is it possible to make 3 MB or 300 KB? |
|||
15 Nov 2023, 22:32 |
|
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 ------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------------ |
|||
15 Nov 2023, 22:36 |
|
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. Last edited by Picnic on 16 Nov 2023, 12:00; edited 3 times in total |
|||
15 Nov 2023, 22:46 |
|
386 15 Nov 2023, 22:54
Quote: But maybe I should let the user decide the size of memory they want to use. Users do like to decide! |
|||
15 Nov 2023, 22:54 |
|
Picnic 15 Nov 2023, 23:01
It's easy to implement, i'll think about that. Thanks again for your feedback 386. Quite useful !
|
|||
15 Nov 2023, 23:01 |
|
Goto page Previous 1, 2, 3, 4, 5 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.