testutils.inc 819 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # MACRO: exit
  2. .macro exit nr
  3. movi r2, \nr
  4. # The exit utility function.
  5. .byte 0x00
  6. # The debug insn class.
  7. .byte 0x50
  8. .endm
  9. # MACRO: pass
  10. # Write 'pass' to stdout and quit
  11. .macro pass
  12. # Trap function 4: write().
  13. movi r1, 4;
  14. # Use stdout.
  15. movi r2, 1;
  16. # Point to the string.
  17. lrw r3, 1f;
  18. # Number of bytes to write.
  19. movi r4, 5;
  20. # Trigger OS trap.
  21. trap 1;
  22. exit 0
  23. .data
  24. 1: .asciz "pass\n"
  25. .endm
  26. # MACRO: fail
  27. # Write 'fail' to stdout and quit
  28. .macro fail
  29. # Trap function 4: write().
  30. movi r1, 4;
  31. # Use stdout.
  32. movi r2, 1;
  33. # Point to the string.
  34. lrw r3, 1f;
  35. # Number of bytes to write.
  36. movi r4, 5;
  37. # Trigger OS trap.
  38. trap 1;
  39. exit 1
  40. .data
  41. 1: .asciz "fail\n"
  42. .endm
  43. # MACRO: start
  44. # All assembler tests should start with a call to "start"
  45. .macro start
  46. .text
  47. .global _start
  48. _start:
  49. .endm