BenBE's humble thoughts Thoughts the world doesn't need yet …


Spaß mit Wahlplakaten

Filed under: Fun — BenBE @ 21:06:02

Da ja demnächst Wahlen in Schleswig-Holstein sind, versuchen alle Parteien mit verschiedensten Themen die Gunst der Wähler zu gewinnen. Zum Verbessern des Wahlprogramms läd hierbei insbesondere die Linke ein, deren originalen Plakate nicht allzu viel hermachen:

Diese Plakate wirken zum einen sehr lustlos und zum anderen ist da wenig Originalität zu sehen. Und da man da ja mal nicht so ist, hilft man halt mit ein paar Vorschlägen aus. (more…)

Flattr this!

DCPU-16 highlighting

Filed under: GeSHi — Schlagwörter: , , , — BenBE @ 00:55:54

Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /var/www/virtual/ on line 380

Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /var/www/virtual/ on line 380

Not quite 0x0001 0000 0000 0000 years since the last post in this category but still long enough to justify emitting a new sign that there’s still some developement going on with GeSHi. And it’s quite a coincidence that Markus „Notch“ Persson is taking over GitHub with its own new language now being highlighted. And since most assembly languages are quite easy to highlight it’s only natural to add support for highlighting of this new language for GeSHi.

So there it is: After only about 10 minutes looking at the language specs the basic structure looked simple enough and since GeSHi already supported a bunch of different assembly languages it’s only natural to use another one of them as the template. In this case I decided go for Z80 assembly as the ZiLOG Z80 instruction set is quite simple and still the language file was elaborate enough to support all the features required by Notch’s new assembly language. Actually: I even could remove some features not required to properly highlight DCPU-16.

After a short clean-up of the language file – removing all the old instructions, registers and directives – it took only few more steps to fill in the list of supported instructions: In the case of the DCPU-16 instruction set this is a quite small set of only 16 instructions, 11 registers and 3 „memory shortcuts“. Thus there was not that much to copy from the specs, althoug the example given there looks quite nice when rendered with this new language file:

; Try some basic stuff
              SET A, 0x30              ; 7c01 0030
              SET [0x1000], 0x20       ; 7de1 1000 0020
              SUB A, [0x1000]          ; 7803 1000
              IFN A, 0x10              ; c00d 
                 SET PC, crash         ; 7dc1 001a [*]
; Do a loopy thing
              SET I, 10                ; a861
              SET A, 0x2000            ; 7c01 2000
:loop         SET [0x2000+I], [A]      ; 2161 2000
              SUB I, 1                 ; 8463
              IFN I, 0                 ; 806d
                 SET PC, loop          ; 7dc1 000d [*]
; Call a subroutine
              SET X, 0x4               ; 9031
              JSR testsub              ; 7c10 0018 [*]
              SET PC, crash            ; 7dc1 001a [*]

There were no major problems, except for some trouble with two regular expressions which broke rendering; but since those weren’t needed I could just simply remove them.

If you like to try out the language file for yourself just visit the main GeSHi site or grab a copy of the language file directly from the SVN trunk.

Flattr this!

Powered by WordPress