Advertisement
NovaYoshi

structs in WDC C compiler

Dec 22nd, 2017
751
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 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. ; struct wario aaa;
  29. ;
  30. ; aaa.money = 5;
  31. aaa_1 set 0
  32. sep #$20
  33. longa off
  34. lda #$5
  35. sta <L3+aaa_1
  36. rep #$20
  37. longa on
  38. ; aaa.gold = 5;
  39. lda #$5
  40. sta <L3+aaa_1+1
  41. ; aaa.wares = aaa.money + 15;
  42. lda <L3+aaa_1
  43. and #$ff
  44. clc
  45. adc #$f
  46. sta <L3+aaa_1+3
  47. ;
  48. ; bbb.money = 7;
  49. sep #$20
  50. longa off
  51. lda #$7
  52. sta |__bbb
  53. rep #$20
  54. longa on
  55. ; bbb.gold = 7;
  56. lda #$7
  57. sta |__bbb+1
  58. ; bbb.wares = aaa.money + 17;
  59. lda <L3+aaa_1
  60. and #$ff
  61. clc
  62. adc #$11
  63. sta |__bbb+3
  64. ;
  65. ; aaa = bbb;
  66. pea #<__bbb
  67. clc
  68. tdc
  69. adc #<L3+aaa_1
  70. pha
  71. lda #$5
  72. xref __~mov
  73. jsr __~mov
  74. ;}
  75. pld
  76. tsc
  77. clc
  78. adc #L2
  79. tcs
  80. rts
  81. L2 equ 9
  82. L3 equ 5
  83. ends
  84. efunc
  85. ;
  86. udata
  87. xdef __bbb
  88. __bbb
  89. ds 5
  90. ends
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement