op_test.ds 699 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. ; This test tries to figure out a couple of unknown opcodes.
  2. incdir "tests"
  3. include "dsp_base.inc"
  4. // 0x02ca is an unknown opcode found in Zelda ucodes.
  5. // 0x02ca logically shifts (not rotates) the whole ACC0 right by signed 16-bit value AC1.M
  6. // (So, if AC1.M is negative, it shifts left).
  7. // We'll call it lsrn, no arguments.
  8. // 0x02cb is the same opcode, but arithmetic.
  9. // We'll call it asrn, no arguments.
  10. test_main:
  11. clr $ACC0
  12. clr $ACC1
  13. lri $AC0.H, #0
  14. lri $AC0.M, #256
  15. //neg $ACC0
  16. lri $AC0.L, #1
  17. lri $AC1.H, #0xFF
  18. lri $AC1.M, #1
  19. lri $AC1.L, #0xFF
  20. call send_back
  21. cw 0x02ca
  22. call send_back
  23. cw 0x02ca
  24. call send_back
  25. cw 0x02ca
  26. call send_back
  27. cw 0x02ca
  28. call send_back
  29. jmp end_of_test