prf.s 645 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. .define prf
  2. .sect .text
  3. .sect .rom
  4. .sect .data
  5. .sect .bss
  6. .sect .text
  7. prf:
  8. ld R0, hol0+4 !pointer to filename
  9. cp R0, $0
  10. jr EQ, 1f
  11. ld R2, R0
  12. ld R1, $40
  13. 3: !test filename on bad characters
  14. ldb R3, 0(R2)
  15. cpb R3, $0
  16. jr EQ, 2f
  17. cpb R3, $0177
  18. jr GE, 1f
  19. cpb R3, $040
  20. jr LT, 1f
  21. inc R2
  22. djnz R1, 3b
  23. clrb 0(R2)
  24. 2: push *RR14, hol0
  25. ld R1, R15
  26. push *RR14, R1
  27. push *RR14, R0
  28. push *RR14, $fmt1
  29. calr printf
  30. popl saveprf, *RR14 !return address
  31. calr printf !because of call from 'noop'
  32. pushl *RR14, saveprf
  33. ret
  34. 1: ld R0, $name
  35. jr 2b
  36. .sect .data
  37. fmt1: .asciz "%s, sp = %x, line %d:\n"
  38. name: .asciz "_unknown file_"
  39. saveprf:
  40. .data4 0