English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 17 September 2017, 20:57   #1
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 3,678
Blitz Basic tips and tricks

I thought, let's start a thread with your personal findings about Blitz2. That may range from under-documented bugs to undocumented features, optimisations, "design patterns" and whatever else you may have discovered while programming in Blitz.

Just add a reply whenever you discover something worth sharing.
idrougge is offline  
Old 17 September 2017, 20:58   #2
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 3,678
First out: GetReg/PutReg aren't limited to data registers, unlike what's specified in the manual. You can use address registers as well. Just keep in mind that Blitz keeps a lot of the address registers for its own use, but at least A0 and A1 are free for the user.
idrougge is offline  
Old 18 September 2017, 11:02   #3
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 3,435
The DisplayControls command (for adjusting the BPLCON2, 3 and 4 registers) isn't particularly well documented, and can make it difficult to know what it's actually doing. The values you give for BPLCON2 and BPLCON4 aren't put directly in the registers; they are XORed with the default values first. So, you either need to take this into account by pre-calculating the XOR of the desired value and the default, or you can XOR the default with the desired value in your code. For example, to set BPLCON4 to $003F (use colours 49-63 for even sprites and 240-255 for odd sprites), the value needed is ($3F XOR $11), which is $2E:

Code:
DisplayControls 0, 0, $C00, ($3F XOR $11)
Setting the value directly to $3F will result in unexpected colours for your sprites. Also not that this XOR system applies to BPLCON2 and BPLCON4, but does *not* appear to apply to BPLCON3, so you must set that value (default $0C00) directly when you use DisplayControls.
Daedalus is online now  
Old 25 September 2017, 00:28   #4
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 3,678
You can assign to several fields of a newtype at once:
Code:
NEWTYPE .obj
x.w
y.w
End NEWTYPE

a.obj = 10,20
This will set a\x to 10 and a\y to 20.

Last edited by idrougge; 26 September 2017 at 19:33.
idrougge is offline  
Old 27 June 2018, 13:50   #5
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 3,678
Use "Open new..." when you're working on several source files at once (using XINCLUDE to build a single executable). This will open a new file without closing the one you're editing. Now you can switch between open files using F9/F10.
idrougge is offline  
Old 07 July 2018, 18:27   #6
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 3,678
Press the Help key to show a small description of the command under the cursor.
Press shift-help to show the entire description.
Press alt-help to jump to the overview for that library.
idrougge is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Whale's Voyage II - Memories, Tips & Tricks Cherno Nostalgia & memories 8 29 September 2016 12:41
Tips and tricks for instaaling Mediator wanted Jawd support.Hardware 0 19 September 2013 18:16
Electronic Tips And Tricks Pertaining To Amiga Loedown support.Hardware 6 21 February 2013 22:09
Want some A2000 tips 'n tricks! 8bitbubsy support.Hardware 15 24 February 2011 05:30
WinUAE tips & tricks NewDeli project.Green Amiga Alien GUIDES 32 17 October 2009 15:21

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 22:53.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.
Page generated in 0.97038 seconds with 15 queries