dMZX Forums: Low-level stuff supporting, Lua, and Forth - dMZX Forums

Jump to content

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Low-level stuff supporting, Lua, and Forth

#1 User is offline   zzo38 

  • Registered members
  • PipPipPip
  • Group: Members
  • Posts: 445
  • Joined: 16-May 08
  • Gender:Not Telling

Posted 05 August 2008 - 07:49 PM

In case you do implement Lua, please do version 5.1 or newer to support this Forth interpreter: http://zzo38computer.cjb.net/luaforth/ It is based on one I found called minioforth but that one wasn't very good so I improved it (and will continue to improve it more later). Also, if Lua is implement would you add some low-level stuff so that I can add a Forth words for that, please? Also, would each robot be able to have its own variables? I wanted low-level stuff to be able to edit the board layers (under and normal) the color, thing, parameter, completely manually, and editing other parameters possible manually as well. After that, I could implement some MegaZeux-specific stuff in Forth.
In Capitalist America, law violates YOU!

"Potion of Confusing": Solve all the puzzles, hold second one as you hold a pencil, and save gibbering mouthers from the king's army.
0

#2 User is offline   Frobozz 

  • Ryiah
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,808
  • Joined: 07-March 01
  • Gender:Not Telling

Posted 06 August 2008 - 10:24 AM

Obviously any version of Lua being embedded into MegaZeux is going to be the latest (assuming it ever gets finished). I'm sure they wouldn't try and say, embed version 4.0. Also why are you so set on Forth as if it were actually a decent language? :p
0

#3 User is offline   nooodl 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 735
  • Joined: 28-October 06
  • Gender:Not Telling
  • Location:Belgium

Posted 07 August 2008 - 08:25 AM

Give up on Forth. It's a pretty old language, it's outdated, and it's not really useful.
0

#4 User is offline   zzo38 

  • Registered members
  • PipPipPip
  • Group: Members
  • Posts: 445
  • Joined: 16-May 08
  • Gender:Not Telling

Posted 07 August 2008 - 06:23 PM

Forth is a decent language, and very powerful, one of the best in my opinion, actually. The fact that it is old means nothing (some people don't like Forth, but a lot of people still like Forth today, I'm not the only one!). Forth is very good design and you can implement more control structures and stuff directly in Forth. Program languages such as Lua, JavaScript, C, BASIC, etc are not so versatile as that. For example, IF ... ELSE ... THEN can be defined as:
: IF COMPILE ?-GOTO COMPILE-HERE ; IMMEDIATE
: THEN HERE SWAP ! ; IMMEDIATE
: ELSE COMPILE GOTO COMPILE-HERE SWAP HERE SWAP ! ; IMMEDIATE
(in other Forth systems they may be defined a bit differently than this) In similar ways, many of the MegaZeux stuff can be defined also in Forth, such as zap and restore labels, message boxes, MegaZeux-style loops, and other things.

If I create a module in MegaZeux for some low-level stuff, and the ability to edit a object attribute table and other stuff so that you can define your own kind of pieces, would you include that module?

This post has been edited by zzo38: 07 August 2008 - 06:25 PM

In Capitalist America, law violates YOU!

"Potion of Confusing": Solve all the puzzles, hold second one as you hold a pencil, and save gibbering mouthers from the king's army.
0

#5 User is offline   mzxgiant 

  • DigitalMZX Server Ninja & Code Monkey
  • Group: DigiStaff
  • Posts: 1,127
  • Joined: 02-January 01
  • Gender:Male
  • Location:Rochester, NY

Posted 07 August 2008 - 06:27 PM

Just because one person happens to like a language doesn't mean it's well-accepted enough to be included in all future builds...

Also, if I'm wrong about the above statement, PLZ INCLUDE PHP IN MZX KTHX :DDD
0

#6 User is offline   zzo38 

  • Registered members
  • PipPipPip
  • Group: Members
  • Posts: 445
  • Joined: 16-May 08
  • Gender:Not Telling

Posted 07 August 2008 - 06:31 PM

View Postmzxgiant, on Aug 7 2008, 10:27 AM, said:

Just because one person happens to like a language doesn't mean it's well-accepted enough to be included in all future builds...

Also, if I'm wrong about the above statement, PLZ INCLUDE PHP IN MZX KTHX :DDD

No, that isn't what I mean. Of course, I found and improved a Forth interpreter written in Lua so hopefully it will work on MZX as well. This way, Forth codes can be programmed on MZX even if the people who programmed MZX don't like Forth. But PHP is much harder to include in MZX and isn't as good as Forth. PHP is also very slow compared with Perl, Lua, and Forth.
In Capitalist America, law violates YOU!

"Potion of Confusing": Solve all the puzzles, hold second one as you hold a pencil, and save gibbering mouthers from the king's army.
0

#7 User is offline   mzxgiant 

  • DigitalMZX Server Ninja & Code Monkey
  • Group: DigiStaff
  • Posts: 1,127
  • Joined: 02-January 01
  • Gender:Male
  • Location:Rochester, NY

Posted 07 August 2008 - 06:33 PM

View Postzzo38, on Aug 7 2008, 02:31 PM, said:

No, that isn't what I mean. Of course, I found and improved a Forth interpreter written in Lua so hopefully it will work on MZX as well. This way, Forth codes can be programmed on MZX even if the people who programmed MZX don't like Forth. But PHP is much harder to include in MZX and isn't as good as Forth. PHP is also very slow compared with Perl, Lua, and Forth.

Sarcasm, zzo... you should really pay attention to it, since a lot of people [around here] use it. Frequently, even!
0

#8 User is offline   nooodl 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 735
  • Joined: 28-October 06
  • Gender:Not Telling
  • Location:Belgium

Posted 07 August 2008 - 08:56 PM

View Postmzxgiant, on Aug 7 2008, 08:33 PM, said:

Sarcasm, zzo... you should really pay attention to it, since a lot of people [around here] use it. Frequently, even!

Of course they don't.

Wait.

Well, okay, maybe Forth could be useful, but I don't really think adding _any_ other programming languages to MZX is a very good idea. I mean, isn't Robotic good enough? Do we need fancy stuff like Lua?
0

#9 User is offline   zzo38 

  • Registered members
  • PipPipPip
  • Group: Members
  • Posts: 445
  • Joined: 16-May 08
  • Gender:Not Telling

Posted 07 August 2008 - 11:51 PM

View Postnooodl, on Aug 7 2008, 12:56 PM, said:

Of course they don't.

Wait.

Well, okay, maybe Forth could be useful, but I don't really think adding _any_ other programming languages to MZX is a very good idea. I mean, isn't Robotic good enough? Do we need fancy stuff like Lua?

You don't really need Lua, but Robotic is very limited. Adding something else, such as Forth or Lua would improve it (some people wanted to put Lua in MZX for this reason, I think, but please keep Robotic as well!). But still a lot of things are missing if you just do that, there are other things that should be improved in MZX as well, such as the ability to edit the internal structures, edit the pieces on the board in raw mode, the ability to add new types of things (some of the "__unused" ones can be changed to "CustomThing1", "CustomThing2", etc), editing the flags[] array for the CustomThing1 etc (and enter global codes for when that object is updated, pushed, etc), and so on.

Anyways I think in Forth, the Robotic commands can all be made into Forth commands as well, for example, you could be able to make a loop as in Robotic, like doing like this:
0  VARIABLE  LOOP-START-MARK
:  (LOOP-START)  0  LOOPCOUNT  ! ;
:  LOOP-START  COMPILE  (LOOP-START)  HERE  LOOP-START-MARK  ! ;  IMMEDIATE
:  (LOOP-FOR)  SWAP  LOOPCOUNT  @  1+  DUP  LOOPCOUNT  !  <=  IF  R>  DROP  >R  ELSE  DROP  THEN ;
:  LOOP-FOR  LOOP-START-MARK  @  COMPILE-LIT-HERE  !  COMPILE  (LOOP-FOR) ;  IMMEDIATE

In Capitalist America, law violates YOU!

"Potion of Confusing": Solve all the puzzles, hold second one as you hold a pencil, and save gibbering mouthers from the king's army.
0

#10 User is offline   weasel 

  • bleh
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 7,915
  • Joined: 23-December 00
  • Gender:Male
  • Location:Hillsboro, Oregon

Posted 08 August 2008 - 12:10 AM

Uh, whoa, that's...a lot of code. If I understand this right, I'd imagine this is the robotic equivalent of what you just typed in:
: "loop"
inc "loopcount" 1
wait 1
goto "loop"

Why use many words when few will do? In other words, why use Forth if you have to type in so many commands to accomplish what Robotic can already do in just four very short lines?
Blaugh!
Serious damage to important body parts pretty much ruins any plans you had for living. Bummer.
0

#11 User is offline   zzo38 

  • Registered members
  • PipPipPip
  • Group: Members
  • Posts: 445
  • Joined: 16-May 08
  • Gender:Not Telling

Posted 08 August 2008 - 12:16 AM

View Postweasel, on Aug 7 2008, 04:10 PM, said:

Uh, whoa, that's...a lot of code. If I understand this right, I'd imagine this is the robotic equivalent of what you just typed in:
: "loop"
inc "loopcount" 1
wait 1
goto "loop"

Why use many words when few will do? In other words, why use Forth if you have to type in so many commands to accomplish what Robotic can already do in just four very short lines?

No, no, no, no, NO. That isn't what it is (in fact, many people that do not understand Forth might think of that wrong things). The codes I posted DEFINE the looping commands. There is no Robotic codes that can DEFINE the looping commands in Robotic.
LOOP START
DOUBLE "SOMETHINGVAR"
LOOP FOR 6

might be written in Forth, using the definitions above, as:
LOOP-START
SOMETHINGVAR @ 2 * SOMETHINGVAR !
6 LOOP-FOR

(You might thing the line that doubles "SOMETHINGVAR" is long. But Lua doesn't have a "somethingvar*=2" command either.)
Of course, if you don't like that long codes, you can define DOUBLE in Forth as well:
: DOUBLE DUP @ 2 * SWAP ! ;

This post has been edited by zzo38: 08 August 2008 - 12:22 AM

In Capitalist America, law violates YOU!

"Potion of Confusing": Solve all the puzzles, hold second one as you hold a pencil, and save gibbering mouthers from the king's army.
0

#12 User is offline   weasel 

  • bleh
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 7,915
  • Joined: 23-December 00
  • Gender:Male
  • Location:Hillsboro, Oregon

Posted 08 August 2008 - 12:21 AM

View Postzzo38, on Aug 7 2008, 04:16 PM, said:

There is no Robotic codes that can DEFINE the looping commands in Robotic.

Because you don't NEED to define the looping commands in Robotic. They're already there. I ask again, why use Forth at all if Robotic can already do this, in a far simpler fashion? What's in it for a simpleton such as myself? What makes Forth so great?
Blaugh!
Serious damage to important body parts pretty much ruins any plans you had for living. Bummer.
0

#13 User is offline   zzo38 

  • Registered members
  • PipPipPip
  • Group: Members
  • Posts: 445
  • Joined: 16-May 08
  • Gender:Not Telling

Posted 08 August 2008 - 12:25 AM

View Postweasel, on Aug 7 2008, 05:21 PM, said:

Because you don't NEED to define the looping commands in Robotic. They're already there. I ask again, why use Forth at all if Robotic can already do this, in a far simpler fashion? What's in it for a simpleton such as myself? What makes Forth so great?

If you do not like Forth, then you do not have to use it. But really Forth is really great, but not everyone has to use if you don't like it! If you like Robotic then use Robotic! If you like Lua then use Lua! If you like COBOL then use COBOL! But I like Forth because I think Forth is better (in my opinion).
In Capitalist America, law violates YOU!

"Potion of Confusing": Solve all the puzzles, hold second one as you hold a pencil, and save gibbering mouthers from the king's army.
0

#14 User is offline   weasel 

  • bleh
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 7,915
  • Joined: 23-December 00
  • Gender:Male
  • Location:Hillsboro, Oregon

Posted 08 August 2008 - 12:32 AM

You still have not answered my question. Why should anybody bother even implementing Forth? What's the point?
Blaugh!
Serious damage to important body parts pretty much ruins any plans you had for living. Bummer.
0

#15 User is offline   zzo38 

  • Registered members
  • PipPipPip
  • Group: Members
  • Posts: 445
  • Joined: 16-May 08
  • Gender:Not Telling

Posted 08 August 2008 - 02:42 AM

View Postweasel, on Aug 7 2008, 04:32 PM, said:

You still have not answered my question. Why should anybody bother even implementing Forth? What's the point?
I thought someone was wanting to implement Lua. If you do, then this implementation of Forth that I found and improved will work on it.
In Capitalist America, law violates YOU!

"Potion of Confusing": Solve all the puzzles, hold second one as you hold a pencil, and save gibbering mouthers from the king's army.
0

#16 User is offline   nooodl 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 735
  • Joined: 28-October 06
  • Gender:Not Telling
  • Location:Belgium

Posted 08 August 2008 - 09:32 AM

This thread is gold.

But really, Forth is the kind of programming code which you look at and think "Jeez, that is unreadable". I can't make out anything of that basic loop code you posted.

However, I'd like an addition in normal Robotic (like a special kind of second global robot) that defines a large amount of text to one command. Like this:

"writenumbers %1"
>loop start
>write overlay c0f "&loopcount&" at 2 "loopcount"
>loop for %1


And then when you put "writenumbers 20" in a robot, it executes the code above (and %1 is some kind of special changable variable).
0

#17 User is offline   ajs 

  • carpe diem
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,614
  • Joined: 21-October 00
  • Gender:Male
  • Location:United Kingdom

Posted 08 August 2008 - 12:03 PM

You're describing functions, which MZXLua supported.

--ajs.
0

#18 User is offline   Exophase 

  • Laughing on the inside.
  • Group: DigiStaff
  • Posts: 7,155
  • Joined: 23-October 00
  • Gender:Male
  • Location:Cleveland, OH

Posted 08 August 2008 - 01:34 PM

So was zzo, for that matter.
~ ex0 has a kickass battle engine, without it you sux0rz! without it you sux0rz! ~

"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay

Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
0

#19 User is offline   nooodl 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 735
  • Joined: 28-October 06
  • Gender:Not Telling
  • Location:Belgium

Posted 08 August 2008 - 02:53 PM

View Postajs, on Aug 8 2008, 02:03 PM, said:

You're describing functions, which MZXLua supported.

--ajs.

Yeah, that's the word I was looking for. But really, if they get implemented, they should be implemented Robotic-like, not Lua/Forth-like.
0

#20 User is offline   ZhayTee 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 08-August 08

Posted 08 August 2008 - 10:25 PM

What happened to the Lua-in-MZX initiative that was being undertaken with such fervor a few months ago? Shot down? Found to be unfeasible? I just checked this forum for the first time in a few months and I don't see the MZXLua thread anymore. ;_;

--JT
http://zhaymusic.com/
0

#21 User is offline   ajs 

  • carpe diem
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,614
  • Joined: 21-October 00
  • Gender:Male
  • Location:United Kingdom

Posted 08 August 2008 - 10:41 PM

Nightwatch is AWOL, but his code is still available and it kind of worked. It just wasn't yet at the stage I could merge it. Hopefully he'll get back to it when he has the time.

--ajs.
0

#22 User is offline   zzo38 

  • Registered members
  • PipPipPip
  • Group: Members
  • Posts: 445
  • Joined: 16-May 08
  • Gender:Not Telling

Posted 09 August 2008 - 06:06 PM

If Lua is implemented in MegaZeux then will you include a module that I can write for some low-level stuff? I can write a module in C, and then call it from Lua and from Forth.
In Capitalist America, law violates YOU!

"Potion of Confusing": Solve all the puzzles, hold second one as you hold a pencil, and save gibbering mouthers from the king's army.
0

#23 User is offline   weasel 

  • bleh
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 7,915
  • Joined: 23-December 00
  • Gender:Male
  • Location:Hillsboro, Oregon

Posted 09 August 2008 - 08:40 PM

View Postzzo38, on Aug 9 2008, 11:06 AM, said:

If Lua is implemented in MegaZeux then will you include a module that I can write for some low-level stuff? I can write a module in C, and then call it from Lua and from Forth.

I might be misunderstanding things again, as I am prone to do, but wouldn't something like that be extremely dangerous as far as the damage that could be done if a malicious coder decided to try something with it?
Blaugh!
Serious damage to important body parts pretty much ruins any plans you had for living. Bummer.
0

#24 User is offline   zzo38 

  • Registered members
  • PipPipPip
  • Group: Members
  • Posts: 445
  • Joined: 16-May 08
  • Gender:Not Telling

Posted 09 August 2008 - 10:35 PM

View Postweasel, on Aug 9 2008, 01:40 PM, said:

I might be misunderstanding things again, as I am prone to do, but wouldn't something like that be extremely dangerous as far as the damage that could be done if a malicious coder decided to try something with it?

No, I would code the module so it would be safe (and if someone still manages to break the game, restarting MegaZeux will reset those things). The low-level things I plan to write the module for aren't so low-level that you will permanently ruin everything if you use them. And malicious coders can already damage your file-system through the commands that MegaZeux already has. If you use Linux, you can make it more secure from file-system attacks using chroot, and creating a separate account for MegaZeux, and other things that can secure it more.
In Capitalist America, law violates YOU!

"Potion of Confusing": Solve all the puzzles, hold second one as you hold a pencil, and save gibbering mouthers from the king's army.
0

#25 User is offline   Exophase 

  • Laughing on the inside.
  • Group: DigiStaff
  • Posts: 7,155
  • Joined: 23-October 00
  • Gender:Male
  • Location:Cleveland, OH

Posted 09 August 2008 - 11:12 PM

View Postzzo38, on Aug 9 2008, 05:35 PM, said:

And malicious coders can already damage your file-system through the commands that MegaZeux already has.


No they can't, unless you're dumb enough to run MZX from a directory that has other things in it, and even then it'd be nothing more than a total guessing game, so you'd have to be dumb enough to run MZX in your root directory to really let anyone damage anything.
~ ex0 has a kickass battle engine, without it you sux0rz! without it you sux0rz! ~

"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay

Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
0

#26 User is offline   zzo38 

  • Registered members
  • PipPipPip
  • Group: Members
  • Posts: 445
  • Joined: 16-May 08
  • Gender:Not Telling

Posted 09 August 2008 - 11:13 PM

View PostExophase, on Aug 9 2008, 03:12 PM, said:

No they can't, unless you're dumb enough to run MZX from a directory that has other things in them.
So the security is good already. Still, the low-level stuff I was refering to is nothing that will damage your computer, it is not that much low-level!
In Capitalist America, law violates YOU!

"Potion of Confusing": Solve all the puzzles, hold second one as you hold a pencil, and save gibbering mouthers from the king's army.
0

#27 User is offline   Exophase 

  • Laughing on the inside.
  • Group: DigiStaff
  • Posts: 7,155
  • Joined: 23-October 00
  • Gender:Male
  • Location:Cleveland, OH

Posted 10 August 2008 - 12:14 AM

I don't think that MZX will ever support calling external modules because such a feature would be inherently unportable. This goes against a major design principle of current MZX.
~ ex0 has a kickass battle engine, without it you sux0rz! without it you sux0rz! ~

"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay

Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
0

#28 User is offline   zzo38 

  • Registered members
  • PipPipPip
  • Group: Members
  • Posts: 445
  • Joined: 16-May 08
  • Gender:Not Telling

Posted 10 August 2008 - 12:20 AM

View PostExophase, on Aug 9 2008, 05:14 PM, said:

I don't think that MZX will ever support calling external modules because such a feature would be inherently unportable. This goes against a major design principle of current MZX.
I wasn't saying I would make it a external module! I meant I would write a module in C and then you would have to compile it in
In Capitalist America, law violates YOU!

"Potion of Confusing": Solve all the puzzles, hold second one as you hold a pencil, and save gibbering mouthers from the king's army.
0

#29 User is offline   Exophase 

  • Laughing on the inside.
  • Group: DigiStaff
  • Posts: 7,155
  • Joined: 23-October 00
  • Gender:Male
  • Location:Cleveland, OH

Posted 10 August 2008 - 12:22 AM

View Postzzo38, on Aug 9 2008, 07:20 PM, said:

I wasn't saying I would make it a external module! I meant I would write a module in C and then you would have to compile it in


You're not making any sense. You want to call a module from Lua or Forth interpreters in MZX, written in C, but you want the users to have to compile it for the architecture they're on? What?
~ ex0 has a kickass battle engine, without it you sux0rz! without it you sux0rz! ~

"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay

Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
0

#30 User is offline   zzo38 

  • Registered members
  • PipPipPip
  • Group: Members
  • Posts: 445
  • Joined: 16-May 08
  • Gender:Not Telling

Posted 10 August 2008 - 12:24 AM

View PostExophase, on Aug 9 2008, 05:22 PM, said:

You're not making any sense. You want to call a module from Lua or Forth interpreters in MZX, written in C, but you want the users to have to compile it for the architecture they're on? What?

No, I mean that any developers of MZX could look and see if my module is good, and then compile it in so that it will already be compiled when someone download MZX it will already be in.
In Capitalist America, law violates YOU!

"Potion of Confusing": Solve all the puzzles, hold second one as you hold a pencil, and save gibbering mouthers from the king's army.
0

Share this topic:


  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users