{"id":2412,"date":"2025-03-18T01:05:47","date_gmt":"2025-03-17T23:05:47","guid":{"rendered":"https:\/\/www.julien-nevo.com\/arkostracker\/?page_id=2412"},"modified":"2025-08-22T12:10:15","modified_gmt":"2025-08-22T10:10:15","slug":"wrapper-for-rasm","status":"publish","type":"page","link":"https:\/\/www.julien-nevo.com\/arkostracker\/index.php\/wrapper-for-rasm\/","title":{"rendered":"Wrapper for Rasm"},"content":{"rendered":"\n<p>In this page, I&#8217;ll explain how to generate a binary for the player and music, in case you don&#8217;t want to use Rasm in your production. A better alternative is to use&nbsp;<a href=\"https:\/\/www.julien-nevo.com\/arkostracker\/index.php\/source-conversion-with-disark\/\">Disark<\/a>!<\/p>\n\n\n\n<p>First of all, have a small Z80 code, called &#8220;wrapper.asm&#8221;, which we will compile with Rasm. It will embed the player and music:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  org #1000     ;This is the fixed address of the player\/music\nPlayerAndMusicBinary_Start\n  include \"resources\/mysong.bin\"\n  include \"resources\/mysong_playerconfig.asm\"\n\n  include \"playerAkg.asm\"  ;It works for any other player.\nPlayerAndMusicBinary_End<\/code><\/pre>\n\n\n\n<p><em>Note: if you&#8217;re wondering what is that &#8220;player config&#8221; file, please check&nbsp;<a href=\"https:\/\/www.julien-nevo.com\/arkostracker\/index.php\/player-configuration\/\" data-type=\"page\" data-id=\"1302\">this page<\/a>. This is optional, but don&#8217;t be afraid to use this great feature!<\/em><\/p>\n\n\n\n<p>Now, when compiling this, we&#8217;ll ask Rasm to export the symbols as Z80 code.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rasm&nbsp;wrapper.asm -o wrapper -sc \"%s equ %d\"<\/code><\/pre>\n\n\n\n<p>This command will compile our &#8220;wrapper.asm&#8221;, generating &#8220;<strong>wrapper.bin<\/strong>&#8221; (the binary), and a symbol file called &#8220;<strong>wrapper.sym<\/strong>&#8220;. However, thanks to the magic &#8220;sc&#8221; command,&nbsp;<strong>the latter has been generated as a Z80 file<\/strong>. Indeed, the symbols have this structure:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>PLAYERANDMUSICBINARY_START equ 4096<br>MYSONG_START equ 4096<br>...<br>PLY_AKG_INIT equ 5123<br>PLY_AKG_PLAY equ 5126\nPLY_AKG_STOP equ 5129<br>...<br>PLAYERANDMUSICBINARY_END equ 6780<\/code><\/pre>\n\n\n\n<p>There are many labels present, but we don&#8217;t care about them. Please note that Rasm generates upper-case labels.<\/p>\n\n\n\n<p>So now, in your&nbsp;<em>real<\/em>&nbsp;code using your favorite assembler (Vasm, Winape, SJAsmPlus, etc.), simply do this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  ;Loads the symbols for the music and player.<br>  include \"wrapper.sym\"<br><br>  ;Includes the music and player binary.<br>  org PLAYERANDMUSICBINARY_START<br>  include \"wrapper.bin\"<br><br>  org #4000<br>  ;This is my super game.<br>...<br>  ;Initializes the song.<br>  ld hl,MYSONG_START<br>  xor a   ;Subsong 0.<br>  call PLY_AKG_INIT<br>...<br>  ;This is the main loop.<br>  call PLY_AKG_PLAY <\/code><\/pre>\n\n\n\n<p>That&#8217;s it! The PLY_AKG_INIT\/PLAY labels can be conveniently used because they are declared in &#8220;wrapper.sym&#8221;. You don&#8217;t have to compile &#8220;wrapper.asm&#8221; again, unless the music changed, or you want to change its compilation address (from #1000 to anything else).<\/p>\n\n\n\n<p>Please don&#8217;t hesitate to contact me if you have any trouble making this work.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this page, I&#8217;ll explain how to generate a binary for the player and music, in case you don&#8217;t want to use [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":202,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_vp_format_video_url":"","_vp_image_focal_point":[],"footnotes":""},"class_list":["post-2412","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.julien-nevo.com\/arkostracker\/index.php\/wp-json\/wp\/v2\/pages\/2412","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.julien-nevo.com\/arkostracker\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.julien-nevo.com\/arkostracker\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.julien-nevo.com\/arkostracker\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.julien-nevo.com\/arkostracker\/index.php\/wp-json\/wp\/v2\/comments?post=2412"}],"version-history":[{"count":2,"href":"https:\/\/www.julien-nevo.com\/arkostracker\/index.php\/wp-json\/wp\/v2\/pages\/2412\/revisions"}],"predecessor-version":[{"id":2414,"href":"https:\/\/www.julien-nevo.com\/arkostracker\/index.php\/wp-json\/wp\/v2\/pages\/2412\/revisions\/2414"}],"wp:attachment":[{"href":"https:\/\/www.julien-nevo.com\/arkostracker\/index.php\/wp-json\/wp\/v2\/media?parent=2412"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}