picolisp

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/picolisp.git/
Log | Files | Refs | README | LICENSE

fmt.s.l (742B)


      1 # 03aug12abu
      2 # (c) Software Lab. Alexander Burger
      3 
      4 (de newSection (Sym)
      5    (unless (== *Section Sym)
      6       (prinl)
      7       (prinl "   ." (setq *Section Sym)) )
      8    (prinl) )
      9 
     10 # Print instruction
     11 (de prinst (Name . @)
     12    (if (rest)
     13       (tab (3 -9 0) NIL Name (glue ", " @))
     14       (tab (3 -9) NIL Name) ) )
     15 
     16 # Directives
     17 (de label (Lbl Flg)
     18    (and Flg (prinl "   .globl  " Lbl))
     19    (prinl Lbl ':) )
     20 
     21 (asm word (N)
     22    (prinst ".quad" N) )
     23 
     24 (asm byte (N)
     25    (prinst ".byte" N) )
     26 
     27 (asm bytes (Lst)
     28    (prinst ".byte" (glue ", " Lst)) )
     29 
     30 (asm hx2 (Lst)
     31    (prinst ".short" (glue ", " (mapcar hex Lst))) )
     32 
     33 (asm ascii (Str)
     34    (prinst ".ascii" (pack "\"" Str "\"")) )
     35 
     36 (asm asciz (Str)
     37    (prinst ".asciz" (pack "\"" Str "\"")) )
     38 
     39 # vi:et:ts=3:sw=3