lli

A small emulated asm like lang
Log | Files | Refs

fs.ll (471B)


      1 (unix core) |0x0 @stdin |0x1 @stdout |0x2 @stderr |0x3 @syscall |0x4 @arg1 |0x8 @arg2 |0xc @arg3 |0x10 @arg4 |0x14 @result |0x18 @fd |0x1c @read |0x1d @write
      2 
      3 |0x100 @file "test.txt b0
      4 
      5 (main) |0x1000
      6 &file &arg1 storei 		(load the address of file name)
      7 #1 &arg2 storei			(load the open mode)
      8 #1 i2b &syscall storeb		(open the file)
      9 
     10 &result loadi			(move the fd to the fd register)
     11 &fd storei
     12 
     13 #65 i2b &write storeb
     14 
     15 &fd loadi 
     16 &arg1 storei
     17 #2 i2b &syscall storeb
     18 
     19 halt