relax-direct.s 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. ;;; Test 68HC11 linker relaxation from extended addressing to direct
  2. ;;; addressing modes
  3. ;;;
  4. .sect .text
  5. .globl _start
  6. _start:
  7. start:
  8. lds stack
  9. ldd _bar
  10. beq F1
  11. beq F2
  12. std _bar
  13. jsr _bar
  14. F1:
  15. addd _toto
  16. bne start
  17. ;; All the following instructions will be relaxed and win 1 byte
  18. ;; for each.
  19. addd _toto+200
  20. addd stack+256-20
  21. adca _table+2
  22. adcb _table+3
  23. adda _table+4
  24. addb _table+5
  25. addd _table+6
  26. anda _table+7
  27. andb _table+8
  28. cmpa _table+9
  29. cmpb _table+10
  30. cpd _table+11
  31. cpx _table+12
  32. cpy _table+13
  33. eora _table+14
  34. eorb _table+15
  35. jsr _table+16
  36. ldaa _table+17
  37. ldab _table+18
  38. ldd _table+19
  39. lds _table+20
  40. ldx _table+21
  41. ldy _table+22
  42. oraa _table+23
  43. orab _table+24
  44. sbcb _table+25
  45. sbca _table+26
  46. staa _table+27
  47. stab _table+28
  48. std _table+29
  49. sts _table+30
  50. stx _table+31
  51. sty _table+32
  52. suba _table+33
  53. subb _table+34
  54. subd _table+35
  55. ;; 'bne' is assembled as far branch and must relax to
  56. ;; a relative 8-bit branch.
  57. bne _start
  58. ;; Likewise for next branch
  59. bra F1
  60. rts
  61. ;;; The following instructions will not be relaxed
  62. no_relax:
  63. addd _stack_top+60
  64. std _stack_top+40
  65. ;; 'tst' does not support direct addressing mode.
  66. tst _toto+1
  67. bne no_relax
  68. .skip 200
  69. F2:
  70. bra _start
  71. .sect .page0
  72. _bar:
  73. .long 0
  74. _toto:
  75. .long 0
  76. .skip 32
  77. stack:
  78. .skip 10
  79. _table:
  80. .skip 200
  81. _stack_top: