flat assembler
Message board for the users of flat assembler.

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: 15864
Location: 162173 Ryugu
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: 7331
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: 1238
Location: Icarian Sea
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: 1238
Location: Icarian Sea
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: 1238
Location: Icarian Sea
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: 163
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: 1238
Location: Icarian Sea
It's been some time since my last post about HB. All this time there were some bug fixes and various internal tweaking, but not a major update.
Hobby Basic now includes an embedded ANSI file loader that recognizes standard DOS ANSI.SYS escape codes for colours and cursor movement.
Having a console library already written (the one that HB is using as backend), it took me a few hours of work to accomplish it.


Loading an ANSI image is simply a command.
Code:
! n is optional. It controls the drawing speed. ! n=0 unlimited (default) ! n=1 slow...50 fast path$ = "ART\APPLE.ANS" screen 80,25 cls if SIZE(path$)<>-1 ! check if file exists ansi 0,path$ inkey endif end

Image




Another example, slightly more advanced. An ANSI text file viewer.
Code:
rem View multiple ANSI coded text files in folder rem Hobby Basic Sample s=20 ! drawing speed d=2000 ! delay between images auto=1 ! autoplay slideshow count=0 ! valid files found max=250 ! max files in folder dim ext$[2] = ".ans" , ".asc" ! valid file extensions path$=PATH(0)+"\ART\" ! path to ART folder cmd$="DIR "+path$+" /b" exec cmd$,dir$ screen 80,30 cursor 0,0 forever# for n=1 to max a$=READLN(n,dir$) if V0=-1 then break filename$=path$+a$ if SIZE(filename$)<>-1 ! check if file exists if check_ext(filename$)=1 count=count+1 title filename$ color 0,7:cls ansi s,filename$ if KEY(27) then end if auto=1 then wait d else inkey endif endif next n if count=0 then alert "no files found":end goto forever rem Check for valid file extension sub check_ext(path$) local i for i=0 to SIZE(ext$[])-1 if COMP(LCASE(RIGHT(path$,4)),ext$[i])=1 then rets 1 next i rets 0 ends




HB has some special screen management capabilities.
In the ANSI image below (made by NC-17) i will add some ASCII bouncing particles inside the box.
For the sake of example, i will crop the box. This could be done directly in the original image with less code.


Image
Code:
path$="ART/NC-TBG.ANS" if SIZE(path$)=-1 then alert path$," not found":end c=80 r=40 dim nc[c,r] screen 80,68 ! set the screen size cursor 0,0 : cls ! hide the cursor and clear the screen ansi path$ : inkey ! load the ANSI encoded file and wait for a key grab 0,0,c,r,nc[],0 ! copy from screen to array file "nc.hb",nc[],0 ! save array as binary file screen c,r : cls ! set new (smaller) screen size file "nc.hb",nc[],1 ! load binary file to array file "nc.hb",0,3 ! delete the file grab 0,0,c,r,nc[],1 ! transfer array to screen copy 0,0,c,7 ! copy some stars paste 0,r-6,c,7 ! paste at another location flip 0,r-6,c,7,0 ! flip them vertically n=10 ! number of particles dim x[n] dim y[n] dim c[n] dim oldx[n] dim oldy[n] dim vx[n] dim vy[n] for i=0 to n-1 do x[i]=RND(30)+25 y[i]=RND(15)+8 until CELL(x[i],y[i])=32 if i<(n/2) then c[i]=7 else c[i]=9 if RND(2)<>0 then vx[i]=1 else vx[i]=-1 vy[i]=-vx[i] next i c[n-1]=12 oldx[]=x[] oldy[]=y[] delay=20 do for i=0 to n-1 pen c[i] at oldx[i],oldy[i],' ' at x[i],y[i],'o' if CELL(x[i]+vx[i],y[i])<>32 vx[i]=-vx[i] elseif CELL(x[i],y[i]+vy[i])<>32 vy[i]=-vy[i] elseif CELL(x[i]+vx[i],y[i]+vy[i])<>32 vx[i]=-vx[i] vy[i]=-vy[i] else oldx[i]=x[i] oldy[i]=y[i] x[i]=x[i]+vx[i] y[i]=y[i]+vy[i] endif next i wait delay until KEY(27)<>0 end

Image


Description: Unzip NC-TBG.ANS inside ART folder before run.
Download
Filename: NC-TBG.zip
Filesize: 2.14 KB
Downloaded: 37 Time(s)

Post 28 May 2018, 13:49
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


Copyright © 2004-2018, Tomasz Grysztar.

Powered by rwasa.