|
Post by vetea on Nov 20, 2015 1:23:41 GMT -5
Wow !! This is awesome ! Come on Adam, keep up the good work.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Nov 22, 2015 21:32:26 GMT -5
Arrays are now supported/functional Here's a video using some more commands than the previous video: youtu.be/R1PvJxevEKUThe code from the video: DIM b(1,2,3,4) AS INTEGER b(1,2,0,0) = 50 b(1,2,0,0) = b(1,2,0,0) + 1 LOADTILES MyTiles,295,100 PALETTES sdpal,0,0,16,224 RELOAD logoscreen FOR y = 0 TO 27 FOR x = 0 TO 39 READINT z DRAWTILE 99+z,x,y NEXT NEXT IF b(1,2,0,0) = 51 THEN pal& = LBLPTR&(sdpal) FOR i = 7 TO 0 STEP -1 PALETTES pal&,0,0,16,i<<5 SLEEP 3 NEXT
sdpal: DATAINT $0EEE,$00EE,$0E0E,$000E,$0EE0,$0000,$004E,$006E DATAINT $008E,$00AE,$00CE,$0E40,$0E60,$0E80,$0EA0,$0EC0 DATAINT $0CCC,$00CC,$0C0C,$000C,$0CC0,$0000,$002C,$004C DATAINT $006C,$008C,$00AC,$0C20,$0C40,$0C60,$0C80,$0CA0 DATAINT $0AAA,$00AA,$0A0A,$000A,$0AA0,$0000,$000A,$002A DATAINT $004A,$006A,$008A,$0A00,$0A20,$0A40,$0A60,$0A80 DATAINT $0888,$0088,$0808,$0008,$0880,$0000,$0008,$0008 DATAINT $0028,$0048,$0068,$0800,$0800,$0820,$0840,$0860 DATAINT $0666,$0066,$0606,$0006,$0660,$0000,$0006,$0006 DATAINT $0006,$0026,$0046,$0600,$0600,$0600,$0620,$0640 DATAINT $0444,$0044,$0404,$0004,$0440,$0000,$0004,$0004 DATAINT $0004,$0004,$0024,$0400,$0400,$0400,$0400,$0420 DATAINT $0222,$0022,$0202,$0002,$0220,$0000,$0002,$0002 DATAINT $0002,$0002,$0002,$0200,$0200,$0200,$0200,$0200 DATAINT $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000 DATAINT $0000,$0000,$0000,$0000,$0000,$0000,$0000,$0000
logoscreen: $INCLUDE "c:\dev\sd_map.sbs", @SBS
MyTiles: DATAFILE c:\dev\sd_logo.bnx, BIN
Cheers!
|
|
|
Post by nathan999 on Nov 24, 2015 6:53:24 GMT -5
Great news.
IMHO, support for negative numbers and proper expression handling are a MUST in a BASIC-like language. The former is easily achieved using two's complement math, the latter is just a mandatory feature in a proper programming language.
You know, BEX can't calculate a = 2 + 3 * 2 properly as it doesn't implement operator precedence at all.
I mean, I personally would create the basic frame of a proper BASIC compiler first, then work on the commands :-) Proper implementation of data types (Integer, uInteger, Long, uLong, Byte, uByte...), proper String support, the ability to include another source file (specially for long projects), some way to get the actual address of a variable/array/constant array, proper expression handling, real bitwise operations, binary math, logical expresions (which are REALLY broken in BEX)...
If you just want to replicate BEX, that's right, of course. But BEX is not a good compiler at all, and I've used quite a few for quite a long time. I'd put my effort, if I were to write a BASIC compiler for the Genesis, on doing it right.
|
|
|
Post by nathan999 on Nov 24, 2015 6:55:27 GMT -5
And by the way, are you planning on having the compiler as an stand-alone executable so you can choose not to use the IDE?
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Nov 24, 2015 7:31:40 GMT -5
You know, BEX can't calculate a = 2 + 3 * 2 properly as it doesn't implement operator precedence at all. You can .. use either "a = 2 + (3 * 2)" or "a = 3 * 2 + 2". some way to get the actual address of a variable/array/constant array Use the VarPtr&() function. dim foo(7) as integer print varptr&(foo) Ehm .. what's not "real" about them? print 3 AND 6 ' Prints 2 print 3 OR 6 ' Prints 7 print 3 XOR 6 ' Prints 5 logical expresions (which are REALLY broken in BEX) They work just fine for me ..
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Nov 24, 2015 8:42:12 GMT -5
There's very few things "broken" in BEX (Titan points that out with his post above), though some of the things you mention will eventually be implemented (such as order of operations).
The reason for not fixing them immediately is because I want full compatibility right out of the box for BEX projects.
As for not being locked into the IDE, the compiler will have command line arguments (mentioned a few posts back) so you can compile a source file without using the IDE.
Logical expressions work just fine, as does bit wise functions in both BEX and Second Basic.
|
|
|
Post by lunchbox on Nov 26, 2015 12:48:10 GMT -5
And by the way, are you planning on having the compiler as an stand-alone executable so you can choose not to use the IDE? This would be super nice... maybe command line? call it from a .bat file compiler.exe program.bex have it output a .bin file and then just call your emulator of choice via the batch file referencing the compiled binary to test... would make compilng and testing super easy double click function.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Nov 26, 2015 22:58:39 GMT -5
Happy Thanksgiving to those who celebrate it Here's a holiday update: - DO...LOOP has been added - WHILE...WEND has been added - EXIT DO/LOOP, WHILE, and FOR has been added - CONTINUE WHILE, DO/LOOP, and FOR has been added - JOYPAD() has been added A few things to note about the LOOP part: BEX Supports LOOP WHILE (condition), so that's been added in as well. I also added in LOOP UNTIL, which is something BEX didn't have I'm hoping to get sprite support in there next, and then maybe an alpha release. Cheers!
|
|
|
Post by landeel on Nov 28, 2015 6:10:08 GMT -5
One more suggestion. You should add text based #DEFINEs. It's easy to implement, makes programmers' life easier and code much more readable.
For example:
#DEFINE up 0 joy=JOYPAD() IF joy.up THEN ...
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Nov 28, 2015 6:58:40 GMT -5
You should add text based #DEFINEs. BasiEgaXorz already supports that .. although you can't use them with argunerics. But you could do something like this .. .. which is actually slightly faster than using argunerics
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Nov 28, 2015 8:31:13 GMT -5
Titan is right with BEX, but I did add support in Second Basic to reference a bit with a variable, so this does work in Second Basic (should also work in BEX, btw): h = 7 j = 8 Print j.h
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Nov 28, 2015 8:34:54 GMT -5
I'll be releasing a public alpha build at some point today! I was able to get quite a bit added in (movesprite, addsprite, propsprite, setgfxplane, setscrollplane, setscrollmode, and scroll), so Second Basic is fully capable of making games and applications, but it's still missing a lot of commands and functions.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Nov 29, 2015 22:39:04 GMT -5
Sorry for the delay. I had to fix a few bugs I found when making the examples, and some of them were rather tricky Everything in the examples compiles, so there shouldn't be many issues with the currently supported commands and functions. If there are any bugs (ie, won't compile but the IDE doesn't catch the error), let me know (and the code you were using). A lot of the config options aren't usable yet, so aside from launching an emulator and changing colors, don't expect the rest to work (well, most of them, anyway ) The download link: www.second-dimension.com/secondbasic.zipCheers!
|
|
|
Post by landeel on Nov 30, 2015 6:41:20 GMT -5
Great job! Works fine here using Ubuntu Linux + wine.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Nov 30, 2015 8:03:48 GMT -5
Good to know I should note that if you install it on vista or newer, I would recommend not installing it to the program files folder, but elsewhere as the UAC likes to act up when writing to those folders. I added a few more commands last night (psg, psgvol, and drawtiles). I'll probably do weekly updates until all the commands and functions are implemented (and fix any bugs along the way).
|
|