{"id":75,"date":"2024-01-04T15:17:49","date_gmt":"2024-01-04T14:17:49","guid":{"rendered":"https:\/\/techblog.dansbo.dk\/?page_id=75"},"modified":"2024-01-04T15:17:49","modified_gmt":"2024-01-04T14:17:49","slug":"programming-ramblings","status":"publish","type":"page","link":"https:\/\/techblog.dansbo.dk\/?page_id=75","title":{"rendered":"Programming Ramblings"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">C#<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code><font color=\"lightgreen\">\/\/ Calculate md5sum of file (like linux md5sum command)<\/font>\n<font color=\"red\">string<\/font> md5sum(<font color=\"red\">string<\/font> filename) {\n\tusing (var md5 = System.Security.Cryptography.<font color=\"blue\">MD5<\/font>.<b>Create<\/b>()) {\n\t\tusing (var stream = System.IO.<font color=\"blue\">File<\/font>.<b>OpenRead<\/b>(filename)) {\n\t\t\t<font color=\"blue\">return<\/font> System.<font color=\"blue\">BitConverter<\/font>.<b>ToString<\/b>(md5.<b>ComputeHash<\/b>(stream)).<b>Replace<\/b>(<font color=\"blue\">\"-\"<\/font>,<font color=\"blue\">\"\"<\/font>).<b>ToLower<\/b>();\n\t\t}\n\t}\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Using the KERNAL API PLOT subroutine in BASIC on C64 or CX16<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>5 PRINT CHR$(147):        REM CLEAR SCREEN\n10 POKE $030D,10:         REM SET Y COORDINATE TO 10\n20 POKE $030E,50:         REM SET X COORDINATE TO 50\n30 SYS $FFF0:             REM CALL API PLOT ROUTINE\n40 X=PEEK($030D):         REM READ Y COORDINATE\n50 Y=PEEK($030E):         REM READ X COORDINATE\n60 PRINT \"REG X=\"X:       REM PRINT CONTENT OF X REG\n70 PRINT \"REG Y=\"Y:       REM PRINT CONTENT OF Y REG\n\n80 FLAGS=PEEK($030F):     REM READ FLAGS REGISTER\n90 FLAGS=FLAGS OR 1:      REM SET CARRY FLAG\n100 PRINT FLAGS:          REM PRINT CONTENT OF FLAGS\n110 POKE $030F,FLAGS:     REM WRITE FLAGS TO REGISTER\n120 SYS $FFF0:            REM CALL API PLOT ROUTINE\n130 X=PEEK($030D):        REM READ Y COORDINATE\n140 Y=PEEK($030E):        REM READ X COORDINATE\n150 PRINT \"REG X=\"X:      REM PRINT CONTENT OF X REG\n160 PRINT \"REG Y=\"Y:      REM PRINT CONTENT OF Y REG\n165 REM\n170 REM CONTENT OF FLAGS REGISTER TAKEN FROM\n180 REM W65C02S DATASHEET\n190 REM  BIT  DESCRIPTION\n200 REM  ------------------------------ \n210 REM   0  -  CARRY\n220 REM   1  -  ZERO\n230 REM   2  -  IRQB DISABLE\n240 REM   3  -  DECIMAL MODE\n250 REM   4  -  BRK COMMAND\n260 REM   5  -  OPTIONAL FLAG FOR USER\n270 REM   6  -  OVERFLOW\n280 REM   7  -  NEGATIVE\n290 LIST<\/code><\/pre>\n\n\n\n<p>Test the code\u00a0<a href=\"https:\/\/x16.io\/SNkNfjM\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Line to scroll on, CX16<\/h2>\n\n\n\n<p>On the Commander X16 and on the Commodore 64, it is not possible to write to the bottom right corner of the screen without having the entire screen scroll one line up. On the CX16 this can be solved by incrementing the value in\u00a0<s>$DA<\/s>\u00a0<s>$02AF<\/s>\u00a0$387. Normally the value in\u00a0<s>$DA<\/s>\u00a0<s>$02AF<\/s>\u00a0$387 is the number of lines shown on the screen so 30 for 40\u00d730 mode and 60 for 80\u00d760 mode. This means that if the value is incremented by 1, the screen will not scroll on the right most byte of line 30 (or 60) but instead scroll one line below that. Note:\u00a0<s>$02AE<\/s>\u00a0$386 contains the number of columns.<\/p>\n\n\n\n<p>When the ROM of the Commander X16 is compiled, it also provides .sym files that describe all the memory addresses used by the ROM. You can find above values in kernal.sym, the names are .llen ($386) and .nlines ($387)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>C# Using the KERNAL API PLOT subroutine in BASIC on C64 or CX16 Test the code\u00a0here Line to scroll on, CX16 On the Commander X16 and on the Commodore 64,&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-75","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/techblog.dansbo.dk\/index.php?rest_route=\/wp\/v2\/pages\/75","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techblog.dansbo.dk\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/techblog.dansbo.dk\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/techblog.dansbo.dk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techblog.dansbo.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=75"}],"version-history":[{"count":1,"href":"https:\/\/techblog.dansbo.dk\/index.php?rest_route=\/wp\/v2\/pages\/75\/revisions"}],"predecessor-version":[{"id":76,"href":"https:\/\/techblog.dansbo.dk\/index.php?rest_route=\/wp\/v2\/pages\/75\/revisions\/76"}],"wp:attachment":[{"href":"https:\/\/techblog.dansbo.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=75"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}