{"id":2079,"date":"2025-09-05T11:08:07","date_gmt":"2025-09-05T09:08:07","guid":{"rendered":"https:\/\/pockemul.com\/?p=2079"},"modified":"2025-09-05T11:08:40","modified_gmt":"2025-09-05T09:08:40","slug":"an-sc61860-bug-since-25-years","status":"publish","type":"post","link":"https:\/\/pockemul.com\/index.php\/2025\/09\/05\/an-sc61860-bug-since-25-years\/","title":{"rendered":"An SC61860 bug since 25 years"},"content":{"rendered":"\n<p>Incredible \u2014 a bug in the SC61860 CPU used in classic Sharp devices has been fixed after 25 years! <\/p>\n\n\n\n<p>Usually, a CPU bug is spotted quickly because everything crashes. But this one was a subtle side effect in batch instruction processing. <\/p>\n\n\n\n<p>When I requested a batch of 0xFF, the loop exited without doing anything, instead of executing 256 times. <\/p>\n\n\n\n<p>Turns out, it was just a while () {} that needed to be replaced with a do {} while ().<\/p>\n\n\n\n<p> Now, the LC-3 compiler works correctly \u2014 it&#8217;s the one that uses 0xFF batches, unlike the standard ROM which never does. <\/p>\n\n\n\n<p>It took me ages to find this bug, I was so convinced my algorithm was solid. obviously, after 25 years of faithful service&#8230;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/pockemul.com\/?attachment_id=2080\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"564\" src=\"https:\/\/pockemul.com\/wp-content\/uploads\/2025\/09\/lc3_joy.gif\" alt=\"\" class=\"wp-image-2080\"\/><\/a><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Incredible \u2014 a bug in the SC61860 CPU used in classic Sharp devices has been fixed after 25 years! Usually, a CPU bug is spotted quickly because everything crashes. But this one was a subtle side effect in batch instruction processing. When I requested a batch of 0xFF, the loop exited without doing anything, instead &hellip; <a href=\"https:\/\/pockemul.com\/index.php\/2025\/09\/05\/an-sc61860-bug-since-25-years\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;An SC61860 bug since 25 years&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[53,54,29,32],"tags":[],"class_list":["post-2079","post","type-post","status-publish","format-standard","hentry","category-pc-1261","category-pc-1262","category-pockemullite","category-sharp"],"_links":{"self":[{"href":"https:\/\/pockemul.com\/index.php\/wp-json\/wp\/v2\/posts\/2079"}],"collection":[{"href":"https:\/\/pockemul.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pockemul.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pockemul.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/pockemul.com\/index.php\/wp-json\/wp\/v2\/comments?post=2079"}],"version-history":[{"count":1,"href":"https:\/\/pockemul.com\/index.php\/wp-json\/wp\/v2\/posts\/2079\/revisions"}],"predecessor-version":[{"id":2081,"href":"https:\/\/pockemul.com\/index.php\/wp-json\/wp\/v2\/posts\/2079\/revisions\/2081"}],"wp:attachment":[{"href":"https:\/\/pockemul.com\/index.php\/wp-json\/wp\/v2\/media?parent=2079"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pockemul.com\/index.php\/wp-json\/wp\/v2\/categories?post=2079"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pockemul.com\/index.php\/wp-json\/wp\/v2\/tags?post=2079"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}