English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 23 August 2012, 11:32   #1
Sparticle
Registered User
 
Join Date: May 2009
Location: Leicester/U.K
Posts: 36
Amiga C manual and Hi-SoftC/C++ problem

Hi all,

I've been busy trying to code with the Amiga over the last few days.
Im on chapter 3 (Sprites) of the Amiga C manual, example 2.
I have tried everything, but the ChangeSprite() function just wont compile:

ChangeSprite( 0, &my_sprite, ship_data[ frame ] );

I just get the error "Illegal argument".
I've spent ages looking on the net for a solution and tinkering with the compiler settings, but to no avail.

Any help would be much appreciated.
Sparticle is offline  
Old 23 August 2012, 11:46   #2
davideo
Amiga Tomcat

davideo's Avatar
 
Join Date: Sep 2007
Location: Boston Lincs
Posts: 1,225
I've got Hisoft installed on my system so I should be able to look at it tonight for you.

Dave G
davideo is offline  
Old 23 August 2012, 12:08   #3
Sparticle
Registered User
 
Join Date: May 2009
Location: Leicester/U.K
Posts: 36
Thanks Dave !!
Sparticle is offline  
Old 24 August 2012, 00:49   #4
davideo
Amiga Tomcat

davideo's Avatar
 
Join Date: Sep 2007
Location: Boston Lincs
Posts: 1,225
@Sparticle

I've got the example to compile and run in both HisoftC and StormC. The only thiing I had to do was remove the chip keyword and insert the #pragma chip and #pragma fast

The only problem is the sprite doesn't show up Which must be something to do with the sprite data as the sprite is allocated correctly and the position is updated as it should be

I'm away now for a few days but I will look into it again when I get back and have got a bit more time.

Unless of course you or somebody else comes up with the answer before then

Dave G
davideo is offline  
Old 24 August 2012, 01:18   #5
Sparticle
Registered User
 
Join Date: May 2009
Location: Leicester/U.K
Posts: 36
Thanks Dave, I've sorted it mate.
All I needed to was cast the last parameter to an unsigned char*;

from:
ChangeSprite( 0, &my_sprite, ship_data[ frame ] );
to:
ChangeSprite( 0, &my_sprite, (unsigned char*)ship_data[ frame ] );

Strange really as the last parameter is described as an APTR pointer on the net.

Thanks again mate
Sparticle 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
Amiga manual Website Josh News 283 14 November 2015 15:42
Amiga 1200 manual wlcina request.Other 1 15 December 2009 17:10
A500 service manual, technical reference manual a500l0ver request.Other 2 26 September 2008 14:06
FS/FA: Amiga Guru Book & Amiga 1200 Service Manual vamigan MarketPlace 3 11 August 2007 14:56
Amiga Realm & Amiga DOS online reference manual. Paul Amiga websites reviews 4 26 August 2002 12:06

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 12:38.


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