{"id":945,"date":"2022-08-30T15:09:48","date_gmt":"2022-08-30T15:09:48","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/how-do-you-use-printf-from-assembly-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:09:48","modified_gmt":"2022-08-30T15:09:48","slug":"how-do-you-use-printf-from-assembly-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/how-do-you-use-printf-from-assembly-collection-of-common-programming-errors\/","title":{"rendered":"How do you use printf from Assembly?-Collection of common programming errors"},"content":{"rendered":"<p>I think this article explains it better than I can.<\/p>\n<p>Roughly put, the assembler cannot find the symbol (function) in <code>go.asm<\/code>. You have to tell it its an external symbol.<\/p>\n<p>The linked article approaches building a mixed-code app from the point of view of using assembly as the main language including running the <code>main<\/code> routine. If you&#8217;re using a <code>C<\/code> based main routine, much of what is done is unnecessary, you should just need:<\/p>\n<blockquote>\n<p>Assemble the assembly module with \/Mx to preserve the case of nonlocal names. If using MASM version 6.0 or later, use \/Cx to preserve the case of nonlocal names.<\/p>\n<\/blockquote>\n<p>and:<\/p>\n<blockquote>\n<p>Include the statement .MODEL , c in the assembly module to ensure that C naming and calling conventions are used and that the modules use the same default segments. The will be small, medium, compact, or large.<\/p>\n<\/blockquote>\n<p>and <code>EXTERN<\/code> directives for each function you wish to call in the format: <code>EXTERN printf:proc<\/code>.<\/p>\n<p id=\"rop\"><small>Originally posted 2013-11-09 23:05:08. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I think this article explains it better than I can. Roughly put, the assembler cannot find the symbol (function) in go.asm. You have to tell it its an external symbol. The linked article approaches building a mixed-code app from the point of view of using assembly as the main language including running the main routine. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-945","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/945","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=945"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/945\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=945"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=945"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=945"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}