{"id":333,"date":"2012-01-03T21:01:00","date_gmt":"2012-01-04T03:01:00","guid":{"rendered":"http:\/\/tommysprinkle.com\/txxos\/?p=333"},"modified":"2021-04-17T18:23:32","modified_gmt":"2021-04-17T23:23:32","slug":"external-interrupt-routine","status":"publish","type":"post","link":"https:\/\/tommysprinkle.com\/txxos\/?p=333","title":{"rendered":"TXXEXTIR &#8211; External Interrupt Routine"},"content":{"rendered":"<p>The External Interrupt Routine is called from the first level Ext Interrupt handler in low memory when an external interrupt occurs.<\/p>\n<pre>000000                                8 TXXEXTIR CSECT ,\r\n000000 18CF                           9          LR    R12,R15\r\n                            00000    10          USING TXXEXTIR,R12                BASE REG\r\n                                     11 *\r\n                            00000    12          USING @TCB,R4\r\n                                     13 *\r\n000002 9180 401B      0001B          14          TM    TCBPSW+3,X'80'     TIMER INTERRUPT ?\r\n000006 4710 C016      00016          15          BO    TIMER              YES - BRANCH\r\n                                     16 *\r\n00000A 9140 401B      0001B          17          TM    TCBPSW+3,X'40'     EXT KEY PRESSED ?\r\n00000E 4710 C026      00026          18          BO    EXTKEY             YES - BRANCH\r\n                                     19 *\r\n000012 8200 C038      00038          20          LPSW  EXTWPSW            GO INTO WAIT STATE<\/pre>\n<p>We begin by examining the PSW to determine what type of external interruption\u00a0occurred. \u00a0The two conditions we are interested in are the Interval Timer expired and an operator generated interruption. \u00a0If neither of these types of interruptions is indicated a wait state PSW is loaded.<\/p>\n<pre>000016                               26 TIMER    DS    0H\r\n000016 5810 C040      00040          27          L     R1,=A(X'80')       RESTART TIMER\r\n00001A 5010 0050      00050          28          ST    R1,ITIMER-@LOWCORE\r\n                                     29 *\r\n00001E 9610 4004      00004          30          OI    TCBFLGS,X'10'      INDICATE TIME EXPIRED\r\n000022 47F0 C02A      0002A          31          B     EXIT               AND EXIT<\/pre>\n<p>If the interruption is the result of the Interval Timer expiring then it means the executing task is hogging the CPU. \u00a0We set a bit in the TCB flags indicating the task was interrupted by the timer. \u00a0This will cause the task to not be dispatched until all other tasks have been given the opportunity to run.<\/p>\n<pre>000026                               37 EXTKEY   DS    0H\r\n000026 47F0 C02A      0002A          38          B     EXIT               IGNORE FOR NOW \r\n\r\n00002A                               44 EXIT     DS    0H\r\n00002A 58F0 0014      00014          45          L     R15,20             GET CVT ADDRESS\r\n00002E 58F0 F004      00004          46          L     R15,MVTDISP-@MVT(,R15)   GET DISPATCHER EP\r\n000032 07FF                          47          BR    R15                      BRANCH TO DISPATCHER\r\n\r\n000038                               51          DS    0D\r\n000038 0002000000EE0002              52 EXTWPSW  DC    AL1(0,2,0,0),A(@E@EXT)  DISABLED WAIT PSW<\/pre>\n<p>For now we will just ignore an external interrupt caused by the operator. \u00a0Exit is simply branching to the Dispatcher routine.<\/p>\n<p>[Next &#8211; <a title=\"TXXDISP \u2013 Dispatcher Routine\" href=\"http:\/\/tommysprinkle.com\/txxos\/?p=336\">TXXDISP &#8211; Dispatcher Routine<\/a>]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The External Interrupt Routine is called from the first level Ext Interrupt handler in low memory when an external interrupt occurs. 000000 8 TXXEXTIR CSECT , 000000 18CF 9 LR R12,R15 00000 10 USING TXXEXTIR,R12 BASE REG 11 * 00000 &hellip; <a href=\"https:\/\/tommysprinkle.com\/txxos\/?p=333\">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-333","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1CPQT-5n","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=\/wp\/v2\/posts\/333","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=333"}],"version-history":[{"count":5,"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=\/wp\/v2\/posts\/333\/revisions"}],"predecessor-version":[{"id":484,"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=\/wp\/v2\/posts\/333\/revisions\/484"}],"wp:attachment":[{"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=333"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=333"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tommysprinkle.com\/txxos\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=333"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}