{"id":11233,"date":"2011-03-14T07:00:00","date_gmt":"2011-03-14T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2011\/03\/14\/the-old-debug-program-can-load-com-files-bigger-than-64kb-but-that-doesnt-mean-they-actually-load-as-a-program\/"},"modified":"2011-03-14T07:00:00","modified_gmt":"2011-03-14T07:00:00","slug":"the-old-debug-program-can-load-com-files-bigger-than-64kb-but-that-doesnt-mean-they-actually-load-as-a-program","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20110314-00\/?p=11233","title":{"rendered":"The old DEBUG program can load COM files bigger than 64KB, but that doesn&#039;t mean they actually load as a program"},"content":{"rendered":"<p>Some times ago, I described <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2006\/01\/30\/519388.aspx#525187\"> why a corrupted binary sometimes results in the error &#8220;Program too big to fit in memory&#8221;<\/a>. Commenter Neil was under the impression that <a href=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2006\/01\/30\/519388.aspx#525187\"> nonrelocatable programs files could be larger than 64KB<\/a> and used the DEBUG command to verify this assertion.\n While it&#8217;s true that DEBUG can load files bigger than 64KB, that doesn&#8217;t mean that they will load as a program. If DEBUG decide that you didn&#8217;t give it a program (the file extension is not EXE or COM),&sup1; then it treats the file on the command line as a data file and loads it into memory in its entirety, provided it fits in memory in its entirety. When it does this, the <code>BX<\/code> register contains the upper 16 bits of the file size, and <code>CX<\/code> contains the lower 16 bits. This is also the format that is used when writing files back out: Use the <code>n<\/code> command to set the name of the output file and set <code>BX:CX<\/code> to the file size.\n Even though DEBUG has been obsolete for over a decade, it is still useful for exactly this purpose: You can use it as a hex editor for files less than around 512KB.\n But don&#8217;t deceive yourself into thinking that you created a COM file that is bigger than 64KB.<\/p>\n<p> &sup1;There is another extension which has special meaning to DEBUG, but it&#8217;s not relevant to the discussion. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Some times ago, I described why a corrupted binary sometimes results in the error &#8220;Program too big to fit in memory&#8221;. Commenter Neil was under the impression that nonrelocatable programs files could be larger than 64KB and used the DEBUG command to verify this assertion. While it&#8217;s true that DEBUG can load files bigger than [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[2],"class_list":["post-11233","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-history"],"acf":[],"blog_post_summary":"<p>Some times ago, I described why a corrupted binary sometimes results in the error &#8220;Program too big to fit in memory&#8221;. Commenter Neil was under the impression that nonrelocatable programs files could be larger than 64KB and used the DEBUG command to verify this assertion. While it&#8217;s true that DEBUG can load files bigger than [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/11233","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=11233"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/11233\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=11233"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=11233"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=11233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}