LCC Assembly — Syntax Highlighting

Four curated samples highlighted with the custom TextMate grammar (docs/lcc.tmLanguage.json) via Shiki. Grammar covers core LCC and LCC+ instruction sets.

demos/demoA.a Hello register — mov, dout, halt
; demoA.a: simple program assembly/execution and test input/output caching
    mov r0, 5
    dout r0
    nl
    halt
demos/demoO.a I/O with labels and directives
; demoO.a: program that tests IO and LST generation thoroughly
            lea r0, prompt
            sout r0
            lea r0, buffer
            sin r0
            lea r1, hi
            sout r1
            sout r0
            nl
            m
            halt
prompt:     .string "Name: "
hi:         .string "Hi "
buffer:     .zero 10
demos/demoN.a Division-by-zero trap
; demo program that tests the detection of division by zero
    mov r0, 3
    mov r1, 0
    div r0, r1
    dout r0
    nl
    halt
plusdemos/charTypewriter.ap LCC+ — clear, sleep, aout loop
; plusB.ap: clear and sleep
; This program prints out the letters 'a' through 'f'
; in the terminal 'typewriter' style
     .lccplus
      clear ; clears the screen of anything else that was in the terminal
      ld r1, onesecond ; load 1000 into r1 to represent milliseconds
      mov r0, 'a' ; our initialized 'current char' to print goes into r0
      mov r2, 'f' ; this is our 'terminal char'
loop: cmp r0, r2 ; check to see how the current compares with the terminal
      brgt done ; if the current is greater than the terminal, branch to done label
      aout r0 ; print the current char
      sleep r1 ; pause for 1 second
      add r0, r0, 1 ; increment the char
      br loop ; go back to the loop label
done: nl
      halt ; end the program

onesecond: .word 1000