{"id":7,"date":"2008-07-07T19:12:55","date_gmt":"2008-07-07T23:12:55","guid":{"rendered":"http:\/\/www.joshmatthews.net\/blog\/?p=7"},"modified":"2010-01-14T06:14:58","modified_gmt":"2010-01-14T10:14:58","slug":"megazeux-debugging","status":"publish","type":"post","link":"https:\/\/www.joshmatthews.net\/blog\/2008\/07\/megazeux-debugging\/","title":{"rendered":"MegaZeux Debugging"},"content":{"rendered":"<p>I&#8217;m an occasional contributor to the <a href=\"http:\/\/www.sourceforge.net\/projects\/megazeux\/\">MegaZeux<\/a> source code, and I frequently compete in the bi-annual <a href=\"http:\/\/doz.digitalmzx.net\">Day of Zeux<\/a> competions.\u00a0 Accordingly, I&#8217;m always interested in new ways to push MegaZeux forward and help people create games easier, which brings me to <a href=\"http:\/\/www.kvance.com\">Kev Vance<\/a>&#8216;s <a href=\"http:\/\/kvance.com\/project\/mzxdbg\/\">MegaZeux debugger<\/a>.\u00a0 It&#8217;s ten years old and based on the ancient 2.51 codebase, which means that the released code is not much good (2.7 was a near complete rewrite, if I recall correctly), but it&#8217;s got me thinking about how a debugger could integrate into the modern incarnation of mzx.\u00a0 So much so that I&#8217;ve got a prototype in the works (and a corresponding <a href=\"http:\/\/www.joshmatthews.net\/bzr\/megazeux\/robodebugger\">bzr repository<\/a>), and some thoughts to put down on paper.<\/p>\n<p>I forsee a debugger in MegaZeux as being useful in the following ways:<\/p>\n<ul>\n<li>Tracing code execution in a single robot<\/li>\n<li>Placing breakpoints in robotic code<\/li>\n<li>Verifying expected values at different points in the program<\/li>\n<\/ul>\n<p>The third is already possible with the F11 window that was added recently, which displays all known counters for easy perusal.\u00a0 Combined with instruction stepping, a debugger will hopefully remove the need for debug variable output lines in order to determine when a counter&#8217;s value changes.<\/p>\n<p>The vision of the robotic debugger I have is a shortened robotic editor that takes up half the screen.\u00a0 This displays the watched robot&#8217;s program with the current line highlighted.\u00a0 F9 will single step forwards in the current robot, F10 continues the normal execution until\/unless a breakpoint is reached (in any robot).\u00a0 Pressing CTR+F6 will bring up the debugger interface, and a window to select the robot to watch, at which point all execution will cease until the user presses either F9 or F10.<\/p>\n<p>That&#8217;s the gist of it right now.\u00a0 I currently have the shortened editor displaying the watched robot code, but only the global robot can be watched right now, and the code display doesn&#8217;t actually show which line is about to be executed.\u00a0 If you bring up the debugger, all robot execution stops, and pressing F9 will trigger one line of code to be executed in the global robot, and F10 will make everything resume as normal.<\/p>\n<p>Now, a brain dump of problems that I need to consider, in no particular order:<\/p>\n<ul>\n<li>Remove the ability for the player to move when single stepping?<\/li>\n<li>In fact, currently the rest of the board is updated as usual while the debugger is active, so bullets will continue to move normally even when the user is single stepping a robot, so something has to change there.<\/li>\n<\/ul>\n<p>I&#8217;m positive there are going to be more concerns I&#8217;ll have to deal with, but I&#8217;m pleased with the progress I&#8217;ve made so far.\u00a0 Next step: make the debugger show the actual line being executed.\u00a0 Then it might start being useful!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m an occasional contributor to the MegaZeux source code, and I frequently compete in the bi-annual Day of Zeux competions.\u00a0 Accordingly, I&#8217;m always interested in new ways to push MegaZeux forward and help people create games easier, which brings me &hellip; <a href=\"https:\/\/www.joshmatthews.net\/blog\/2008\/07\/megazeux-debugging\/\">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":"","format":"standard","meta":{"footnotes":""},"categories":[23,22],"tags":[8,6,7],"class_list":["post-7","post","type-post","status-publish","format-standard","hentry","category-megazeux","category-projects","tag-debugging","tag-dev","tag-megazeux"],"_links":{"self":[{"href":"https:\/\/www.joshmatthews.net\/blog\/wp-json\/wp\/v2\/posts\/7","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.joshmatthews.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.joshmatthews.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.joshmatthews.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.joshmatthews.net\/blog\/wp-json\/wp\/v2\/comments?post=7"}],"version-history":[{"count":1,"href":"https:\/\/www.joshmatthews.net\/blog\/wp-json\/wp\/v2\/posts\/7\/revisions"}],"predecessor-version":[{"id":33,"href":"https:\/\/www.joshmatthews.net\/blog\/wp-json\/wp\/v2\/posts\/7\/revisions\/33"}],"wp:attachment":[{"href":"https:\/\/www.joshmatthews.net\/blog\/wp-json\/wp\/v2\/media?parent=7"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.joshmatthews.net\/blog\/wp-json\/wp\/v2\/categories?post=7"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.joshmatthews.net\/blog\/wp-json\/wp\/v2\/tags?post=7"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}