{"id":123,"date":"2011-11-07T18:20:48","date_gmt":"2011-11-08T00:20:48","guid":{"rendered":"http:\/\/tommysprinkle.com\/txxos\/?p=123"},"modified":"2021-04-17T18:29:41","modified_gmt":"2021-04-17T23:29:41","slug":"absolute-object-deck-loader","status":"publish","type":"post","link":"https:\/\/tommysprinkle.com\/txxos\/?p=123","title":{"rendered":"Absolute Object Deck Loader"},"content":{"rendered":"<p>Now that we have managed to write a stand-alone program we can IPL and execute it would be nice to not have to write it as a program-in-a-program.\u00a0 Although it gets the job done it is not as straight forward as simply writing a program, assembling it, dropping the resulting object deck in our card reader and hitting IPL.<\/p>\n<p>By building a simple object deck loader we can do just that.\u00a0 Our object deck loader will be a few cards containing a stand alone program that will IPL and then read an object deck from the card reader.\u00a0 It will load the object deck into memory and then transfer execution when all cards have been read.<\/p>\n<p>We will write an absolute loader.\u00a0 Usually we think of a relocating loader that will allow us to load our program into any memory address and handle the necessary work to update relocatable addresses.\u00a0 Our loader will not attempt to update relocatable addresses.<\/p>\n<p>Since we want to use the object deck created by the assembler we need to understand what types of records make up an object deck.\u00a0 There are five types of cards or records that may be found in an object deck.\u00a0 For our simple loader we will only need to be concerned with just two of these.\u00a0 We can safely ignore the other three types.<\/p>\n<p>Object deck records always start with a x&#8217;02&#8217; in column one followed by a three character code that identifies the type of record.\u00a0 These types are SYM for symbolic debugging information, ESD for external sysbols, TXT for text records, RLD for relocatable symbol information and END for the end record.<\/p>\n<p>We will ignore everything except TXT and END records.<\/p>\n<p>The TXT record has the following layout:<\/p>\n<pre>  X     '02'     Object Deck Record\r\n  CL3   'TXT'    Text Record\r\n  C     blank\r\n  XL3            24 bit address of first byte of text data\r\n  CL2   blank\r\n  XL2            Number of byes of text data\r\n  CL2   blank\r\n  XL2            ESD identifier of SD for control section\r\n  XL56           Variable Text Data<\/pre>\n<p>The END record data we are concerned with is:<\/p>\n<pre>  X     x'02'    Object Deck Record\r\n  CL3   'END'    End Record\r\n  C     blank\r\n  XL3            24 bit address of entry point<\/pre>\n<p>The logic of the loader is pretty simple. We start by reading a card.\u00a0 We then verify it is an object deck record (x&#8217;02&#8217; in the first byte).\u00a0 We then check to see if it is a TXT or END card.\u00a0 If it is anything else we ignore it and read the next card.<\/p>\n<p>For TXT cards we move the number of bytes specified in the length field from the text data area to the main memory address specified in the 24 bit address field.<\/p>\n<p>When we encounter an END card we branch to the location contained in the entry point address.<\/p>\n<p>If we encounter any errors we can load a wait state PSW to signal an error condition.<\/p>\n<p><a title=\"Absolute Loader Assembly Listing\" href=\"http:\/\/tommysprinkle.com\/txxos\/?p=128\">[ Next &#8211; Absolute Loader Assembly Listing]<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Now that we have managed to write a stand-alone program we can IPL and execute it would be nice to not have to write it as a program-in-a-program.\u00a0 Although it gets the job done it is not as straight forward &hellip; <a href=\"https:\/\/tommysprinkle.com\/txxos\/?p=123\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"template-page-builder-no-sidebar.php","format":"standard","meta":{"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":[1],"tags":[],"class_list":["post-123","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1CPQT-1Z","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=\/wp\/v2\/posts\/123","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=123"}],"version-history":[{"count":4,"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=\/wp\/v2\/posts\/123\/revisions"}],"predecessor-version":[{"id":522,"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=\/wp\/v2\/posts\/123\/revisions\/522"}],"wp:attachment":[{"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=123"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}