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
Author
Thread Post new topic Reply to topic
Picnic



Joined: 05 May 2007
Posts: 1298
Location: Paradise Falls
Picnic
I liked the idea and it was relatively easy to add as a feature.
I have not thought about what issues may arise.
sleepsleep, you stressed me a little now.


Last edited by Picnic on 06 Jul 2021, 14:39; edited 2 times in total
Post 19 Jan 2021, 20:39
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 18198
Location: In your JS exploiting you and your system
revolution
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: 955
Location: Belarus
DimonSoft
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: 1298
Location: Paradise Falls
Picnic
I can't do much at the moment other than leave it as is, or disable it. Smile

There's more ways to the interpreter for the downloading and running a program located on a remote server.
Code:

    url$ = 'https://sites.google.com/site/hobbybasicfiles/TEST.BAS'
    

Code:

    load url$,1
    if V0 = -1 then ? 'load error' : end
    run 'TEST.BAS'
    

or even
Code:

    run url$
    


get the source code
Code:

    a$ = GETSRC(url$)
    


Select ... Case has been added.
Code:

    x = 1
    select x
    case 1:
        ? "Choice is 1"
    case 2:
        ? "Choice is 2"
    case 3:
        ? "Choice is 3"
    case :
        ? "Choice is other than 1,2, or 3"
    endsel
    



I have uploaded a new version with minor improvements and bug fixes.

Hobby Basic Version 1.1.4

Hobby Basics folder system has updated. SOUND command added.

Previous format:
ART\
DATA\
FX\

Current Format:
EXAMPLES\ART\
EXAMPLES\DATA\
EXAMPLES\FX\
EXAMPLES\UDP\


A breakout game with sounds now included in the examples.

Image


Last edited by Picnic on 06 Jul 2021, 14:49; edited 2 times in total
Post 22 Jan 2021, 13:12
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1298
Location: Paradise Falls
Picnic
Hi all,

I have uploaded a new version with minor improvements and bug fixes.

Hobby Basic 1.2.0

Smaller executable size. The wait command return to milliseconds. The time measurement in microseconds was abandoned. The SPC() function has been removed since the more flexible GEN() function now exists. Improved error messages. A point that I have neglected and HB suffers from. It still needs work but it's much better now. Small internal changes made the interpreter some ms faster overall in my measurements. Minor bug fixes. The interpreter works consistently on Windows XP, 7 and 10. Includes all programs presented in previous posts. The previous version of the Trim(string$) funtion was removing the whitespace and newline characters (0x9,0x20,0xA,0xD) simultaneously left and right on a string but without the option to select a side. The new syntax of the command is Trim(n,string). The values ​​obtained by the variable n are 0, 1 and 2, for TrimLR, TrimL and TrimR respectively. Enum command is also added. More information and examples have been added to the README file.

9/7/2021 - A silent update to version 1.2.1 concerning a fix at the internal ANSI interpreter module. A new command SCROLL is now available which scrolls the console screen buffer up or down, plus some new code examples.

18/7/2021 - A silent update to version 1.2.3. Small internal changes increase stability in Windows 10. Hobby Basic now runs better on newer versions of Windows, but remains just as functional on XP. The version additions concern the SET command and a new function MATCH (arg, arg_list, ...). More demos has been added and the README file updated with all latest information.

Some quick examples.
Code:

    ! sets a,b,c,d to 1024
    set 1024,a,b,c,d
    

Code:

    ! sets the string parameters to 'some text'
    set 'some text',a$,b$,c$,d$
    

Code:

    myvar=10
    x=11
    y=12

    if MATCH(myvar,13,x,y)=0 then ? 'not found'
    

Code:

    mytext$='abcde'
    b$='abc'
    c$='ab'

    if LEN(MATCH(mytext$,'abcd',b$,c$))=0 then ? 'not found'
    


8/8/2021 - A silent update to version 1.2.4. Passing arguments by reference is now possible. To pass an argument by reference, use 'byref' keyword before the argument on the subroutine call. Still under testing though. Also, some bug fixes made.

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(byref a, byref b)

    print "After swap, value of a: ",a
    print "After swap, value of b: ",b
    end

    sub swap(x,y)

        local temp

        temp = x
        x = y
        y = temp

    ends
    



Text Draw was updated in version 0.5 after some time. It now works more stable (especially in Windows 7) and some new features have been added.

I will show you what it can do now.
I am opening an ANSI file.
We can paint using the character set.
We can change the colors of the image, rotate image, cut it into pieces.
Make copies of the pieces, or insert a new image.
Open long static ANSI images switching from one frame to another.
Text Draw converts an ANSI image to .HB format (always the screen we see) and saves 2 files.
One in the dimension 80x50 and one smaller in the dimension 80x25 (the classic size of the old ANSI files).

Image

Image


With HB and Text Draw we can make a console animation in a minimum of time.
Pressing F10 the interpreter does the conversion and exports a loading script.

Image


I added few commands between grab and inkey and run the script.
Code:

    do
        copy 0,2,80,13
        move 1,2,79,13,0,2
        paste 79,2
        wait 30 
    until KEY(27)
    



Not visible here, but the top row with the robots is constantly scrolling to the left in the console window.

Image

Bugs and small problems exist.
I used google translate.


Last edited by Picnic on 13 Aug 2021, 07:34; edited 10 times in total
Post 02 Jul 2021, 09:42
View user's profile Send private message Reply with quote
pabloreda



Joined: 24 Jan 2007
Posts: 114
Location: Argentina
pabloreda
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: 1298
Location: Paradise Falls
Picnic
Thank you pabloreda! More to come.
Post 03 Jul 2021, 07:10
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3, 4

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

Website powered by rwasa.