MMBC

Syntax

Nov 22nd, 2017
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. // This is a comment
  2. // all of this is pretty similar to C
  3. // Variable declaration
  4. int myvar = 0
  5. // function call
  6. foo(arg1, arg2)
  7.  
  8. // if statement
  9. // one instruction
  10. if x == y
  11. z = x
  12.  
  13. // multiple instructions
  14. if x == y
  15. then
  16. z = x
  17. x -= 2
  18. endif
  19.  
  20. // loops : while ... endwhile for ... endfor loop ... endloop (with this loop, you need to use the breakloop instruction to exit the loop)
  21.  
  22. // add a module (kind of lib)
  23. use module_name
  24.  
  25. // add a asm lib
  26. asmlib "file.asm"
  27.  
  28. // inline asm
  29. asm {
  30. or a, a
  31. sbc hl, hl
  32. }
  33.  
  34. // return instruction
  35. return
  36.  
  37. // variables type (I may add more in the future)
  38. int // 24 bits signed integer
  39. int16 // 16 bits signed integer
  40. int8 // 8 bits signed integer
  41. uint // 24 bits unsigned integer
  42. uint16 // 16 bits unsigned integer
  43. uint8 // 8 bits unsigned integer
  44. f16 // 8-16 fixed point type
  45. f8 // 8-8 fixed point type
  46. d16 // 16-16 fixed point type
  47.  
  48. // there's also functions, but i'm still not sure about the syntax, so i won't put it here
  49.  
  50. // eXtended Instruction Set
  51. // these are like the asm instructions, with more possibilities
  52. // there's a lot of them, so this is only a part of them
  53. __xis_add dest, op1, op2
  54. __xis_sml dest, op1, op2
  55. __xis_mov dest, src // this one is like ld, but with more possibilities for dest and src
  56. // to use a register in the xis instructions, just prefix them with % (e.g. %hl )
  57.  
  58. // I think that's a good start, i'll add more stuff
Advertisement
Add Comment
Please, Sign In to add comment