PDA

View Full Version : BASIC interpreter



BlackAura
September 22nd, 2004, 00:37
I've just ditched the work I previously did on getting this to work. It was originally based on wxBasic v1, which was a bloody mess. I've re-ported wxBasic v2, using a newer version of KOS this time, and it's much less messy. It's still not very nice to work with - everything is #included from one source file and it has global variables everywhere - but it's an improvement.

Since I don't have any way to get a working debug console at the moment, could someone test this binary for me?

http://files.frashii.com/~sp00nz/Doom/files/BlackAura/wxcore.elf.gz

It should output something like this:
Hi!
wxBasic test program by Stuart Dalton
Today is 09:22:2004
The time is 15:29:39

Let's do some math, shall we?
66 + 23 = 89
66 * 2 = 132
chr(66) = B
len(a_string) = 11
mid(a_string, 1, 5) = Hello
right(a_string, 5) = World
pi = 3.14159
floor(3.14159) = 3

Testing factorial function
x x!
1 1
2 2
3 6
4 24
5 120
6 720
7 5040
8 40320
9 362880
10 3628800

Sinage Function
xsin(x)cos(x)tan(x)
0010
0.6283190.5877850.8090170.726543
1.256640.9510570.3090173.07768
1.884960.951056-0.309017-3.07768
2.513270.587785-0.809017-0.726542
3.14159-8.74228e-08-18.74228e-08
3.76991-0.587785-0.8090170.726543
4.39823-0.951056-0.3090173.07768
5.02655-0.9510560.309017-3.07768
5.65487-0.5877850.809017-0.726542

Arrays and random numbers:
4 5 3 4 6 6 1 1 2 4 3 12 4 8 2 7

Phantom
September 22nd, 2004, 13:15
KallistiOS ##version##: Wed Sep 1 00:09:38 EST 2004
blackaura@shadow:/home/blackaura/dreamcast/kos-1.3.161/kos
thd: pre-emption enabled, HZ=100
maple: active drivers:
PuruPuru (Vibration) Pack: JumpPack
VMU Driver: Clock, LCD, MemoryCard
Mouse Driver: Mouse
Keyboard Driver: Keyboard
Controller Driver: Controller
DMA Buffer at ac08b440
vid_set_mode: 640x480IL NTSC
dc-load console support enabled
maple: attached devices:
A0: Dreamcast Controller (01000000: Controller)
B0: Keyboard (40000000: Keyboard)
Hi!
[Syntax error]
Unable to open "test.bas" or "/rd/test.bas"

Syntax error: Unable to open "test.bas" or "/rd/test.bas"
arch: shutting down kernel
maple: final stats -- device count = 2, vbl_cntr = 5, dma_cntr = 5
vid_set_mode: 640x480IL NTSC
Missing romdisk?

Kamjin
September 22nd, 2004, 21:01
Had the same result.. suggestion just make it look for it on the root of the cdrom, that way we can easily toss other code at it.

BlackAura
September 23rd, 2004, 01:46
Actually, the romdisk is there. It just doesn't seem to be working. I had similar problems with the wxBasic v1 source, or it could just be something wrong with (toolchain/KOS/Makefile/insert excuse here)

It should now be looking for test.bas in /cd

There's a Windows and a Linux binary in there too. It's just the interpreter, so it'll just text out to stdout. Tries to load test.bas in the current directory, and they both seem to work.

http://files.frashii.com/~sp00nz/Doom/files/BlackAura/wxcore_test.tar.bz2

(Still uploading, so give it a minute or two)

Kamjin
September 23rd, 2004, 21:33
??? Never seen this before.. DCLOAD just stays at the (Executing) screen.. gonna try a few more things first, and re-edit this later..

Vorrtexx
September 24th, 2004, 15:11
Here's my debug output if you want to analyze it:



KallistiOS ##version##: Wed Sep 1 00:09:38 EST 2004
blackaura@shadow:/home/blackaura/dreamcast/kos-1.3.161/kos
thd: pre-emption enabled, HZ=100
maple: active drivers:
PuruPuru (Vibration) Pack: JumpPack
VMU Driver: Clock, LCD, MemoryCard
Mouse Driver: Mouse
Keyboard Driver: Keyboard
Controller Driver: Controller
DMA Buffer at ac08ac40
vid_set_mode: 640x480IL NTSC
dc-load console support enabled
maple: attached devices:
A0: Dreamcast Mouse (00020000: Mouse)
B0: Dreamcast Controller (01000000: Controller)
Hi!
fs_iso9660: disc change detected
wxBasic test program by Stuart Dalton
Today is 12:10:1998
The time is 07:49:19

Let's do some math, shall we?
66 + 23 = 89
66 * 2 = 132
chr(66) = B
len(a_string) = 11
mid(a_string, 1, 5) = Hello
right(a_string, 5) = World
pi = 3.14159
floor(3.14159) = 3

Testing factorial function
x x!
1 1
2 2
3 6
4 24
5 120
6 720
7 5040
8 40320
9 362880
10 3628800

Sinage Function
xsin(x)cos(x)tan(x)
0010
0.6283190.5877850.8090170.726543
1.256640.9510570.3090173.07768
1.884960.951056-0.309017-3.07768
2.513270.587785-0.809017-0.726542
3.14159-8.74228e-08-18.74228e-08
3.76991-0.587785-0.8090170.726543
4.39823-0.951056-0.3090173.07768
5.02655-0.9510560.309017-3.07768
5.65487-0.5877850.809017-0.726542

Arrays and random numbers:
4 4 1 2 4 9 2 1 11 10 7 16 8 12 12 14
arch: shutting down kernel
maple: final stats -- device count = 1, vbl_cntr = 27, dma_cntr = 27
vid_set_mode: 640x480IL NTSC

quzar
September 24th, 2004, 16:16
Actually, the romdisk is there. It just doesn't seem to be working. I had similar problems with the wxBasic v1 source, or it could just be something wrong with (toolchain/KOS/Makefile/insert excuse here)

Ive had similar problems, where a program just wont work with romdisk (neopop) i remember i made a thread about it on DCemulation, and tried 5 different methods of file access before just switching to CD, changed the makefile, and eventually completely re-ported it, and it still didnt work. kos weirdness i think =P

BlackAura
September 24th, 2004, 20:27
Ah good. That means it works. And it works a lot better than the other version used to, probably because I'm using newlib now instead of the KOS libc.

BlackAura
September 26th, 2004, 03:29
Still haven't done any testing on the Dreamcast yet, but I have graphics working in the PC / SDL version.

The simplest part of the graphics system is now more-or-less done. You can load images, draw them on the screen, and draw simple (and even complex) shapes using an OpenGL-like command set. It automatically does depth sorting and all that stuff, so you can draw transparencies and the like without worrying about sorting it first, just like you don't on a Dreamcast.

Now all it needs is a Dreamcast implementation. And something resembling a manual...

I'll see if I can post something a bit later on.

wraggster
September 29th, 2004, 11:22
very nice :)