Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
94 user(s) are online (87 user(s) are browsing Forums)

Members: 0
Guests: 94

more...

Support us!

Headlines

 
  Register To Post  

« 1 ... 4 5 6 (7) 8 9 »
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
Home away from home
Home away from home


See User information
@Atheist

#include <proto/intuition.h>
#include <proto/graphics.h>
#include <proto/dos.h>

int main(void)
{
 
struct Window *window;
 
struct RastPort *rp;
 
int color;
 
int x;
 
int y;

 
// if window opens 

 // OpenWindow paramiters starts whit '(' and end's whit ')'

 
if (window OpenWindowTags
 
(
  
NULL,
  
WA_Title,"My window",
  
WA_Left,80,
  
WA_Top,40
  
WA_Width,400,
  
WA_Height,300
  
WA_Flags,WFLG_CLOSEGADGET|WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_GIMMEZEROZERO|WFLG_ACTIVATE
  
WA_IDCMP,IDCMP_CLOSEWINDOW|IDCMP_RAWKEY|IDCMP_INTUITICKSTAG_END
 
)
 { 
// THEN
  
rp window->RPort;
  
// Set color to use
  
SetAPen(rp,color);
  
// Draw pixel at x,y
  
WritePixel(rp,x,y);
  
// Wait 20
  
Delay(20);
  
// You most close the window.
  
CloseWindow(window);
 } 
// END IF
// END MAIN FUNC.



to compile the program type


gcc my_prog.-o my_prog -D__USE_INLINE__ -lauto


you need -D__USE_INLINE__ so you don't need to type

IDOS->
IGraphics->
IIntuition->


you need -lauto so you don't need to open librarys.

As the gcc command line gets longer you should put it in AmigaDOS script or makefile.


Edited by LiveForIt on 2009/1/14 22:15:14
(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
Home away from home
Home away from home


See User information
@Allanon

Quote:

you can have non-numeric indexes to simulate structures:
mytable = { name = "Johnny", surname = "Mnemonic" }

so you can access them with:
mytable.name
mytable.surname

but this is not a LUA thread


enum Days {Sat=1, Sun, Mon, Tue, Wed, Thu, Fri};

/*
Now you have auto numbers.
so you don't need to remember numbers.

Sat =1
Sun =2
Mon =3
Tue =4
Wen =5
Fri =6

use this in side tables and event handlers, and so as you like.

*/

(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
Home away from home
Home away from home


See User information
@Atheist


Quote:
is there case sensitivity?


Yes.

Only AmigsOS commands use capital chars in start of command name.
standard C commands are all lower case.

typical format.

FirstnameLastname

upper chars divides one word form an other word.

OpenWindow
CloseWindow

Quote:

And that last bracket seems to be missing the semi-colon. This is why I can not understand C. I can not understand why there isn't a semicolon to the right of the final bracket??


semi-colon divides commands, so you write every thing on one line or on many lines.

for example in AMOS you write

Locate 15,20 : Print "AMOS is cool" : A=A+10 : B=B-20

you do the same in C, but semi-colon is required after each command unlike in Basic.

Locate(15,20); prntf("C is cool\n"); A=A+10; B=B-20;

as you see lines ends whit ';' becouse its required that every command ends whit it.

(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
Amigans Defender
Amigans Defender


See User information
@Atheist

Quote:

As you point out in the last paragraph, that's the tip of the iceberg to simply placing one pixel in a given point on the screen. Also, is there case sensitivity? I see capitals, sometimes not. What's the call on that?


It's all case sensitive. things in the C library are lowercase, things in the Amiga API are usually capitalised. Defined values tend to be all uppercase.

Quote:
"gcc -o pixelplot pixelplot.c -lauto"

It becomes easy to learn to parse out the statment above?
Okay, I can see the name of the source and the compiled file to be made, actually. But there are a bazillion options, right? Like I said, I've seen 30 post threads on "what option should I use".


gcc has a bazillion options, but you don't need to bother with most of them.
-o specifies the resulting executable
-lauto opens all the libraries for you
(and as NutsAboutAmiga said, -D__USE_INLINE__ means you can get rid of all the IIntuition-> junk in front of the functions)
The other thing on the command line is the source filename

Quote:

P.S. What about "Return 0;". Isn't there always a "return 0;" (why, I don't know, more useless junk) at the end?


see jahc's explanation.
In the code I wrote, there probably should have been a return 0; at the end - it sets the return code for the Shell which you can then check with IF FAIL in a shell script. Hardly useless junk but, yes, removed for brevity. I was making it as simple as possible so you wouldn't freak out.

Go to top
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
Just popping in
Just popping in


See User information
@Atheist

This topic emerged to a very interesting state thanks to you. :)

But veer back to your first post I am still curious about the state of your Hollywood ISO. Have you managed to install yet? If not then please ask for help, and then share your thoughts about it.
I think that will match for your needs.

Go to top
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
Home away from home
Home away from home


See User information
I have to wish everyone else was not posting on this thread, because then I feel that Athiest could have focused on what I was saying, rather than getting distracted by lots of other issues (that are generally more complex than I was trying to explain), and that would surely have helped.

As it is, I can only suggest that Athiest re-reads just my posts in this thread, perhaps copying & pasting them into a text file for easy reading.

edit: @Allanon, everyone is just as entitled to post here as me, and I do not for one minute expect others to stop posting. My wish was about the past, not the future.


Edited by ChrisH on 2009/1/19 20:32:25
Author of the PortablE programming language.
Go to top
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
Just popping in
Just popping in


See User information
EDIT:
----------------------------------
@ChrisH
Sorry Ive posted before reading your wishes, this is the last one, I'll stop immediately further comments.
----------------------------------

@LiveForIt

Quote:

LiveForIt wrote:
@Allanon

Quote:

you can have non-numeric indexes to simulate structures:
mytable = { name = "Johnny", surname = "Mnemonic" }

so you can access them with:
mytable.name
mytable.surname

but this is not a LUA thread


enum Days {Sat=1, Sun, Mon, Tue, Wed, Thu, Fri};

/*
Now you have auto numbers.
so you don't need to remember numbers.

Sat =1
Sun =2
Mon =3
Tue =4
Wen =5
Fri =6

use this in side tables and event handlers, and so as you like.

*/


But my example is something quite different, I've make this example to show how structures can be done in LUA and Hollywood, another example can be:

mystruct = { name "Johnny",
             
surname "Mnemonic",
             
activities = { "hero""courier" } }


during the code execution I can add another fields without worries, and I've to remember only the field name:
mystruct.age 33


I can access members with something like this
Function GetMember(membername)
   Return(
mystruct[membername])
EndFunction


so:
value = GetMemeber("name")
sets value with "Johnny"

Enum is something different used to declare constants numerics variables.

Go to top
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
Just can't stay away
Just can't stay away


See User information
@Atheist

Just fire up a Lua or Python interpreter and start experimenting. Your scripts will run cross-platform too.

EDIT: now this is pretty fancy. You can try Lua in the web browser: http://www.lua.org/cgi-bin/demo


Edited by Capehill on 2009/1/14 12:41:48
Go to top
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
Quite a regular
Quite a regular


See User information
Hi LiveForIt,

Quote:

#include <proto/intuition.h>
#include <proto/graphics.h>
#include <proto/dos.h>

int main(void)
{
struct Window *window;
struct RastPort *rp;
int color;
int x;
int y;

// if window opens

// OpenWindow paramiters starts whit '(' and end's whit ')'

if (window = OpenWindowTags
(
NULL,
WA_Title,"My window",
WA_Left,80,
WA_Top,40,
WA_Width,400,
WA_Height,300,
WA_Flags,WFLG_CLOSEGADGET|WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_GIMMEZEROZERO|WFLG_ACTIVATE,
WA_IDCMP,IDCMP_CLOSEWINDOW|IDCMP_RAWKEY|IDCMP_INTUITICKS, TAG_END)
)
{ // THEN
rp = window->RPort;
// Set color to use
SetAPen(rp,color);
// Draw pixel at x,y
WritePixel(rp,x,y);
// Wait 20
Delay(20);
// You most close the window.
CloseWindow(window);
} // END IF
} // END MAIN FUNC.



to compile the program type


gcc my_prog.c -o my_prog -D__USE_INLINE__ -lauto

Thank you very much for that explanation.....

You see, if I ask "how do I change that pixel on the screen to blue?", THAT is the response I need _beacuse_ it answers my question, as I can't understand any better than that. I guess my brain is just limited in it's scope of thinking to AMOS, where:

Plot 159,99,9

just "works".

I have no idea what the inventer of C was thinking when all of the above was "a good idea".

I'm not trying to create swirling 3D sapacship battles, just a SIMPLE game like Black Crypt or Legends of Faerghail. Remember those?

I certainly don't want anyone who could UNDERSTAND what LiveForIt wrote to NOT learn C.

Can't anyone relate to seeing all of the code LiveForIt wrote doing THE SAME as "Plot 159,99,9" as being strange, scary, and more than likely impossible to learn?

AD&D Pools of Radiance was made on a 7.14 MHz computer, don't think that an interpreted language on an 800 MHz computer couldn't make a game that even needs a 14 MHz computer to run on? Even if it was written in assembler on the 14 MHz??

Support Amiga Fantasy cases!!!
How to program: 1. Start with lots and lots of 0's. 10. Add 1's, liberally.
"Details for OS 5 will be made public in the fourth quarter of 2007, ..." - Bill McEwen
Whoah!!! He spoke, a bit late.
Go to top
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
Just can't stay away
Just can't stay away


See User information
@Atheist


Actually, if we start nitpicking, you must add steps to your AMOS version because you must start the interpreter, write/load the BASIC program and compile/start it to see the dot.

The inventor of the C language was probably thinking how to write an efficient, platform agnostic language suitable for writing operating systems like Unix.

C is very flexible with a small amount of commands.

http://en.wikipedia.org/wiki/C_(programming_language)#Philosophy

Go to top
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
Quite a regular
Quite a regular


See User information
Hi lazi

Thanks.


Quote:
lazi wrote:

But veer back to your first post I am still curious about the state of your Hollywood ISO.


The diskimage.device readme says:
Quote:

- AmigaOS4

- AISS v3.1 (DiskImageGUI) - http://masonicons.de

- capsimage.device (IPF plugin) - http://softpres.org
- z.library 50.0 (CSO, DAA, DAX, DMG and UIF plugins) -
http://os4depot.net/share/development/library/misc/zlibrary.lha

- expat.library 4.1 (DMG plugin) -
http://os4depot.net/share/development/library/misc/expat-ppc.lha




On OS4Depot.net in
development/library/misc ("share" isn't available anymore as a directory, I suppose)

there is
zlib.lha
zlibrary.lha

I downloaded zlibrary and tried to unarchive it, it came up with this error message:
Quote:
Extracting from archive 'zlibrary.lha':
*** Error on file 'README' : Unknown compression (need newer LhA version)
WARNING: Skipping corrupt/extraneous data
1 file extracted, 1 file failed.

Operation not entirely successful.

I checked the date on my LHA and it was 23-Sep-04 22:16:08. So I checked to see if there was a new LHA and there was. The date on that one is (when you decompress it) 13-Mar-06 22:27:18. It however gives the SAME error message. So I redownloaded zlibrary.lha and tried again. Same error message. "zlib" doesn't seem to be the same library, as there's no file in the archive titled "z.library".

So, I'm stuck with the undeciphered ISO.

Support Amiga Fantasy cases!!!
How to program: 1. Start with lots and lots of 0's. 10. Add 1's, liberally.
"Details for OS 5 will be made public in the fourth quarter of 2007, ..." - Bill McEwen
Whoah!!! He spoke, a bit late.
Go to top
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
Just popping in
Just popping in


See User information
@Atheist

You simply don't get it.

Changing a pixel in AmigaOS (say in C) is also only one command. (ok, two, if you want another color then the current).
But the C-code above contains also the surounding to open a window etc. AMOS hides this from you. This is good if you are ok with the standard behaviour, it is not ok if you want to control it.

I think, before anyone can help you, define what you want to program and what is your target machine.

(I guess a game like "Legend of Fairgal" on OS4 ?)

If my assumption is correct, I would go for Amiblitz3. But dont think a game like this is really easy. You need to leran a lot till you rach the skill level to do something like this. And I dont mean setting the color of a pixel, a game is much more like this.

Go to top
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
Quite a regular
Quite a regular


See User information
Hi Capehill,

The Lua on OS4Depot.net...... seems to be missing, LUA!

It seems that I have to install, and set up the SDK, which, if I'm not mistaken, isn't even available at the moment.

Not that after seeing all that is involved in making a simple program in C, that I think I might be able to do even an install.

Believe me, I'm trying.

Think Python, regular version, isn't really for games?

Support Amiga Fantasy cases!!!
How to program: 1. Start with lots and lots of 0's. 10. Add 1's, liberally.
"Details for OS 5 will be made public in the fourth quarter of 2007, ..." - Bill McEwen
Whoah!!! He spoke, a bit late.
Go to top
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
Quite a regular
Quite a regular


See User information
Quote:
(I guess a game like "Legend of Fairgal" on OS4 ?)

If my assumption is correct, I would go for Amiblitz3. But dont think a game like this is really easy. You need to leran a lot till you rach the skill level to do something like this. And I dont mean setting the color of a pixel, a game is much more like this.


Hi Wanderer,

My target is PPC AOS4.0 G4 XE.

Does AmiBlitz 3 produce PPC code?

I have used over 50 (to be safe) AMOS Pro commands, including manipulating a 4 dimensional array with at least 126 elements in it.

If then ...elseif , while... wend, For...Next, Inkey$, string manipulations (mid$,Left$,Right$), chr$, printing to/from disk files, 32 bit binary data storage/comparison, drawing boxes/lines/points, opening all 8 screens, increasing stack space (had to), making sure words end in "s" if necessary, gosub/return, procedures, Dim/globals, do...loop Exit, exit if, Repeat/until, and have written some fairly complex equations for decision making....

But, I should learn to program computers, though.

Support Amiga Fantasy cases!!!
How to program: 1. Start with lots and lots of 0's. 10. Add 1's, liberally.
"Details for OS 5 will be made public in the fourth quarter of 2007, ..." - Bill McEwen
Whoah!!! He spoke, a bit late.
Go to top
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
Just popping in
Just popping in


See User information
@Atheist

> My target is PPC AOS4.0 G4 XE.
> Does AmiBlitz 3 produce PPC code?
No. But it produces 68K code that runs on this machine. Most of the time is spend in OS functions anway, so don't be afraid that it could be slow. Also, Amiblitz3 binary code is quite efficient, comparable to C.
Plus, you will get MUCH faster to your goal to write a game than probbly in any other language. Maybe in Hollywood, but you might get stuck with it once you are more experienced. Amiblitz3 will grow with you.

> But, I should learn to program computers, though.
Yes. You leak basic knowledge about programming techiques as you clearly showing in your posts, anybody here will agree.

Anyway, I will give you a start for Amiblitz3:
XINCLUDE "image.include.bb2" ; use the image functions
XINCLUDE 
"ahi.include.bb2" ; use the ahi functions

WBToScreen 0 
we want to run on WB Screen
Window 0
,0,0,320,200,$E,"MyGame",1,open a window

image_Load
{0,"dh0:work/myImage.png"} ; load an image
image_Blit
{0,50,50} ; blit the image to 50,50

ahi_OpenStream
{"Dh0:work/myMusic.mp3"}

Repeat
  ahi_DoStream
{} : Delay_ 1
Until Event
=#IDCMP_CLOSEWINDOW ; loop until close gadget

End free resources and exit



This tiny piece of code opens a window on workbench screen, loads an image and blits it into the window.
It opens an mp3 and plays it until the user closes the window.
And no fiddling around with the compiler, just doubleclick Amiblitz3 and copy this into the editor. Then hit compile&run in the menu.

P.S.: Needless to say that you can load any picture file fromat that has a datatype installed, plus Icons, and it will work from 1-24bit screens.
The music can be MOD, WAV, AIFF, MP2/3 plus some more. I will add MIDI soon.

P.P.S.: All time critical things(loading image, blitting image and decoding mp3) are done in PPC native code.


Edited by Wanderer on 2009/1/14 16:00:06
Edited by Wanderer on 2009/1/14 16:06:49
Go to top
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
Just popping in
Just popping in


See User information
@Atheist

Quote:
I downloaded zlibrary and tried to unarchive it, it came up with this error message:
Quote:
Extracting from archive 'zlibrary.lha':
*** Error on file 'README' : Unknown compression (need newer LhA version)
WARNING: Skipping corrupt/extraneous data
1 file extracted, 1 file failed.

Operation not entirely successful.

I checked the date on my LHA and it was 23-Sep-04 22:16:08. So I checked to see if there was a new LHA and there was. The date on that one is (when you decompress it) 13-Mar-06 22:27:18. It however gives the SAME error message. So I redownloaded zlibrary.lha and tried again. Same error message. "zlib" doesn't seem to be the same library, as there's no file in the archive titled "z.library".

So, I'm stuck with the undeciphered ISO.


That archive was most probably created on a Linux machine where in fact exists a more recent version of LhA than is available for AmigaOS. Try to extract the archive with Unarc, that one should be able to handle the improved compression algorithm.

Go to top
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
Just popping in
Just popping in


See User information
At first, I was daunted by the amount of code needed to do basic things.
After a while, I began noticing that most of it can be re-used again in your next, totally different project.
The fact that I came from a BASIC and, more importantly, AMOS Pro background made this harder than it needed to, since those take care of everything for you.

I'm learning to like C, but, unlike someone wrote here, it's certainly NOT easy to learn. It would be easier if I was about 15 years younger and had more time on my hands, but for a "regular" adult", it's hard work.

Go to top
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
Quite a regular
Quite a regular


See User information
Hi tboeckel,

Wow, thanks very much.

That worked no problem. I always use LHA from the shell on LHA'd files. I'm surprised that the newest LHA didn't work, but my Unarc from AOS4 Prerelease 4 does!

Quote:

This is basically zlib as a shared AmigaOS 4 library. This is not a very
polished release and documentation is poor, so be warned.

The following zlib functions are not present:
zlibVersion()
zlibCompileFlags()
utility functions

Checksum functions are implemented.


Hmmm, hope it works okay.

Support Amiga Fantasy cases!!!
How to program: 1. Start with lots and lots of 0's. 10. Add 1's, liberally.
"Details for OS 5 will be made public in the fourth quarter of 2007, ..." - Bill McEwen
Whoah!!! He spoke, a bit late.
Go to top
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
Amigans Defender
Amigans Defender


See User information
@Atheist

Quote:
Hmmm, hope it works okay.


I've used z.library in one of my projects - it's fine.

Chris

Go to top
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
Just can't stay away
Just can't stay away


See User information
@Atheist

Quote:

I checked the date on my LHA and it was 23-Sep-04 22:16:08. So I checked to see if there was a new LHA and there was. The date on that one is (when you decompress it) 13-Mar-06 22:27:18. It however gives the SAME error message. So I redownloaded zlibrary.lha and tried again. Same error message. "zlib" doesn't seem to be the same library, as there's no file in the archive titled "z.library".

So, I'm stuck with the undeciphered ISO.


You do not need z.library to mount .iso files with diskimage.device.

Go to top

  Register To Post
« 1 ... 4 5 6 (7) 8 9 »

 




Currently Active Users Viewing This Thread: 2 ( 0 members and 2 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project