{"id":345,"date":"2011-08-18T20:46:00","date_gmt":"2011-08-18T18:46:00","guid":{"rendered":"http:\/\/lallafa.de\/blog\/?p=345"},"modified":"2011-08-18T20:46:00","modified_gmt":"2011-08-18T18:46:00","slug":"vbcc-0-9b-an-amiga-cross-compiler-for-mac-os-x","status":"publish","type":"post","link":"https:\/\/lallafa.de\/blog\/2011\/08\/vbcc-0-9b-an-amiga-cross-compiler-for-mac-os-x\/","title":{"rendered":"vbcc 0.9b: An Amiga Cross Compiler for Mac OS X"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p>On my neverending quest to have a powerful cross compiler for m68k Classic Amiga (i.e. OS &lt;= 3.x) for my Mac I had a closer look on the fresh new release of Volker Barthelmann&#8217;s C Compiler.<\/p>\n<p>In this post I&#8217;ll describe how to install this nice piece of code on your machine in a few easy steps!<br \/>\n<!--more--><\/p>\n<h3>1. vasm 1.5b<\/h3>\n<p>First we build the cross assembler to assemble the output of vbcc.<\/p>\n<ul>\n<li><a href=\"http:\/\/sun.hasenbraten.de\/vasm\/\">http:\/\/sun.hasenbraten.de\/vasm\/<\/a><\/li>\n<li><a href=\"http:\/\/sun.hasenbraten.de\/vasm\/release\/vasm.tar.gz\">http:\/\/sun.hasenbraten.de\/vasm\/release\/vasm.tar.gz<\/a><\/li>\n<\/ul>\n<p>Download the source code from the above link. Now extract it:<\/p>\n<pre>tar xvfz vasm.tar.gz\r\ncd vasm\r\n<\/pre>\n<p>Build the binary with:<\/p>\n<pre>make CPU=m68k SYNTAX=mot<\/pre>\n<p>Finally install with (note we use <strong>\/opt\/vbcc<\/strong> as the location for all this):<\/p>\n<pre>mkdir -p \/opt\/vbcc\/bin\r\ncp vasmm68k_std vasmm68k_mot vobjdump \/opt\/vbcc\/bin\r\n<\/pre>\n<p>Ok, the assembler is ready!<\/p>\n<h3>2. vlink  0.14<\/h3>\n<p>vlink&#8217;s homepage and the source can also be found on Frank Wille&#8217;s site:<\/p>\n<ul>\n<li><a href=\"http:\/\/sun.hasenbraten.de\/vlink\/\">http:\/\/sun.hasenbraten.de\/vlink\/<\/a><\/li>\n<li><a href=\"http:\/\/sun.hasenbraten.de\/vlink\/release\/vlink.tar.gz\">http:\/\/sun.hasenbraten.de\/vlink\/release\/vlink.tar.gz<\/a><\/li>\n<\/ul>\n<p>Same game here: download source and untarring:<\/p>\n<pre>tar xvfz vlink.tar.gz\r\ncd vlink<\/pre>\n<p>Build:<\/p>\n<pre>mkdir objects\r\nmake<\/pre>\n<p>Install:<\/p>\n<pre>mkdir -p \/opt\/vbcc\/bin\r\ncp vlink \/opt\/vbcc\/bin<\/pre>\n<p>Done!<\/p>\n<h3>3. vbcc 0.9b<\/h3>\n<p>Finally, the compiler itself:<\/p>\n<ul>\n<li><a href=\"http:\/\/www.compilers.de\/vbcc.html\">http:\/\/www.compilers.de\/vbcc.html<\/a><\/li>\n<li><a href=\"http:\/\/www.ibaug.de\/vbcc\/vbcc.tar.gz\">http:\/\/www.ibaug.de\/vbcc\/vbcc.tar.gz<\/a><\/li>\n<\/ul>\n<p>Pepare:<\/p>\n<pre>tar xvfz vbcc.tar.gz\r\ncd vbcc<\/pre>\n<p>I removed the -DHAVE_AOS4 in the Makefile just to be sure.<\/p>\n<p>Build:<\/p>\n<pre>mkdir bin\r\nmake TARGET=m68k\r\nmake TARGET=m68ks<\/pre>\n<p>Install:<\/p>\n<pre>cp bin\/vbcc* bin\/vc bin\/vprof \/opt\/vbcc\/bin<\/pre>\n<p>The compiler is in place now&#8230;<\/p>\n<h3>4. Target Environment<\/h3>\n<p>A cross compiler needs a target environment. This includes the system headers and libraries here for the m68k Amiga platform. Also the implementation for the c standard library (think of printf&#8230;) are required for the target.<\/p>\n<p>Here I only install the amiga m68k target but vbcc supports also other targets. See the following homepage for more details:<\/p>\n<ul>\n<li><a href=\"http:\/\/sun.hasenbraten.de\/vbcc\/\">http:\/\/sun.hasenbraten.de\/vbcc\/<\/a><\/li>\n<li><a href=\"http:\/\/mail.pb-owl.de\/~frank\/vbcc\/2011-08-05\/vbcc_unix_config.zip\">http:\/\/mail.pb-owl.de\/~frank\/vbcc\/2011-08-05\/vbcc_target_m68k-amigaos.lha<\/a><\/li>\n<li><a href=\"http:\/\/mail.pb-owl.de\/~frank\/vbcc\/2011-08-05\/vbcc_unix_config.zip\">http:\/\/mail.pb-owl.de\/~frank\/vbcc\/2011-08-05\/vbcc_unix_config.zip<\/a><\/li>\n<\/ul>\n<p>Download the given archives, one for the m68k target the other for the vbcc descriptions how to run the compiler on a unix-like operating system.<\/p>\n<p>Unzip the archives (If you don&#8217;t have lha on your machine. Have a look in <a href=\"https:\/\/trac.macports.org\/browser\/trunk\/dports\/archivers\/lha\/Portfile\">MacPorts<\/a>!):<\/p>\n<pre>lha x vbcc_target_m68k-amigaos.lha\r\nunzip vbcc_unix_config.zip<\/pre>\n<p>Now install the files into our destination directory:<\/p>\n<pre>export VBCC=\/opt\/vbcc\r\nmv config $VBCC\/\r\nmv vbcc_target_m68k-amigaos\/targets $VBCC\/<\/pre>\n<p>Done! Now all components are in place and we are ready for our first compile&#8230;<\/p>\n<h3>5. First Test<\/h3>\n<p>Ok, for the first test, a simple hello world is fine (file hello.c):<\/p>\n<pre>#include &lt;stdio.h&gt;\r\nint main(int argc, char **argv)\r\n{\r\n  printf(\"hello, world!\\n\");\r\n  return 0;\r\n}<\/pre>\n<p>To compile make sure you have the environment variable VBCC set to the install directory and tha PATH holds the bin directory there:<\/p>\n<pre>export VBCC=\/opt\/vbcc\r\nexport PATH=$VBCC\/bin:$PATH<\/pre>\n<p>The compiler always needs the target platform specified with the + switch:<\/p>\n<pre>cv +aos68k -o hello hello.c<\/pre>\n<p>If all went well you have created a Amiga OS LoadSeg&#8217;able binary called hello:<\/p>\n<pre>&gt; file hello\r\nhello: AmigaOS loadseg()ble executable\/binary<\/pre>\n<p>Now launch your favorite amiga emulator (e.g. P-UAE) and give it a try!<\/p>\n<p>More information on the compiler and its options can be found in the documentation on the official home page of Volker:<\/p>\n<ul>\n<li><a href=\"http:\/\/www.ibaug.de\/vbcc\/doc\/vbcc.html\">vbcc Manual<\/a><\/li>\n<\/ul>\n<h3>6. Amiga OS Development<\/h3>\n<p>If you want to use the Amiga Libraries in your Programs you will need the OS headers and libraries from a NDK. For the last OS 3.9 you can download it here: <a href=\"http:\/\/www.haage-partner.de\/download\/AmigaOS\/NDK39.lha\">NDK 3.9<\/a>. Simply untar the contents somewhere and define the following environment variables:<\/p>\n<pre>export NDK=\/path\/to\/NDK_3.9\r\nexport NDK_INC=$NDK\/include\/include_h\r\nexport NDK_LIB=$NDK\/linker_libs<\/pre>\n<p>Now a typical compile line looks like:<\/p>\n<pre>vc +aos68k -I$NDK_INC -L$NDK_LIB -o test test.c -lamiga<\/pre>\n<p>Use this to compile a sample taken from the NDK:<\/p>\n<pre>cd $NDK\/Tutorials\/ARexx\/Host\r\nvc +aos68k -I$NDK_INC -L$NDK_LIB RexxShell.c -lamiga<\/pre>\n<p>You can compare your compile (a.out) with the official binary:<\/p>\n<pre>&gt; ls -la RexxShell a.out\r\n-rwxr-xr-x\u00c2\u00a0 1 chris\u00c2\u00a0 staff\u00c2\u00a0 6652\u00c2\u00a0 1 Nov\u00c2\u00a0 1999 RexxShell*\r\n-rwxr-xr-x\u00c2\u00a0 1 chris\u00c2\u00a0 staff\u00c2\u00a0 5988 18 Aug 20:38 a.out*<\/pre>\n<p>Quite nice small result! Now head on to some own code and enjoy your new compiler!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; On my neverending quest to have a powerful cross compiler for m68k Classic Amiga (i.e. OS &lt;= 3.x) for my Mac I had a closer look on the fresh new release of Volker Barthelmann&#8217;s C Compiler. In this post &hellip; <a href=\"https:\/\/lallafa.de\/blog\/2011\/08\/vbcc-0-9b-an-amiga-cross-compiler-for-mac-os-x\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[11,6,9],"tags":[],"class_list":["post-345","post","type-post","status-publish","format-standard","hentry","category-amiga","category-mac-stuff","category-software"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/piBMF-5z","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/lallafa.de\/blog\/wp-json\/wp\/v2\/posts\/345","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lallafa.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lallafa.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lallafa.de\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/lallafa.de\/blog\/wp-json\/wp\/v2\/comments?post=345"}],"version-history":[{"count":7,"href":"https:\/\/lallafa.de\/blog\/wp-json\/wp\/v2\/posts\/345\/revisions"}],"predecessor-version":[{"id":352,"href":"https:\/\/lallafa.de\/blog\/wp-json\/wp\/v2\/posts\/345\/revisions\/352"}],"wp:attachment":[{"href":"https:\/\/lallafa.de\/blog\/wp-json\/wp\/v2\/media?parent=345"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lallafa.de\/blog\/wp-json\/wp\/v2\/categories?post=345"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lallafa.de\/blog\/wp-json\/wp\/v2\/tags?post=345"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}