Author Topic: PS2 Yabasic reimplemented in JavaScript  (Read 35276 times)

0 Members and 1 Guest are viewing this topic.

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: PS2 Yabasic reimplemented in JavaScript
« Reply #20 on: June 09, 2015 »
Great stuff!  Bringing it to Apple and tablet users everywhere :)

Jim
Challenge Trophies Won:

Offline MrD

  • C= 64
  • **
  • Posts: 31
  • Karma: 8
    • View Profile
Re: PS2 Yabasic reimplemented in JavaScript
« Reply #21 on: June 09, 2015 »
Glad you like it, Jim. :)

If somebody has an Apple/Android tablet with a bluetooth keyboard, could you please give it a go? I'm curious if the browser still gets keystrokes even if the input box isn't selected. I've been told that for tablet browsers, the text area has to be focused for the page to receive keystrokes even when you're using a physical keyboard (which sounds daft to me).

Offline MrD

  • C= 64
  • **
  • Posts: 31
  • Karma: 8
    • View Profile
Re: PS2 Yabasic reimplemented in JavaScript
« Reply #22 on: June 09, 2015 »
Latest modifications:

I've made the string literal recognition more lenient to allow accented characters through. This is part of my attempt to get YA-GOLF below working. I foolishly assumed that the JavaScript \w word character symbol in a regex would catch accented characters. Big load of nope.

As a consequence, you should now be able to write Japanese characters directly into a Yabasic program, if that floats your boat. Bear in mind that Unicode JS is SERIOUSLY FLAWEDhere, but it's the last big thing I've got to get working, so I'm putting here as a reminder to myself.

It compiles, runs and gets to the language select! :D

It goes haywire if you press F1/F2. (Actually these are the default mappings for L3 and R3 in Jim Shaw's PS2Yabasic, so the game is very emulator-targeted... (It even starts with a warning screen telling you how to configure the emulator correctly.) I was going a bit crazy looking for an INKEY that wasn't there for a while.)
« Last Edit: June 09, 2015 by MrD »

Offline Yaloopy

  • Death From Above
  • DBF Aficionado
  • ******
  • Posts: 2876
  • Karma: 35
    • View Profile
    • UltraPaste
Re: PS2 Yabasic reimplemented in JavaScript
« Reply #23 on: June 17, 2015 »
You gotta change a var from 0 to 1 near the top to make the F1 game playable. It looks great!
Fuck L. Ron Hubbard and fuck all his clones.
Challenge Trophies Won:

Offline moon

  • ZX 81
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
Re: PS2 Yabasic reimplemented in JavaScript
« Reply #24 on: July 16, 2015 »
Did anyone ever find a method to ( easily ) transfer Yabasic projects from the PS2 to PC ( and vice versa )?

Offline slinks

  • A little bit strange
  • DBF Aficionado
  • ******
  • Posts: 3961
  • Karma: 43
    • View Profile
Re: PS2 Yabasic reimplemented in JavaScript
« Reply #25 on: July 20, 2015 »
There was a cheat disk you could buy (Action Replay 2) which came with a usb transfer cable and disk so you could transfer saves/new cheats back and forth between console and pc. I discovered this a few years after spending a summer typing in code by hand, naturally :P
I love semi-colons way too much ^^;
Challenge Trophies Won:

Offline SERGIO_ManOwaR_

  • C= 64
  • **
  • Posts: 48
  • Karma: 9
    • View Profile
Re: PS2 Yabasic reimplemented in JavaScript
« Reply #26 on: November 24, 2015 »
Great! I'm glad to see people still interested in yabasic.
You have done a really good work!
I've read you want to make yabasic games get working, including my game' ya-golf'... hope you can do it!
I tried several of my demos and games and unfortunatelly, most of them don't work, specially the
newest ones, when i'm using some DATA lines containing bitmaps and personalized fonts compressed
using characters from the original Ps2 YABASIC ASCII CHARACTERS TABLE that are MISSING.
I guess is a tough work to do but hang on it!
If i can help you anyway don'd doubt write me.
I'll be around posting more yabasic games and demos and trying to make it run in your page.
Maybe source code games should have an option to use EMU controls or WEB controls
since may be a port/keyboard input strings conflict.
So excited, anybody could play a yabasic game from the web.
GRET WORK, keep on goin'!

Offline Galileo

  • ZX 81
  • *
  • Posts: 22
  • Karma: 0
    • View Profile
Re: PS2 Yabasic reimplemented in JavaScript
« Reply #27 on: January 03, 2016 »
Great job!  :clap:  :clap:  :clap:
If, in addition, you could add 2.763 Yabasic features and other capabilities (sound, image file manipulation ...) Yabasic could continue to evolve to a more complete and fun BASIC dialect.

Offline MrD

  • C= 64
  • **
  • Posts: 31
  • Karma: 8
    • View Profile
Re: PS2 Yabasic reimplemented in JavaScript
« Reply #28 on: January 04, 2016 »
Hi Sergio, Galileo, glad you like it!

Sergio: I'm afraid I don't know why your code isn't working in my system. It's hard for me to fix the problem as your golf game is quite a big program :) If you can make a small example program (just 150 lines maybe) that my code doesn't run correctly, then I can fix the problems one by one.

Offline SERGIO_ManOwaR_

  • C= 64
  • **
  • Posts: 48
  • Karma: 9
    • View Profile
Re: PS2 Yabasic reimplemented in JavaScript
« Reply #29 on: January 04, 2016 »
Hi mrD! I've been looking at your source, it's a great job you've done! My game yagolf is certanly a big (and very crappy) source code. In fact, i think the best i can do is re-write all from the beginning. There are lots of errors not only in this game but also in most of my demos. Most of them because of my crappy code im afraid. I guess i could start coding short demos for your emu especifically (inkey$ conflicts with peek("port1") ) and see what happens. Anyway, thanks for your big job! See you around!

Offline MrD

  • C= 64
  • **
  • Posts: 31
  • Karma: 8
    • View Profile
Re: PS2 Yabasic reimplemented in JavaScript
« Reply #30 on: January 04, 2016 »
I think Jim's yabasic version is based some of the same source code as the PS2 version. If your code does different things on Windows and on the browser, I think my code is wrong.

I used all of the old Yabasic programs to test my code - if one of the demos didn't run, something was definitely wrong with my code and I could fix it. My Javascript version is far from perfect! So don't be discouraged! :) That's why I need more test programs.

You're right about inkey$ and peek("port1") not being nice together... I would need to write a game pad layer to have it working accurately. (HTML5 can do this!)

Have fun programming :D

Offline SERGIO_ManOwaR_

  • C= 64
  • **
  • Posts: 48
  • Karma: 9
    • View Profile
Re: PS2 Yabasic reimplemented in JavaScript
« Reply #31 on: January 08, 2016 »

Offline MrD

  • C= 64
  • **
  • Posts: 31
  • Karma: 8
    • View Profile
Re: PS2 Yabasic reimplemented in JavaScript
« Reply #32 on: January 11, 2016 »
Quote
1) You can write a condition 'IF' without ENDIF. This is legal and if condition matches,the rest of  the line is executed, but you can leave it blank or just add some remark.
This is perfectly legal in ps2 and jim's emu:

   IF condition=matches:REM ! TO DO SOME STUFF...LATER!

 In the js it's an error. Usually nobody writes a condition and leaves it blank... but in a
   crappy code of 10000 lines it may happen... of course, just deleting that line or comment it
will solve problem.
I'll have to check that out!

In my code, IF tries to attach itself to the next command that comes after it. It's not an error to have 'IF condition' by itself on a line.

Code: [Select]
print "type in a value"
input x
if x > 3
    print "big x"
print "end of program"
end

But it looks like in your example yabasic should treat REM as a command even though it doesn't do anything.

My compiler removes all REMs from the source in the first pass.

I've never heard of LINE INPUT before. Yikes!

Offline MrD

  • C= 64
  • **
  • Posts: 31
  • Karma: 8
    • View Profile
Re: PS2 Yabasic reimplemented in JavaScript
« Reply #33 on: January 11, 2016 »
Well now I'm just plain confused.

I put in the IF behaviour I just described because I was sure that certain programs needed it, but looking at two other implementation of Yabasic neither of them consider the 'big x' line to be contained within the IF.

Which basically means I need to go back and rethink how I parse conditionals entirely.

How on earth did that happen?

Offline MrD

  • C= 64
  • **
  • Posts: 31
  • Karma: 8
    • View Profile
Re: PS2 Yabasic reimplemented in JavaScript
« Reply #34 on: January 11, 2016 »
SO

The sticky IF never progresses beyond the current line!

"big x" is always printed! An IF on a line by itself conditionally executes the nothing that succeeds it!

And none of the demos I currently have rely on this behaviour!

Weird as hell.

Gotta fix that for sure.

Offline MrD

  • C= 64
  • **
  • Posts: 31
  • Karma: 8
    • View Profile
Re: PS2 Yabasic reimplemented in JavaScript
« Reply #35 on: January 12, 2016 »
I've fixed the strange IF behaviour, and decided against getting the undocumented token$() working. I put in a replacement, so now we can play two new /games/! tonironkko/freecell.txt and tonironkko/potris.txt are now working!

TOKEN$(string_variable, separator)
returns contents of string_variable up to separator or end of string if it isn't present
sets string_variable to what is left after what was returned with the trailing separator replaced

It's one of the few functions that deals in references to variables so I don't bother. Don't use token$()!
« Last Edit: January 12, 2016 by MrD »

Offline MrD

  • C= 64
  • **
  • Posts: 31
  • Karma: 8
    • View Profile
Re: PS2 Yabasic reimplemented in JavaScript
« Reply #36 on: January 12, 2016 »
 ;D

Offline tronkko

  • ZX 81
  • *
  • Posts: 13
  • Karma: 23
    • View Profile
    • Softagalleria.net
Re: PS2 Yabasic reimplemented in JavaScript
« Reply #37 on: January 24, 2016 »
Did anyone ever find a method to ( easily ) transfer Yabasic projects from the PS2 to PC ( and vice versa )?

You can read Yabasic files from PS2 memory card with PS2 Linux Kit.  The file has a checksum which needs to be removed in a text editor to make the code is usable in an emulator.  You can write files back to PS2 memory card with yabwrite http://softagalleria.net/yabwrite.php

The process is fairly easy but getting PS2 Linux kit may be a challenge.  Mine broke down years ago.  Might have the dvd lying around somewhere...

Offline SERGIO_ManOwaR_

  • C= 64
  • **
  • Posts: 48
  • Karma: 9
    • View Profile
Re: PS2 Yabasic reimplemented in JavaScript
« Reply #38 on: January 27, 2016 »

Offline MrD

  • C= 64
  • **
  • Posts: 31
  • Karma: 8
    • View Profile
Re: PS2 Yabasic reimplemented in JavaScript
« Reply #39 on: February 01, 2016 »
I see! Thank you Sergio! That explains a lot. :)

Yes, because I'm just using ordinary Javascript strings, everything is encoded using unicode values, so if you type in a non a-z, A-Z character, the ASC values will be completely different! I think I'll have to re-make strings completely so that they use the exact same values as proper Yabasic. (This means you won't be able to use characters outside of Yabasic's set though.)

And the formatting stuff is familiar to me from other languages. :) I didn't know yabasic could do that!