ss.S 629 B

123456789101112131415161718192021222324252627282930
  1. #include "common.h"
  2. BEGIN
  3. /* Save the good sp for later. */
  4. mov %sp, %bx
  5. /* Control group: ss == 0. */
  6. mov $stack, %sp
  7. pop %ax
  8. /* Restore the old stack so that it won't mess with our other functions. */
  9. mov %bx, %sp
  10. PRINT_HEX <%al>
  11. /* Now let's move ss and see if anything happens. */
  12. mov $1, %ax
  13. mov %ax, %ss
  14. mov $stack, %sp
  15. /* This pop should happen 16 bytes higher than the first one. */
  16. pop %ax
  17. mov %bx, %sp
  18. PRINT_HEX <%al>
  19. hlt
  20. stack:
  21. .word 1
  22. /* 2 bytes from the word above + 14 = 16 */
  23. .skip 14
  24. /* This is at stack0 + 16 */
  25. .word 2