AmigaOS3.x Target

Monkey Targets Forums/User Targets/AmigaOS3.x Target

bruZard(Posted 2011) [#1]
If I just copy the target stdcpp it works flawlessly with the use of 68k-amigaos-g++ compiler. But if i AmigaOS includes specific use i get the error that "Object" has already been declared as "ULONG". Where on earth is "Object" as ULONG declared?

(this is a google translation, my english is very bad ;) )


DruggedBunny(Posted 2011) [#2]
I don't know much about C++ programming, but after a bit of Googling, I did find this:

http://aros.sourceforge.net/documentation/developers/headerfiles/intuition/classusr.h

... and about 15 lines down:

typedef ULONG  Object


So, I imagine it's one of the standard AmigaOS declarations (this is the AROS version), but I have no idea how you would work around this problem in C++, bearing in mind that Object is a reserved keyword in Monkey.


Samah(Posted 2011) [#3]
Perhaps you could try changing the externed class name in lang.monkey.
Class @Object Extends Null="Object"

Change the "Object" string to something else and see if it compiles. This is an area you'd really need to dig into trans for.


bruZard(Posted 2011) [#4]
thank you guys. infact it means: it is impossible to create a amigaos target. damn.


bruZard(Posted 2011) [#5]
Solution: i import a native "alang.cpp" ;)


DruggedBunny(Posted 2011) [#6]
Couldn't you modify trans to convert Object (only in .monkey files) to AObject or something during output?


bruZard(Posted 2011) [#7]
yes, it works now.


bruZard(Posted 2011) [#8]
ok, now all works fine.
Strict

Import amigaos3

Function Main:Int()	
	local myWin:Window = new Window()
	myWin.Create("Hallo Amiga", 100, 100, 600, 300)
	Local exitFlag:Bool = false
		
	Repeat
		Local msg:IntuiMessage = myWin.GetMessage()
		Local cls:Int = msg.mClass
		Local dta:Int = msg.mCode
		
		Select cls
			Case CLOSEWINDOW
				Print "und tschuess"			
				exitFlag = True
				
			Case VANILLAKEY
				Print "Code: " + msg.mCode
		End
	Until exitFlag
	
	myWin.Close()
	
	Return 0
End




HURRAY!!!


DruggedBunny(Posted 2011) [#9]
Excellent, well done. I was hoping someone smarter than me would do this one day!


bruZard(Posted 2011) [#10]
I do not know whether I may publish the target. It changed many parts of Monkey. Mark it would first say something about it.


therevills(Posted 2011) [#11]
If you have just changed Monkey it is fine to publish it - Monkey is public domain. If you have changed Mojo you can not publish it.


bruZard(Posted 2011) [#12]
no, i've not changed Mojo. A Mojo-Port is mass work :D

ok, i build a package and will publish it here.

by the way: i've added the AROS Target.


visionastral(Posted 2011) [#13]
wow!
I wish someone could do that for MSX2+ !
:p


Playniax(Posted 2011) [#14]
Cool man!


bruZard(Posted 2011) [#15]
Amiga Target for AOS3 and AROS is ready: http://www.sedm.de/monkey/AmigaTarget.zip

1. Important: make a backup from your Monkey Installation
2. extract the archive and copy the content over your Monkey Installation
3. install AmiDevCpp from http://amidevcpp.amiga-world.de/AmiDevCpp/info/AmiDevCpp_graceful_Bulldozer_v098_Setup.exe.php
4. add the AmiDevCpp Path ([AMIDEVCPP]\usr\local\amiga\bin) to your Windows Path Variable
5. edit [MonkeyDir]\bin\config.winnt.txt: You can set AOS3 = 1 or/and AROS = 1
6. load /bananas/Amiga/amiga.monkey
7. select "aos3" as target

If you have Jungle IDE you can select BUILD, otherwise you get an error. Ignore this error and copy appOS3 or appAros to the target system and run it.


bruZard(Posted 2011) [#16]
Update:

added : AROS=1 builds executables for Aros386, ArosPPC and Aros64
fixed : Aros: 'USHORT' does not name a type
fixed : AmigaTarget now works with the Monkey demo


slenkar(Posted 2011) [#17]
getting mojo to work on other platforms isnt that hard,
you have the C++ version of mojo for GLFW already so you just substitute the relevant parts.
Most of the graphic commands are written in monkey and rely on SetMatrix


bruZard(Posted 2011) [#18]
thats the plan: port the glfw target ;)


bruZard(Posted 2011) [#19]
Windows have now the title that given with Window.create() or CreateWindow() ... title.ToCString<char>() does the job. I have many new grey hairs with this Mark ;)


bruZard(Posted 2011) [#20]
new update

the Monkey code for this picture:
Strict

Import amigaos3

Function Main:Int()	
	Local win:Window = CreateWindow("Hallo Amiga", 100, 100, 600, 400)
	Local mx:Int		= 0
	Local my:Int		= 0
		
	Cls(win)
	SetColor(win, 255, 0, 0)
	
	Repeat
		WaitEvent(win)
		mx = MouseX(win)
		my = MouseY(win)
		
		If EventClass(win) = CLOSEWINDOW Then Exit
		If MouseDown(win) then Plot(win, mx, my)
	Forever
	
	CloseWindow(win)
	
	Return 0
End

Changelog:
12/01/2011 v0.2
added	: Window.eventClass:Int()
added	: Window.eventCode:Int()
added	: Window.setColor:Void(r:Int, g:Int, b:Int)
added	: Window.getBestPen:Int(r:Int, g:Int, b:Int)
added	: Window.setAPen:Void(pen:Int)
added	: Window.cls:Void()
added	: Window.plot:Void(x:Int, y:Int)
added	: Window.mouseX:Int()
added	: Window.mouseY:Int()
added	: Window.mouseDown:Int()
added	: Window.mouseUp:Int()
added	: EventClass:Int(win:Window)
added	: EventCode:Int(win:Window)
added	: SetColor:Void(win:Window, r:Int, g:Int, b:Int)
added	: GetBestPen:Int(win:Window, r:Int, g:Int, b:Int)
added	: SetAPen:Void(win:Window, pen:Int)
added	: Cls:Void(win:Window)
added	: Plot(win:Window, x:Int, y:Int)
added	: MouseX:Int(win:Window)
added	: MouseY:Int(win:Window)
added	: MouseDown:Int(win:Window)
added	: MouseUp:Int(win:Window)
changed	: renamed Window.IntuiMessage:Int() to Window.WaitEvent:Int()
changed	: renamed GetIntuiMessage:Int() to WaitEvent:Int()
fixed	: windowtitle was not set


Download: http://www.sedm.de/monkey/AmigaTarget.zip
the AOS3 executable can be found in /bananas/Amiga/amiga.build/aos3/appAOS3

have fun! :)


bruZard(Posted 2011) [#21]
0.21 is available

http://www.sedm.de/monkey/AmigaTarget.zip

i've overloaded the function SetColor() so these can get RGB values or a pen number. New is the function ClsColor(). These function is also overloaded and get RGB values or a pen number as parameter. The bug with Aros64 is fixed, so you can build for Aros64 systems like for amigaos3.x


slenkar(Posted 2011) [#22]
looking good,
in monkey v50 the command is called DrawPoint(x#,y#).


bruZard(Posted 2011) [#23]
This is not "Mojo for Amiga", so it is called "Plot()" ;)


bruZard(Posted 2011) [#24]
Version 0.22 is now online ... check changes.txt.
http://www.sedm.de/monkey/AmigaTarget.zip




ErikT(Posted 2011) [#25]
Very cool, thanks for sharing :)


DruggedBunny(Posted 2011) [#26]
Yeah, keep going! Do you have any particular plans in mind, eg. full-screen, image loading/display, etc? (Perhaps using SDL/Warp3D?)


slenkar(Posted 2011) [#27]
is Amiga OS really cool? I might install it for a larf


bruZard(Posted 2011) [#28]
full screen will be implemented via screens. image loading is in my TODO. I've no plans for integrating SDL or Warp3D.

@slenkar: yes, it's very kewl ;)


bruZard(Posted 2011) [#29]
version 0.23 is online

12/10/2011 v0.23
added : MilliSecs:Int()
added : Window.LoadFont:Font(fontName:String, size:Int)
added : Window.LoadFont:Font(fontName:String, size:Int, style:Int)
added : Window.LoadFont:Font(fontName:String, size:Int, style:Int, flags:Int)
added : Window.SetFont(font:Font)
added : Window.DrawText(text:String, x:Int, y:Int)
added : LoadFont:Font(win:Window, fontName:String, size:Int)
added : LoadFont:Font(win:Window, fontName:String, size:Int, style:Int)
added : LoadFont:Font(win:Window, fontName:String, size:Int, style:Int, flags:Int)
added : LoadFont:Font(fontName:String, size:Int) [Mojo Style]
added : LoadFont:Font(fontName:String, size:Int, style:Int) [Mojo Style]
added : LoadFont:Font(fontName:String, size:Int, style:Int, flags:Int) [Mojo Style]
added : SetFont(win:Window, font:Font)
added : SetFont(font:Font) [Mojo Style]
added : DrawText(win:Window, text:String, x:Int, y:Int)
added : DrawText(text:String, x:Int, y:Int) [Mojo Style]





the code for the image (mojo style)
Import amigaos3

Class myApp extends App
	Field mx:Int
	Field my:int
	Field time:Int
	Field FPS:Int
	Field tmpFPS:Int
	Field tmpTime:int
	Field lastFPS:Int
	Field fnt:Font
	
	Method OnCreate()
		fnt = LoadFont("helvetica.font", 16)
		SetFont(fnt)
		AppTitle("draw with Monkey")
		SetColor(255, 255, 0)
		ClsColor(90, 120, 200)
		Cls()
	End
	
	Method OnUpdate()
		mx = MouseX()
		my = MouseY()
		tmpFPS = tmpFPS + 1
		tmpTime = MilliSecs()
		
		if tmpTime - time > 1000
			FPS		= tmpFPS
			tmpFPS	= 0
			time 	= tmpTime
		EndIf
	End
	
	Method OnRender()
		if MouseDown() DrawRect(mx-1, my-1, 3, 3)
		if tmpTime <> time DrawText("FPS: " + FPS + " Time: " + time, 10, 10)
	End
End

Function Main()
	New myApp
End


http://www.sedm.de/monkey/AmigaTarget.zip < AmigaTarget for Monkey v0.23 (~1.1MB)


DruggedBunny(Posted 2011) [#30]
I still haven't tried it, but I had a look at the 0.23 code and it all looks very nice!

BTW If you run into problems with Print and floating-point values, where it just prints "%f", here's something I discovered and wrote down while experimenting with AmiDevCPP:


To fix floating point value problems in Print statements...

Open Tools menu -> Compiler Options, make sure m68k-Amiga-OS3 is selected in Compiler Set drop-down.

In Compiler tab -> Compiler Command Line section, remove -noixemul from both compiler and linker boxes,

OR

In the individual Project Options, under Parameters tab -> Linker, remove this line:

-noixemul

Resulting program will NEED ixemul.library 48+ installed to work! (Float values in Print statements will just print %f with lower versions.)

Install ixemul.library from archive below into LIBS: the version you install depends on Amiga's CPU. With 060 in WinUAE, had to use ixemul-040.library, but whichever one is used must be renamed as ixemul.library.

http://aminet.net/package/util/libs/ixemul-48.0



I believe it's a problem with the statically-linked version of the ixemul library in AmiDevCPP.


bruZard(Posted 2011) [#31]
there's no problem with Print and floats. I've copied mark's "String" C++ class and renamed it to "CString". All works fine with that.


bruZard(Posted 2011) [#32]
also i compile with -noixemul. Amiga Monkey binaries will run on a naked Amiga1200 with OS3.0


bruZard(Posted 2011) [#33]
0.24 is live > http://www.sedm.de/monkey/AmigaTarget.zip




12/11/2011 v0.24
added : Window.DrawLine:Void(x1:Int, y1:Int, x2:Int, y2:Int)
added : DrawLine:Void(win:Window, x1:Int, y1:Int, x2:Int, y2:Int)
added : DrawLine:Void(x1:Int, y1:Int, x2:Int, y2:Int) [Mojo Style]
added : Window.DrawEllipse:Void(x:Int, y:Int, width:Int, height:Int)
added : DrawEllipse:Void(win:Window, x:Int, y:Int, width:Int, height:Int)
added : DrawEllipse:Void(x:Int, y:Int, width:Int, height:Int) [Mojo Style]
added : Window.DrawOval:Void(x:Int, y:Int, width:Int, height:Int)
added : DrawOval:Void(win:Window, x:Int, y:Int, width:Int, height:Int)
added : DrawOval:Void(x:Int, y:Int, width:Int, height:Int) [Mojo Style]
added : Window.DrawCircle:Void(x:Int, y:Int, radius:Int)
added : DrawCircle:Void(win:Window, x:Int, y:Int, radius:Int)
added : DrawCircle:Void(x:Int, y:Int, radius:Int) [Mojo Style]
changed : at start Monkey stets BPen to pen number 0




matt(Posted 2011) [#34]
I'm quite up for trying this. what's the easiest way to set up a test environment to run the binary?

I have a maxed out A600, and an A1200. Or just UAE?


bruZard(Posted 2011) [#35]
a A1200 should be enough.


matt(Posted 2011) [#36]
Thanks, I'll ave to set it up over Christmas.


dawlane(Posted 2011) [#37]
Makes me want to have a bash myself. I wonder if it's possible to do this for other old home computers.


bruZard(Posted 2011) [#38]
if this old home computer has a c++ crosscompiler for windows or mac, you can do that ;)


dawlane(Posted 2011) [#39]
I know many old CPU's have had c/c++ cross compilers written for them. I think it would be a question of whether or not if the under lying C/C++ libs are in place and stable for low level access.


bruZard(Posted 2011) [#40]
0.25 is live
http://www.sedm.de/monkey/AmigaTarget.zip




12/13/2011 v0.25
added : class Image
added : Image.Width
added : Image.Height
added : Image.Depth
added : Image.Load:Void(filename:String, remapColors:Bool = False)
added : Image.Free:Void()
added : LoadImage:Image(filename:String)
added : LoadImage:Image(filename:String, remapColors:Byte)
added : Window.DrawImage:Void(img:Image, x:Int, y:Int)
added : DrawImage:Void(win:Window, img:Image, x:Int, y:Int)
added : DrawImage:Void(img:Image, x:Int, y:Int) [Mojo Style]
added : FreeImage:Void(img:Image)
added : Window.SetScreen:Void(pubScreen:String = "workbench")
added : SetScreen:Void(win:Window, pubScreen:String = "workbench")
added : SetScreen:Void(pubScreen:String = "workbench") [Mojo Style]
added : SetUpdateRate:Void(hertz:Int) [only with Mojo Style]
added : Window.getWidth:Int()
added : Window.getHeight:Int()
added : WindowWidth:Int(win:Window)
added : WindowHeight:Int(win:Window)
added : DeviceWidth:Int() [Mojo Style]
added : DeviceHeight:Int() [Mojo Style]
changed : MilliSecs() now returns a 64 bit value
changed : CreateWindow() now has the optional parameter "borderless"
fixed : ClsColor() now affects the BPen
fixed : in Mojo-Style now the workbench will be locked



Import amigaos3

Class myApp extends App
	Field mx:Int
	Field my:int
	Field time:Int
	Field FPS:Int
	Field tmpFPS:Int
	Field tmpTime:int
	Field lastFPS:Int
	Field fnt:Font
	Field lastX:Int
	Field lastY:Int
	Field img:Image
	Field bg:Image
	
	Method OnCreate()
		fnt = LoadFont("helvetica.font", 16)
		img = LoadImage("amiga.data/monkey.iff")
		bg = LoadImage("amiga.data/background.jpg")
		
		SetFont(fnt)
		AppTitle("draw with Monkey")
		
		SetColor(255, 255, 0)
		ClsColor(200, 90, 0)
		Cls()
				
		lastX = 0
		lastY = 0
		
		SetUpdateRate(60)
	End
	
	Method OnUpdate()
		mx = MouseX()
		my = MouseY()
		tmpFPS = tmpFPS + 1
		tmpTime = MilliSecs()
		
		if tmpTime - time > 1000
			FPS		= tmpFPS
			tmpFPS	= 0
			time 	= tmpTime
		EndIf
	End
	
	Method OnRender()
		DrawImage(bg, 0, 0)
		
		if MouseDown() 
			DrawCircle(mx-1, my-1, 3)
			if lastX > 0 And lastY > 0 DrawLine(lastX, lastY, mx, my)
			lastX = mx
			lastY = my
		EndIf
		
		if tmpTime <> time DrawText("FPS: " + FPS, 10, 10)
		
		DrawImage(img, mx, my)
	End
End

Function Main()
	New myApp
End


this will not work on a real 68k Amiga. Still use a AOS4/MOS machine or try it on aros or WinUAE.


ErikT(Posted 2011) [#41]
AppAOS3 gives me a guru meditation in WinUAE 2.3.30 and 2.0.0 whenever I try to draw anything inside the window. Running it with AOS 3.0. So AOS 4.0 only then?


bruZard(Posted 2011) [#42]
no, AOS4 is not supported yet. I've tested with OS3.1 and OS3.9. now i'll setup a 3.0 environment and check what happend.


DruggedBunny(Posted 2011) [#43]

this will not work on a real 68k Amiga


Hmm, why is that? Are you planning to support real Amigas still? :(


bruZard(Posted 2011) [#44]
it will work, but it is verly slow. The reason is "Cls()". You cannot redraw the whole scene every frame on a 14 or 7MHz machine.


matt(Posted 2012) [#45]
How are you doing the Cls? Blitter or CPU?


bruZard(Posted 2012) [#46]
graphics.library -> blitter


matt(Posted 2012) [#47]
I was reading that there can be some speed benefits doing it using the CPU? Or even a mix of the two...

http://www.ultimateamiga.co.uk/index.php?topic=9301.0


bruZard(Posted 2012) [#48]
i set the window rastport to 0, theres no faster way to clear a rastport in a workbench window. screens are not ready yet and i try at this time to overload the methods with Picasso96/CyberGfx functions. the main target is that you can write aga (named "aa" outside from europe) games with monkey. an amiga1200 has just 2mb chipram and a 14MHz processor.

the amiga target is a really big horde of dancing monkeys. i have to catch all of them but that is a hard work and everytime some monkey slip thru my fingers ;)


matt(Posted 2012) [#49]
You're doing great work I was just trying to give you a little push further up the mountain. :)


bruZard(Posted 2012) [#50]
We're now try a port of the opengl module (ES1.1). On Amiga we use Mesa (StormMesa) for opengl. wish me luck!


Playniax(Posted 2012) [#51]
Good luck :)


DruggedBunny(Posted 2012) [#52]
Cool! If you get it working, it should be possible to use it in WinUAE with Wazp3D.


bruZard(Posted 2012) [#53]
"trans" now compiles "trans" without an error for AmigaOS3.x but it do not work atm. The goal is to use Monkey on AmigaOS3.x without Windows. Now i've to port all the functions in lang.cpp, os.cpp etc. for Amiga.


matt(Posted 2012) [#54]
Great work! Keep it up. :)


DruggedBunny(Posted 2012) [#55]

"trans" now compiles "trans" without an error for AmigaOS3.x


Wow, well done!


bruZard(Posted 2012) [#56]
trans now run on AmigaOS3.x but it crashed when i try to compile a source. I feel like Sherlock Holmes ....


slenkar(Posted 2012) [#57]
how much ram does the amiga have available?


bruZard(Posted 2012) [#58]
A500 = 512kb
A1200 = 2MB


slenkar(Posted 2012) [#59]
you could be running out of RAM during compilation?


bruZard(Posted 2012) [#60]
no, my emulation has 2GB RAM ;)


bruZard(Posted 2012) [#61]
0.26 is available: http://www.sedm.de/monkey/amonkey/AMonkey026.zip
changed	: mojo-reimplementation is now called "amiga"
changed	: the target is now called "amiga" instead of "aos3"
changed	: the target now has its own config file 
changed	: you can now define for every platform it should be compiled or not
changed	: its not longer important to add the AmiDevCPP path to the Windows PATH variable, instead you have to put the path in config.amiga.txt
note	: you can set AOS4, MOS, AROS64 and AOSPPC in config.amiga.txt to true, but at this time only AOS3, AROS386 and AROS PPC will work!
note	: until "trans" is fully ported to Amiga, you have to set the values in "config.winnt.txt"


by the way: In the next issue of the print magazine "Amiga Future" you can read an interview about Monkey for Amiga.


slenkar(Posted 2012) [#62]
cool lookin forward to the interview,

will it work on an original A1200?


bruZard(Posted 2012) [#63]

will it work on an original A1200?

yes.


bruZard(Posted 2013) [#64]
i've started to port the "AmigaTarget" to the new target system ... what a hell. i have to change the half of monkey because Mark has declared one class as "Object". *Aaargh* i can also not compile with my changed monkey version to other targets ... i think the new target system is better then the old one ... but it is very very very frustrating that Mark thinks he is the last man at earth and can call a class "Object".


DruggedBunny(Posted 2013) [#65]
Hmm, I thought you resolved that problem at the start of this thread!


bruZard(Posted 2013) [#66]
Resolved? No. Bypassed!


richb(Posted 2013) [#67]
How's this come along, I thought this was an interesting target.


rIKmAN(Posted 2013) [#68]
I'd love to have a play with this, just for old times sake.

Seriously loved my Amigas.


bruZard(Posted 2013) [#69]
don't cry, it's coming: http://www.amigamonkey.de/


Sensei(Posted 2013) [#70]
Ooh exciting! Looking forward to seeing how this pans out.


DruggedBunny(Posted 2013) [#71]
Oh, cool to see it's still being worked on.


bruZard(Posted 2013) [#72]
ftw ....
also available in the english version of the "Amiga Future"


slenkar(Posted 2013) [#73]
Lookin good


Loofadawg(Posted 2013) [#74]
Miss my Amiga (Heck, I miss my C64/128, but not so much my TI99-4/a although we had some good times as my first computer).


Sensei(Posted 2013) [#75]
Anybody tried this out yet? I see there's a few downloads on the website now.

Well done for your progress so far Bruzard. You should update this thread with your progress :)


rIKmAN(Posted 2014) [#76]
Bump for progress report


Sensei(Posted 2014) [#77]
8 months since last update... :(


bruZard(Posted 2014) [#78]
sorry for that, but i'am very busy.


computercoder(Posted 2016) [#79]
Any status with the progress of this project? I hope it wasn't abandoned!