about summary refs log tree commit diff stats
ModeNameSize
-rw-r--r--.gitignore4log stats plain blame
-rw-r--r--COPYRIGHT.md1508log stats plain blame
-rw-r--r--HISTORY7907log stats plain blame
-rw-r--r--INSTALL3868log stats plain blame
-rw-r--r--Makefile3695log stats plain blame
-rw-r--r--README.md6427log stats plain blame
-rw-r--r--counter.teliva573log stats plain blame
d---------doc484log stats plain
d---------etc353log stats plain
-rw-r--r--hanoi.lua2109log stats plain blame
-rw-r--r--hanoi.teliva2050log stats plain blame
d---------src2128log stats plain
d---------test749log stats plain
t .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
## read a character from stdin, save it to a global, write it to stdout

# variables are always references
#   read their address with their names: x (can't write to their address)
#   read/write their contents with a lookup: *x
var x : char

fn main [
  call read 0/stdin, x, 1/size
  result/EAX <- call write 1/stdout, x, 1/size
  call exit, result/EAX
]

fn read fd : int, x : (address array byte), size : int [
  EBX <- copy fd
  ECX <- copy x
  EDX <- copy size
  EAX <- copy 3/read
  syscall
]

fn write fd : int, x : (address array byte), size : int [
  EBX <- copy fd
  ECX <- copy x
  EDX <- copy size
  EAX <- copy 4/write
  syscall
]

fn exit x : int [
  code/EBX <- copy x
  code/EAX <- copy 1/exit
  syscall
]