Jump to content
IGNORED

RAPTOR Basic+ updates


ggn

Recommended Posts

So, lately we've been getting some feedback - nice! I'm really glad to see people slowly starting to do some fun stuff :).

 

Which means of course that bugs were identified and fixed and requests for new functionality have been implemented. And of course people might be wondering where to get this updated version.

 

Well, as I find it a bit tedious to package stuff up tag them and release them, for the time being I decided to have latest versions on Github/Bitbucket. Sounds scary? It's not that big deal really! For the github repo just find the button at the right of the page saying "download zip" and click it - you just got the latest version! For bitbucket it's even easier, just go here and click "Download repository" - sorted!

 

Both github and bitbucket have my meaningful commit messages (usually ;)), but I'll summarise the changes so far (current commit hash: 9178e52e8ce4874198e5ec2526f571d54dfc516f):

  • Debugged PLOT command and changed it into a function (i.e. plot(x,y) instead of plot x,y)
  • Debugged COLOUR command
  • build.bat is now more robust and tries to be more helpful (i.e. deletes old build files and aborts compilation so you won't end up running an older build because the current failed!)
  • New command: CLS will clear the particle/text layer.
  • round() function fixed (for some reason it was relying on way too many dependencies that weren't included)
  • Each project now has its own ASSETS folder where its data files reside (so no more shared assets between projects)
  • Raptor equates: Instead of having to hunt for cryptic numbers where you want to access an object's attribute (for example x/y positions) it's now possible to use built-in equates, which exist in file "include\raptor.h". This is especially handy in projects bigger than 20 lines when maintainability becomes a concern :)
And that's it for now. I'll keep updating this thread as more work is done. Happy hacking!

 

P.S. if you want to report a bug or request a feature please make sure you have the latest version and if possible mention the commit hash (you can see the hashes here).

  • Like 8
Link to comment
Share on other sites

Well, people ask - I oblige!

 

Like any self respecting basic we now have poke/peek! In 3 forms too: byte (poke/peek), word (dpoke/dpeek), longword(lpoke/lpeek). Notice that no memory protection is happening so you can poke the whole address space! For example, nyandodge now has its background colour changed depending on the sprite's y position :)

  • Like 5
Link to comment
Share on other sites

Continuing from this thread (since it was locked for some reason)...

 

As a reminder, get latest version from Github or Bitbucket.

 

The only thing changed was build.bat so it can now be used under Linux - just install "wine" on your linux box, open up a console, go to the location of build.bat and type "wineconsole BUILD.bat projectname". If all goes well then a file called rbasic.abs will be created and you can then test it on virtualjaguar or upload it to a real machine.

 

It should probably run under macs as well - if anyone can give it a spin and report if it works? It'll be appreciated!

  • Like 3
Link to comment
Share on other sites

Tested it under Ubuntu 14.10 64-bit. It works as expected for project print. I've had some basic errors on other projects. Anyway, many thanks ggn!

 

Care t o share the errors or were they trivial to fix?

 

In any case, happy hacking!

Link to comment
Share on other sites

Sure, project firework:

Current Tokens
==============
  1 NEXT
  2 Y2
is a GLOBAL defined at line 6 in Module: PROJECTS\firework\firework.bas
 Y2 as int
===============
Original Tokens
===============
  1 U235SD
  2 (
  3 (
  4 0
  5 ,
  6 4
  7 )


m68k-atari-mint-gcc: error: build\firework.C: No such file or directory
m68k-atari-mint-gcc: fatal error: no input files
compilation terminated.
Cannot find input module build\firework.o
Build error!

TBH I didn't try to fix the errors, I am in frenzy work mode atm.

Edited by Christos
Link to comment
Share on other sites

From a discussion here:

  • BUILD.bat fixed for Windows.
  • U235PAD renamed to GETPAD.
  • U235MOD renamed to MODPLAY.
  • U235SND renamed to SNDPLAY.
  • Added MODVOL, SNDVOL.
  • Cleaned up basic_functions.c a bit.
  • Modified nyandodge.bas, TILEMAP.BAS, FIREWORK.BAS to use renamed functions.
  • nyandodge now has volume controls (When sprite goes up then the module volume goes up and the sfx volume go down. When the sprite goes down, the opposite).
  • Added usage text to BUILD.bat when ran without parameter.
  • Like 5
Link to comment
Share on other sites

We now have constants for joypad! Instead of trying to remember all these numbers you can now use the following constants to access them!

 

PAD_UP = 1 , // Up
PAD_U = 1 ,
PAD_DOWN = 2 , // Down
PAD_D = 2 ,
PAD_LEFT = 4 , // Left
PAD_L = 4 ,
PAD_RIGHT = 8 , // Right
PAD_R = 8 ,
PAD_HASH = 16 , // Hash (#)
PAD_9 = 32 , // 9
PAD_6 = 64 , // 6
PAD_3 = 0x80 , // 3
PAD_PAUSE = 0x100 , // Pause
PAD_A = 0x200 , // A button
PAD_OPTION = 0x400 , // Option
PAD_STAR = 0x800 , // Star
PAD_7 = 0x1000 , // 7
PAD_4 = 0x2000 , // 4
PAD_1 = 0x4000 , // 1
PAD_0 = 0x8000 , // 0 (zero)
PAD_8 = 0x10000 , // 8
PAD_5 = 0x20000 , // 5
PAD_2 = 0x40000 , // 2
PAD_B = 0x80000 , // B button
PAD_C = 0x100000 // C button

  • Like 2
Link to comment
Share on other sites

PAD_UP D-Pad Up
PAD_U Up
PAD_DOWN Down
PAD_D Down

PAD_LEFT Left
PAD_L Left
PAD_RIGHT = 8 , // Right
PAD_R = 8 ,
PAD_HASH = 16 , // Hash (#)
PAD_9 = 32 , // 9
PAD_6 = 64 , // 6
PAD_3 = 0x80 , // 3
PAD_PAUSE = 0x100 , // Pause
PAD_A = 0x200 , // A button
PAD_OPTION = 0x400 , // Option
PAD_STAR = 0x800 , // Star
PAD_7 = 0x1000 , // 7
PAD_4 = 0x2000 , // 4
PAD_1 = 0x4000 , // 1
PAD_0 = 0x8000 , // 0 (zero)
PAD_8 = 0x10000 , // 8
PAD_5 = 0x20000 , // 5
PAD_2 = 0x40000 , // 2
PAD_B = 0x80000 , // B button
PAD_C = 0x100000 // C button

Used them in my not-quite-a-game-yet, so much easier than remembering numbers

Link to comment
Share on other sites

PAD_UP D-pad Up

PAD_U Up

PAD_DOWN Down

PAD_D Down

PAD_LEFT Left

PAD_L Left

PAD_RIGHT Right

PAD_R Right

PAD_1 1

PAD_2 2

PAD_3 3

PAD_4 4

PAD_5 5

PAD_6 6

PAD_7 7

PAD_8 8

PAD_9 9

PAD_A A button

PAD_B B button

PAD_C C button

PAD_PAUSE Pause

PAD_OPTION Option

PAD_STAR *

PAD_HASH #


Used them in my not-quite-a-game-yet, so much easier than remembering numbers, thanks!

Link to comment
Share on other sites

  • 2 weeks later...

Ok, new stuff: RPRINTINT is like RPRINT but it can output integers, yay! (actually it's a quick hack - more proper print support coming soon!). Checkout print.bas if you really need some guidance.

 

Also, fixed a bug in rsetlist and the equates from the previous update - no idea why they weren't working ok, they should be fine now :).

  • Like 2
Link to comment
Share on other sites

So, after the laborious and mandatory 2 minute testing we employ here at Reboot labs: PRINT args should be now working! It' still bound to rlocate so you should call that beforehand. Example:

 

RLOCATE 0,0

PRINT "The number is: ",number,". Thank you, drive through!"

  • Like 1
Link to comment
Share on other sites

Linko time!

After he replied here I was able to expose some of his SE functions to RB+. Build nyandodge to hear some freaky stuff :). Anyway here they are, in all their gory:

SNDKILL(x) - stop sample x
SNDPLAYFREQ(x,y) - play sample x with freq y (from 0 to 65535)
SNDDELTA(x,y) - set or adjust the volume on the channel x to y (0 to 63)
SNDFREQ(x,y) - sets frequency of channel x to y (0 to 65535)
SNDVOLRESET(x) - resets volume of channel x.

 

 

And with that, my current queue of whines is now empty ;)

  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

Ok, so after some discussions in this thread over there there are quite a few additions and changes. Let's see...

 

- Removed an unused 64k buffer, so more RAM to tinker with!

- Fixed some string functions including MID$()

- Fixed a small bcx breakage introduced in previous builds

- Included sox and bat file that converts samples to raw.

- Each project now has its own BUILD folder instead of a common one.

- Each project now needs a file called "romassets.h" in its base folder even if it's blank. See below for details

- rln and rmac updated to latest versions.

- New command: loadclut palette_address,target_clut_number_of_indices implemented. This takes the palette values at address palette_address and copies them to clue target_clut_number (0 to 15). clut_number_of_indices tells the routine how many to copy. So this routine can be used to set up anything from 2 to 256 palette indices at once.
- ROM creation: BUILD.bat updated to enable ROM creation - run it with "build project ROM" to create the rom. Needs assets.txt at the root project's directory.

- New project to demonstrate ROM creation - nyandodgerom
- makearom program created to do what its name says. Part of build system.
- buildlink program created to convert graphics and build a linkfile. Part of build system.

 

A few words on the ROM build system: Since RB+ is built around raptor, most of the assets (gfx, sound) are tied to the build system and should be exposed during compilation. So, in order for that to happen and not make any significant changes I decided to use the following scheme:

 

The compiled RB+ code and data included in the .s files are copied from ROM into RAM and then the program runs from there. If people want to place assets in ROM and access them from there, they can instruct the build system to place them into ROM and expose each asset's starting address to raptor and basic. Before any code is compiled a file called "assets.txt" is read from the project's base directory. Each assets.txt line has 3 parameters: variable name to be exposed to raptor and basic, type of file, filename.

- The first one is self explanatory: the name typed there will be the name you can refer the asset from basic and raptor (for example gfx_titlepic).

- The second one is used to tell the build system if the file should be just included in ROM or if there's anything special action that needs to be done. Graphics files in BMP format can be converted to raw data and palette (with the extensions ".gfxdata" and ".clut") or just raw data without the palette. Sound conversion isn't coded yet but will be able to convert audio files to raw PCM 8bit samples with the frequency of your choice.

(type names for the above are "gfx_clut", "gfx_noclut", "sfx" -does nothing for now-, and anything else for plain storage of the file to ROM).

-The last one is simply the pathname+filename relative to base project dir.
While each file in assets.txt is parsed two files called "romassets.h" and "romassets.inc" are created which give basic and raptor a set of addresses for the assets, so you can use the names you picked as pointers to addresses.

Then the code is compiled, assembled and linked and finally a ROM is created.

 

Sounds complicated! It's not much though, just check out nyandodge vs nyandodgerom - the differences are few and easy to digest I think :).

 

Anyway, I hope people will put all this into good use - it wasn't much fun to code but oh well!

  • Like 6
Link to comment
Share on other sites

Some more stuff...

 

 

- ROM RB+ binary is now packed by default and unpacked at runtime into RAM.
- "build.bat project sendy" or "build.bat project ROM sendy" will send produced binary to Skunkboard instead of running VJ.
- changes to assets.txt "abs/rom, label, type, filename" - autoconversion and inclusion on building .abs. So there's no need to include assets into rapapp.s any more - it can all be included into assets.txt.
- buildlink now trims assets.txt spaces and skips blank lines and lines beginning with *, #, ', ;
- All intermediate files now stored in BUILD folder.
- buildlink now exits if assets.txt is not present and produces empty .inc/.h files
- packer window is now hidden
- rappixl.s zapped from all projects, added inclusion of .inc files in all projects
- buildlink fix problem when parsing small bmp files.
- RPARTI changed to RPARTI(address_of_particle_struct) - a 6 column by user definable rows table of longwords. First row must have (0,0,0,x,y,no_particles) and the other the particle definitions (angle, speed, angular speed, initial colour, colour decay (per frame), pixel life (in frames))

 

It's actually very easy to define a particle array in basic. This is enough:

 

 

DIM particles%[511,6]
particles[0,3]=160<<16 'x start
particles[0,4]=y<<16 'y start
particles[0,5]=15 'particle count
for i=1 to 15
particles[i,0]=(i* 'angle
particles[i,1]=i/2 'speed
particles[i,2]=0 'angular speed
particles[i,3]=15 'initial colour
particles[i,4]=7 'colour decay (per frame)
particles[i,5]=100 'pixel life (in frames)
next i

 

and then call it using RPARTI(strptr(particles)).

 

Sh3 uploaded a binary of what can be done using particles, new project "spiral" also shows some fun stuff. Enjoy!

  • Like 5
Link to comment
Share on other sites

  • 3 weeks later...

And even more stuff!

 

 

- BUILD.bat now generates assembly intermediate files for the generated C from BCX.

 

Exposed variables from raptor/u235:

- rotary_mode1: +1 = rotary, -1 = jagpad (Port 1) (.l)
- rotary_mode2: +1 = rotary, -1 = jagpad (Port 2) (.l)
- turn_direction1: rotary value (bigger is faster) - +=left / 0=nothing / -=right (Port 1) (.l)
- turn_direction2: rotary value (bigger is faster) - +=left / 0=nothing / -=right (Port 2) (.l)
- rotary_interval1: trim value for rotary (Port 1) (.l)
- rotary_interval2: trim value for rotary (Port 2) (.l)
- spin_delta1: value to add to turn_direction per increment (Port 1) (.l)
- spin_delta2: value to add to turn_direction per increment (Port 2) (.l)
- raptor_fade_delay - delay (in function calls) between steps (.word)
- RAPTOR_particles_GPU_erase
- RAPTOR_particles_GPU_plot

RAPTOR_fade_clut mapped to fadepal(clut_no,fade_cols,palette)
clut is starting CLUT (from 0 to 15), fade_cols is the number of colours to fade minus one (so to fade 16 colours pass a 15), and palette is the address of the palette we want to fade into.

 

And a new project: Changer. I can't describe exactly what it does, just run it and see :D

  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...

Polishing the whole system to be more solid:

 

- BUILD.bat tidied up. Build log now is created on the build folder of each project dir. makearom/buildlink also log actions there.

- BUILD.bat <projectname> will create a new project folder from "template".

- 16bit graphics conversion (not tested yet!)

 

After a non-successful build, build.bat will automatically open notepad with the build log, so you can quickly inspect to see what the culprit is (or copy/paste it and send it to us!).

Edited by ggn
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...