English Amiga Board Amiga Lore


Go Back   English Amiga Board > Coders > Coders. General > Coders. Tutorials

 
 
Thread Tools
Old 28 April 2013, 13:44   #1
htdreams
Registered User
htdreams's Avatar
 
Join Date: Dec 2012
Location: Ferrol / A Coruna / Spain
Posts: 14
Blitz2 blit and block statements inside procedures

Hi!

As i keep on learning Blitz2 and try different things out, i have the following code

Code:
; init code and img loading & shape adquiring...
; now the problematic code:
statement paintmap{bitmapnum, startx, starty}
  shared map()
  
  use bitmap bitmapnum
  for y=0 to 15
    for x=0 to 19
      blit map.b(startx + x, starty + y), x asl 4, y asl 4
    next
  next
end statement

blitz
slice 0,44,320,256,$fff8,5,8,32,320,320

paintmap{0,mapx,mapy}
show 0
use palette 0

mousewait
end
If i use the statement as shown, and it's the same using blit or block statemens to paint, i have a execution error telling me Blit or Block are only available in AMIGA mode... and i don't understand what is wrong...

I managed to get the above example working replacing the procedure paintmap with a subroutine:

.paintmap:
all the same code as in the procedure
return

And now it runs ok... but i would preffer to use procedures instead of subroutines...

Any ideas? :-)
htdreams is offline  
AdSense AdSense  
Old 28 April 2013, 18:16   #2
leathered
Registered User

leathered's Avatar
 
Join Date: Oct 2011
Location: UK
Age: 40
Posts: 304
Just a shot in the dark, but is that a compile time error? Is it simply because blitz expects a Blit command after a BLITZ call in the program listing - even though it's in a statement?
leathered is offline  
Old 29 April 2013, 00:50   #3
Graham Humphrey
Moderator
Graham Humphrey's Avatar
 
Join Date: Jul 2004
Location: Norwich, Norfolk, UK
Age: 30
Posts: 10,932
It's a runtime error, I had the same thing recently. Basically though you're right - you'll need to ensure that the BLITZ command is before your statement code. It's a bit strange it works like that but that solved the problem for me.
Graham Humphrey is offline  
Old 29 April 2013, 02:19   #4
htdreams
Registered User
htdreams's Avatar
 
Join Date: Dec 2012
Location: Ferrol / A Coruna / Spain
Posts: 14
I see... the thing is that i was choosing to use procedures instead of subroutines to have a clear code, in a more organized way, but this way i would have procedures all over my code, before and after mode changes... this is ridiculous :-D

I'll keep using subroutines then
htdreams is offline  
Old 29 April 2013, 08:36   #5
Graham Humphrey
Moderator
Graham Humphrey's Avatar
 
Join Date: Jul 2004
Location: Norwich, Norfolk, UK
Age: 30
Posts: 10,932
Not necessarily. What might work is if you have certain routines that you use in Blitz mode, and some in Amiga mode, precede all the Blitz mode statements with the BLITZ command and then put all your Amiga mode statements under the AMIGA command. Preferably put them right at the top of your code.

I agree it is ridiculous, it surely must be a bug in Blitz.
Graham Humphrey is offline  
AdSense AdSense  
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Blitz2: Hires laced BippyM Coders. Language 24 29 July 2012 20:18
Blitz2 Newcommandset BippyM Coders. Language 0 21 July 2012 23:59
Can amiblitz (blitz basic2) blit an image per bitplane? Michael Parent Coders. General 7 29 October 2009 17:59
Blitz2 Manual AlfaRomeo Amiga scene 18 01 May 2009 10:53
uninstall procedures? Mojo2000 New to Emulation or Amiga scene 5 26 January 2003 21:01

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 11:04.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.19505 seconds with 12 queries