Advertisement
NovaYoshi

wdc compiler struct array

Dec 22nd, 2017
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. ;:ts=8
  2. R0 equ 1
  3. R1 equ 5
  4. R2 equ 9
  5. R3 equ 13
  6. ;struct wario {
  7. ; unsigned char money;
  8. ; unsigned short gold;
  9. ; unsigned short wares;
  10. ;};
  11. ;
  12. ;
  13. ;struct wario bbb;
  14. ;
  15. ;void main() {
  16. code
  17. xdef __main
  18. func
  19. __main:
  20. longa on
  21. longi on
  22. tsc
  23. sec
  24. sbc #L2
  25. tcs
  26. phd
  27. tcd
  28. ;/*
  29. ; struct wario aaa;
  30. ;
  31. ; aaa.money = 5;
  32. ; aaa.gold = 5;
  33. ; aaa.wares = aaa.money + 15;
  34. ;
  35. ; bbb.money = 7;
  36. ; bbb.gold = 7;
  37. ; bbb.wares = aaa.money + 17;
  38. ;
  39. ; aaa = bbb;
  40. ;*/
  41. ; struct wario warios[10];
  42. ; unsigned char i;
  43. ;
  44. ; warios[0].wares = 1;
  45. warios_1 set 0
  46. i_1 set 50
  47. lda #$1
  48. sta <L3+warios_1+3
  49. ;
  50. ; for(i=0; i<10; i++) {
  51. sep #$20
  52. longa off
  53. stz <L3+i_1
  54. rep #$20
  55. longa on
  56. bra L10004
  57. L10003:
  58. ; warios[i].money = 5;
  59. lda <L3+i_1
  60. and #$ff
  61. sta <R0
  62. asl A
  63. asl A
  64. adc <R0
  65. tax
  66. sep #$20
  67. longa off
  68. lda #$5
  69. sta <L3+warios_1,X
  70. rep #$20
  71. longa on
  72. ; warios[i].gold = 7;
  73. lda <L3+i_1
  74. and #$ff
  75. sta <R0
  76. asl A
  77. asl A
  78. adc <R0
  79. tax
  80. lda #$7
  81. sta <L3+warios_1+1,X
  82. ; warios[i].wares = warios[i-1].wares + 1;;
  83. lda <L3+i_1
  84. and #$ff
  85. sta <R0
  86. asl A
  87. asl A
  88. adc <R0
  89. sta <R0
  90. lda <L3+i_1
  91. and #$ff
  92. sta <R1
  93. asl A
  94. asl A
  95. adc <R1
  96. tax
  97. lda <L3+warios_1-2,X
  98. ina
  99. ldx <R0
  100. sta <L3+warios_1+3,X
  101. ; }
  102. sep #$20
  103. longa off
  104. inc <L3+i_1
  105. rep #$20
  106. longa on
  107. L10004:
  108. sep #$20
  109. longa off
  110. lda <L3+i_1
  111. cmp #<$a
  112. rep #$20
  113. longa on
  114. bcc L10003
  115. ;}
  116. pld
  117. tsc
  118. clc
  119. adc #L2
  120. tcs
  121. rts
  122. L2 equ 59
  123. L3 equ 9
  124. ends
  125. efunc
  126. ;
  127. udata
  128. xdef __bbb
  129. __bbb
  130. ds 5
  131. ends
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement