prt0.as 977 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. .text
  2. .align 4
  3. .globl _start
  4. .globl start
  5. _start:
  6. start:
  7. | Save stack pointer for exit() routine
  8. movel sp,STKPTR | save stack pointer
  9. | This was wrong compared to PCQ
  10. | addl #4,STKPTR | account for this jsr to get to original
  11. | Save the command line pointer to CommandLine
  12. movel a0,__ARGS
  13. beq .Ldont_nullit
  14. | Remove $0a character from end of string
  15. movew d0,d1
  16. subqw #1,d1
  17. cmpb #0x0a,a0@(0,d1:w)
  18. bne .Lcontt
  19. | Decrement count by one to remove the $0a character
  20. movew d1,d0
  21. .Lcontt:
  22. moveb #0,a0@(0,d0:w) | null terminate it
  23. movew d0,__ARGC
  24. .Ldont_nullit:
  25. jsr PASCALMAIN
  26. movel STKPTR,sp
  27. rts
  28. .data
  29. .align 4
  30. .globl __ARGS
  31. __ARGS: | pointer to the arguments
  32. .long 0
  33. .globl __ARGC
  34. __ARGC: | number of arguments
  35. .word 0
  36. .globl STKPTR | Used to terminate the program, initial SP
  37. STKPTR:
  38. .long 0