flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Examples and Tutorials > Hobby Basic

Goto page Previous  1, 2, 3
Author
Thread Post new topic Reply to topic
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 15493
Location: Front row seats, please


filox wrote:
Sorry but where i can find sources of Hobbybasic?

Have a look at the first post in this thread.
Post 21 Oct 2016, 12:13
View user's profile Send private message Visit poster's website Reply with quote
system error



Joined: 01 Sep 2013
Posts: 671

This is good. Keep it coming, bro!
Post 22 Oct 2016, 13:32
View user's profile Send private message Reply with quote
filox



Joined: 13 Feb 2013
Posts: 10


revolution wrote:

filox wrote:
Sorry but where i can find sources of Hobbybasic?

Have a look at the first post in this thread.



No source, only EXE and Demo.bas
Post 26 Oct 2016, 12:24
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 7033
Location: ˛                              ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣ Posts: 6699

hi filox,
you could try pm picnic for source etc
Post 26 Oct 2016, 12:36
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1216
Location: Underwater

Hi filox, the source is not available, at least not yet. Hobby Basic has still some way to go. I want to extend the command list, find methods to make the intepreter faster, add features like user procedures with parameters and local variables and some other ideas i have. This is done somewhat slowly, the only days i can steal some time to work are the weekends.
Post 26 Oct 2016, 13:37
View user's profile Send private message Reply with quote
filox



Joined: 13 Feb 2013
Posts: 10


Picnic wrote:
Hi filox, the source is not available, at least not yet. Hobby Basic has still some way to go. I want to extend the command list, find methods to make the intepreter faster, add features like user procedures with parameters and local variables and some other ideas i have. This is done somewhat slowly, the only days i can steal some time to work are the weekends.



Hi picnic, if u can share code with us, we can help you possibly to improve it faster and i'm interested in it for educational scope Very Happy
Post 18 Nov 2016, 13:19
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1216
Location: Underwater


Quote:
...and i'm interested in it for educational scope


Take a look at MINI-BASIC for fasm. It's a piece of code available for modifications.
Post 21 Nov 2016, 15:50
View user's profile Send private message Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1216
Location: Underwater

Hobby Basic Strings

I have uploaded a new version with bug fixes and various internal tweaking.

A string variable is identified by the symbol $ at the end of a variable name.
Concatenation uses the + addition symbol to add literal or variable parts to a
string variable.


Code:

    age=10
    a$="I am "+chr(34)+str(age)+chr(34)+" years old."
    print a$
    pause





Code:

    a$="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    b$=reverse(a$)
    print a$,EOL$,b$
    print left(a$,5)
    pause





Code:
    
    input "How many words:",n
    dim a$[n]

    for i=0 to n-1
        print "Enter word ",i+1,":",
        input a$[i]
    next 
    pause





Code:

    do
        input "password:",a$
    until comp(trim(a$),"letmein")=1
    print "You are in."
    pause   




Last edited by Picnic on 08 Jan 2018, 07:36; edited 15 times in total
Post 21 Dec 2016, 12:34
View user's profile Send private message Reply with quote
avcaballero



Joined: 02 Feb 2004
Posts: 157
Location: Madrid - Spain

Hello, it is very interesting. I was very fond of qbasic. I'd just say that it would be nice to see your page in English, Greek is a bit hard for me Smile
Post 21 Dec 2016, 13:20
View user's profile Send private message Visit poster's website Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1216
Location: Underwater

User-defined functions

User-defined functionality is now available in Hobby Basic.
It's have not been tested carefully, so there will be errors.

A user-defined function returns an integer value. A variable can be passed
(by value) as parameter to the function. A variable to store the return value
must precede the function call. Local variables which are declared inside a
function, can be used only inside that function.

Code:

    sub addition(a,b)    ! function declaration

        local sum        ! local variable declaration

        sum = a+b

        rets sum         ! return value

    ends                 ! function end
                         

    input "Enter number 1:",a
    input "Enter number 2:",b
                         
    sum = addition(a,b)  ! function call

    print "Output:",sum
    pause




Any type of variable can be declared as local within a user-defined function
as seen below. The DIM command is omitted when a local array is declared
within a user-defined function.

Code:

    sub foo()

        local sum
        local a$ = "ABCD"
        local a[4] = 2,4,8,16

        sum = len(a$) + a[0]

        rets sum

    ends


    sum = foo()
    print sum
    pause       




When passing any type of variable as a function parameter, the caller and
callee have two independent variables with the same value. All parameters
are passed by value.

Code:


    sub foo(a,a$,a[])

        local sum

        sum = a + len(a$) + a[0]

        rets sum

    ends


    a = 1
    a$ = "ABCD"
    dim a[4] = 2,4,8,16

    sum = foo(a,a$,a[])
    print sum
    pause




I have posted an example game 2048.
Post 23 Feb 2018, 15:59
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

< 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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2017, Tomasz Grysztar.