{"id":853,"date":"2019-12-05T13:33:12","date_gmt":"2019-12-05T12:33:12","guid":{"rendered":"http:\/\/bergatrollet.se\/blog\/?p=853"},"modified":"2019-12-05T13:34:49","modified_gmt":"2019-12-05T12:34:49","slug":"vice-logging","status":"publish","type":"post","link":"http:\/\/bergatrollet.se\/blog\/2019\/12\/vice-logging\/","title":{"rendered":"VICE logging"},"content":{"rendered":"\n<p>Yes, yes, yes &#8230;<\/p>\n\n\n\n<p>One of the features I missed the most is not in VICE, as per one of the most recent builds (one of the last builds before 3.3 becomes 3.4). Logging to file. Quite often when I make a version of a game, I need to record values. Especially games where the loader is fed with data that is not in a consistent table, you need to set a trap at each call of the loader and record the values. That&#8217;s tedious and error-prone.<\/p>\n\n\n\n<p>The new commands are <strong>logname<\/strong> and <strong>log on\/off<\/strong>.<\/p>\n\n\n\n<p>Logname is quite obvious &#8211; it sets the name of the textfile. I guess one could wish for an option to overwrite or append if the file already exists, but here I think it always overwrites.<\/p>\n\n\n\n<p>The next command is log on\/off and if it&#8217;s on, it simply copies the same content as sent to the screen also to the file set by the logname.<\/p>\n\n\n\n<p>So how to use this? Well, it&#8217;s here quite handy to also know a few other commands:<\/p>\n\n\n\n<p><strong>Break <\/strong>&#8211; triggers a break to the monitor window where the breakpoint address is executed.<\/p>\n\n\n\n<p><strong>Watch<\/strong> &#8211; triggers a break to the monitor where the address is read\/written to.<\/p>\n\n\n\n<p>These are basically the same command but break defaults to trigger on execution and watch defaults to read\/write, but if you give the arguments they can be the same. &#8220;Watch exec&#8221; is the same as break with no argument.<\/p>\n\n\n\n<p><strong>Trace<\/strong> &#8211;  triggers a break on all of the exec\/load\/store but doesn&#8217;t open the monitor window on the hit. It merely prints it to the console. With the new log, it can also print to file.<\/p>\n\n\n\n<p><strong>Command <\/strong>&#8211; The break\/watch\/trace points are allocated an index. Issuing Command &lt;index&gt; and a string, the command in the string is issued when the breakpoint latches. The index is incremented with every new one, but the counter is reset to 1 when you issue a <strong>delete<\/strong> to clear all points defined. I issue the delete in order to ensure that the index reference in the trace command is correct.<\/p>\n\n\n\n<p>As you can see in my example you can also stack commands using a semicolon, so a command can issue multiple commands.<\/p>\n\n\n\n<p>Exampe:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">logname \"my_log.txt\"\ndelete\ntrace exec cb00\ncommand 1 \"m ce44 ce45;m ce47 ce48;m cb20 cb21;m cb49 cb4a;m 67 68;chis 5\"\nlog on<\/pre>\n\n\n\n<p>The above silently triggers an execution on cb00 and then issues a stack of commands. <\/p>\n\n\n\n<p>Please mind that the file is written to, but you OS might buffer the writes so that the file isn&#8217;t updated until it&#8217;s closed.  Opening the monitor, you might need to do a &#8220;log off&#8221; to make that happen, or it might not happen before you close VICE.<\/p>\n\n\n\n<p>As a bonus, I could also add that in case you don&#8217;t feel like typing the commands multiple times, you can create command files. This is done using the <strong>record &#8220;&lt;filename&gt;&#8221;<\/strong> command. To execute it, you playback using <strong>pb&#8221;&lt;filename&gt;&#8221;<\/strong>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yes, yes, yes &#8230; One of the features I missed the most is not in VICE, as per one of the most recent builds (one of the last builds before 3.3 becomes 3.4). Logging to file. Quite often when I &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"http:\/\/bergatrollet.se\/blog\/2019\/12\/vice-logging\/\"> <span class=\"screen-reader-text\">VICE logging<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":857,"comment_status":"open","ping_status":"open","sticky":false,"template":"","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":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[88,3,113],"tags":[],"class_list":["post-853","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-88","category-code","category-vice"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/bergatrollet.se\/blog\/wp-content\/uploads\/2019\/12\/VICE.png?fit=875%2C604","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pkM6p-dL","jetpack_likes_enabled":true,"_links":{"self":[{"href":"http:\/\/bergatrollet.se\/blog\/wp-json\/wp\/v2\/posts\/853","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bergatrollet.se\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bergatrollet.se\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bergatrollet.se\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/bergatrollet.se\/blog\/wp-json\/wp\/v2\/comments?post=853"}],"version-history":[{"count":5,"href":"http:\/\/bergatrollet.se\/blog\/wp-json\/wp\/v2\/posts\/853\/revisions"}],"predecessor-version":[{"id":859,"href":"http:\/\/bergatrollet.se\/blog\/wp-json\/wp\/v2\/posts\/853\/revisions\/859"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/bergatrollet.se\/blog\/wp-json\/wp\/v2\/media\/857"}],"wp:attachment":[{"href":"http:\/\/bergatrollet.se\/blog\/wp-json\/wp\/v2\/media?parent=853"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bergatrollet.se\/blog\/wp-json\/wp\/v2\/categories?post=853"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bergatrollet.se\/blog\/wp-json\/wp\/v2\/tags?post=853"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}