{"id":1050,"date":"2011-05-17T19:50:00","date_gmt":"2011-05-17T10:50:00","guid":{"rendered":"http:\/\/mkusunoki.net\/?p=1050"},"modified":"2013-12-06T22:02:05","modified_gmt":"2013-12-06T13:02:05","slug":"%e3%83%8e%e3%83%aa%e3%82%bf%e3%82%b1%e4%bc%8a%e5%8b%a2%e9%9b%bb%e5%ad%90%e3%81%aevfd%e3%83%a2%e3%82%b8%e3%83%a5%e3%83%bc%e3%83%ab%e3%81%ab-powershell-%e3%81%8b%e3%82%89%e3%83%93%e3%83%83%e3%83%88","status":"publish","type":"post","link":"https:\/\/mkusunoki.net\/?p=1050","title":{"rendered":"\u30ce\u30ea\u30bf\u30b1\u4f0a\u52e2\u96fb\u5b50\u306eVFD\u30e2\u30b8\u30e5\u30fc\u30eb\u306b PowerShell \u304b\u3089\u30d3\u30c3\u30c8\u30de\u30c3\u30d7\u30d5\u30a1\u30a4\u30eb\u3092\u8868\u793a\u3057\u3066\u307f\u305f\u30c6\u30b9\u30c8"},"content":{"rendered":"<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\nfunction initializeVfd\r\n{\r\n    $a = &#x5B;byte]0x1b, &#x5B;byte]0x40\r\n    $serialPort.write($a, 0 ,$a.Length)\r\n}\r\n\r\nfunction clearVfd\r\n{\r\n    $serialPort.write( &#x5B;char]0x0c )\r\n}\r\n\r\nfunction displayCursorVfd\r\n{\r\n    $a = &#x5B;byte]0x1f, &#x5B;byte]0x43, &#x5B;byte]1\r\n    $serialPort.write($a,0,$a.Length)\r\n}\r\n\r\nfunction moveCursorVfd(&#x5B;int]$x, &#x5B;int]$y)\r\n{\r\n    $a = &#x5B;byte]0x1f, &#x5B;byte]0x24, &#x5B;byte]5, &#x5B;byte]0, &#x5B;byte]1, &#x5B;byte]0\r\n    $serialPort.write($a,0,$a.Length)\r\n\r\n}\r\n\r\nfunction drawBitmapVfd\r\n{\r\n    $a = &#x5B;byte]0x1f, &#x5B;byte]0x28, &#x5B;byte]0x66, &#x5B;byte]0x11, &#x5B;byte]128, &#x5B;byte]0, &#x5B;byte]8, &#x5B;byte]0, &#x5B;byte]1\r\n    $a.Length\r\n    $serialPort.Write($a, 0, $a.Length)\r\n    $serialPort.write($vfdimg, 0, $vfdimg.Length)\r\n}\r\n\r\n$serialPort = New-Object System.IO.Ports.SerialPort &quot;COM1&quot;, 38400\r\n$serialPort.Open()\r\ninitializeVfd\r\nclearVfd\r\ndisplayCursorVfd\r\n#moveCursorVfd\r\n$img = &#x5B;System.Drawing.Image]::FromFile(&quot;D:\\mkusunoki\\Documents\\i-tron128X64.bmp&quot;)\r\n$vfdimg = New-Object byte&#x5B;] ($img.Width * $img.Height \/ 8)\r\nfor($i = 0; $i -lt $img.Width; $i++)\r\n{\r\n    for($j = 0; $j -lt ($img.Height \/ 8); $j++)\r\n    {\r\n        $bb = 0\r\n        if($img.GetPixel($i, $j * 8).G -gt 127)\r\n        {\r\n            $bb = 1\r\n        }\r\n        $bb += $bb\r\n        if($img.GetPixel($i, $j * 8 + 1).G -gt 127)\r\n        {\r\n            $bb++\r\n        }\r\n        $bb += $bb\r\n        if($img.GetPixel($i, $j * 8 + 2).G -gt 127)\r\n        {\r\n            $bb++\r\n        }\r\n        $bb += $bb\r\n        if($img.GetPixel($i, $j * 8 + 3).G -gt 127)\r\n        {\r\n            $bb++\r\n        }\r\n        $bb += $bb\r\n        if($img.GetPixel($i, $j * 8 + 4).G -gt 127)\r\n        {\r\n            $bb++\r\n        }\r\n        $bb += $bb\r\n        if($img.GetPixel($i, $j * 8 + 5).G -gt 127)\r\n        {\r\n            $bb++\r\n        }\r\n        $bb += $bb\r\n        if($img.GetPixel($i, $j * 8 + 6).G -gt 127)\r\n        {\r\n            $bb++\r\n        }\r\n        $bb += $bb\r\n        if($img.GetPixel($i, $j * 8 + 7).G -gt 127)\r\n        {\r\n            $bb++\r\n        }\r\n        $vfdimg&#x5B;$i * ($img.Height \/ 8) + $j] = $bb\r\n    }\r\n}\r\ndrawBitmapVfd\r\n# $serialPort.Write(&quot;HHHHH&quot;)\r\n$serialPort.Close()\r\n$serialPort.Dispose()\r\n<\/pre>\n<p>\n\u3068\u3044\u3046\u3053\u3068\u3067\u3001128&#215;64\u30c9\u30c3\u30c8\u306e\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\u306b\u306a\u3093\u304b\u8868\u793a\u3057\u307e\u3057\u3087\u3046\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002\u3068\u308a\u3042\u3048\u305a\u3001\u4ed8\u5c5e\u306eCDROM \u306b\u5165\u3063\u3066\u3044\u305f\u30b5\u30f3\u30d7\u30eb\u306b i-tron128X64.bmp \u3068\u3044\u3046\u30d3\u30c3\u30c8\u30de\u30c3\u30d7\u30d5\u30a1\u30a4\u30eb\u304c\u3042\u3063\u305f\u306e\u3067\u3053\u308c\u3092\u8868\u793a\u3055\u305b\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002\n<\/p>\n<p>\n\u4eca\u56de\u306f Windows \u306e PowerShell \u3068\u3044\u3046\u3084\u3064\u3092\u4f7f\u3044\u307e\u3057\u3066\u3001\u30d3\u30c3\u30c8\u30de\u30c3\u30d7\u30d5\u30a1\u30a4\u30eb\u3092\u30ed\u30fc\u30c9\u3057\u3066\u3001\u30b7\u30ea\u30a2\u30eb\u30dd\u30fc\u30c8\u306b\u6295\u3052\u308b\u3068\u3044\u3046\u3082\u306e\u3067\u3059\u3002\u307e\u3060\u8a66\u884c\u932f\u8aa4\u4e2d\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30ce\u30fc\u30c8\u304b\u3089\u30ed\u30b8\u30c3\u30af\u4e38\u30d1\u30af\u3057\u305f\u30bd\u30fc\u30b9\u306f\u4ee5\u4e0b\u306b\u63b2\u8f09\u3057\u307e\u3059\u3002\u3042\u3068\u306f\u3001\u30d3\u30c3\u30c8\u30de\u30c3\u30d7\u30aa\u30b8\u30a7\u30af\u30c8\u3092\u3044\u3058\u308c\u3070\u6f22\u5b57\u3060\u308d\u3046\u304c\u4f55\u3060\u308d\u3046\u304c\u63cf\u753b\u51fa\u6765\u308b\u306e\u3067\u5c11\u3057\u3060\u3051\u524d\u306b\u9032\u3093\u3060\u304b\u306a\uff1f\n<\/p>\n<p><a rel=\"attachment wp-att-1049\" href=\"http:\/\/mkusunoki.net\/?attachment_id=1049\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"680\" class=\"alignnone size-medium wp-image-1049\" title=\"DSC_0586\" src=\"http:\/\/mkusunoki.net\/wp\/wp-content\/uploads\/2011\/05\/DSC_0586-1024x680.jpg\" alt=\"\" srcset=\"https:\/\/mkusunoki.net\/wp\/wp-content\/uploads\/2011\/05\/DSC_0586-1024x680.jpg 1024w, https:\/\/mkusunoki.net\/wp\/wp-content\/uploads\/2011\/05\/DSC_0586-320x212.jpg 320w, https:\/\/mkusunoki.net\/wp\/wp-content\/uploads\/2011\/05\/DSC_0586.jpg 1280w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>function initializeVfd { $a = &#x5B;byte]0x1b, &#x5B;byte]0x40 $serialPort.write($a, 0 ,$a.Length) } function  &hellip; <a href=\"https:\/\/mkusunoki.net\/?p=1050\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;\u30ce\u30ea\u30bf\u30b1\u4f0a\u52e2\u96fb\u5b50\u306eVFD\u30e2\u30b8\u30e5\u30fc\u30eb\u306b PowerShell \u304b\u3089\u30d3\u30c3\u30c8\u30de\u30c3\u30d7\u30d5\u30a1\u30a4\u30eb\u3092\u8868\u793a\u3057\u3066\u307f\u305f\u30c6\u30b9\u30c8&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[54,7],"tags":[84,58,61],"class_list":["post-1050","post","type-post","status-publish","format-standard","hentry","category-pc","category-kousaku","tag-powershell","tag-vfd","tag-61"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/mkusunoki.net\/index.php?rest_route=\/wp\/v2\/posts\/1050","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mkusunoki.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mkusunoki.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mkusunoki.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mkusunoki.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1050"}],"version-history":[{"count":0,"href":"https:\/\/mkusunoki.net\/index.php?rest_route=\/wp\/v2\/posts\/1050\/revisions"}],"wp:attachment":[{"href":"https:\/\/mkusunoki.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1050"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mkusunoki.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1050"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mkusunoki.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1050"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}