SHARE
TWEET

Wolf3D: upload sprite to frame buffer

DarkSamus993 Apr 5th, 2018 (edited) 32 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $C1F98C = x coordinates in frame buffer (for wall)
  2. $C1FA8C = y coordinates in frame buffer (for both)
  3.  
  4. $C1962A = code copied to RAM ($7F4300) for transfering pixels to frame buffer
  5. C1F987 MVN $C1,$7F            A:4FFF X:962A Y:4300 S:0FA7 D:0FAD DB:7F nvmxdizc
  6.  
  7.  
  8. C05CEB JSL $C1F880   [C1F880] A:007E X:3384 Y:0004 S:0FCA D:0FCC DB:7E nvmxdizc  // entry point
  9.  
  10. C1F880 PHD                    A:007E X:3384 Y:0004 S:0FC7 D:0FCC DB:7E nvmxdizc
  11. C1F881 PHB                    A:007E X:3384 Y:0004 S:0FC5 D:0FCC DB:7E nvmxdizc
  12. C1F882 LDA #$0000             A:007E X:3384 Y:0004 S:0FC4 D:0FCC DB:7E nvmxdizc
  13. C1F885 TCD                    A:0000 X:3384 Y:0004 S:0FC4 D:0FCC DB:7E nvmxdiZc
  14. C1F886 LDX $04       [000004] A:0000 X:3384 Y:0004 S:0FC4 D:0000 DB:7E nvmxdiZc
  15. C1F888 LDA $0000,x   [7E3384] A:0000 X:3384 Y:0004 S:0FC4 D:0000 DB:7E nvmxdizc
  16. C1F88B STA $16       [000016] A:EA3F X:3384 Y:0004 S:0FC4 D:0000 DB:7E Nvmxdizc  // store LB of ptr to sprite data
  17. C1F88D LDA $0002,x   [7E3386] A:EA3F X:3384 Y:0004 S:0FC4 D:0000 DB:7E Nvmxdizc
  18. C1F890 CLC                    A:0000 X:3384 Y:0004 S:0FC4 D:0000 DB:7E nvmxdiZc
  19. C1F891 ADC #$00C3             A:0000 X:3384 Y:0004 S:0FC4 D:0000 DB:7E nvmxdiZc
  20. C1F894 STA $18       [000018] A:00C3 X:3384 Y:0004 S:0FC4 D:0000 DB:7E nvmxdizc  // store HB of ptr to sprite data
  21. C1F896 LDA $000C,x   [7E3390] A:00C3 X:3384 Y:0004 S:0FC4 D:0000 DB:7E nvmxdizc
  22. C1F899 STA $0C       [00000C] A:4FA3 X:3384 Y:0004 S:0FC4 D:0000 DB:7E nvmxdizc
  23. C1F89B LDA $0004,x   [7E3388] A:4FA3 X:3384 Y:0004 S:0FC4 D:0000 DB:7E nvmxdizc
  24. C1F89E ASL A                  A:0067 X:3384 Y:0004 S:0FC4 D:0000 DB:7E nvmxdizc
  25. C1F89F STA $0A       [00000A] A:00CE X:3384 Y:0004 S:0FC4 D:0000 DB:7E nvmxdizc  // used for calculating when to stop printing same line of pixels
  26. C1F8A1 LDA $000C,x   [7E3390] A:00CE X:3384 Y:0004 S:0FC4 D:0000 DB:7E nvmxdizc
  27. C1F8A4 XBA                    A:4FA3 X:3384 Y:0004 S:0FC4 D:0000 DB:7E nvmxdizc
  28. C1F8A5 AND #$007F             A:A34F X:3384 Y:0004 S:0FC4 D:0000 DB:7E nvmxdizc
  29. C1F8A8 ASL A                  A:004F X:3384 Y:0004 S:0FC4 D:0000 DB:7E nvmxdizc
  30. C1F8A9 TAX                    A:009E X:3384 Y:0004 S:0FC4 D:0000 DB:7E nvmxdizc
  31. C1F8AA LDA $C10100,x [C1019E] A:009E X:009E Y:0004 S:0FC4 D:0000 DB:7E nvmxdizc  // load ptr to sprite pixel x coordinate table
  32. C1F8AE STA $0E       [00000E] A:3EF0 X:009E Y:0004 S:0FC4 D:0000 DB:7E nvmxdizc
  33. C1F8B0 ADC #$0082             A:3EF0 X:009E Y:0004 S:0FC4 D:0000 DB:7E nvmxdizc
  34. C1F8B3 STA $12       [000012] A:3F72 X:009E Y:0004 S:0FC4 D:0000 DB:7E nvmxdizc
  35. C1F8B5 LDA #$00C1             A:3F72 X:009E Y:0004 S:0FC4 D:0000 DB:7E nvmxdizc
  36. C1F8B8 STA $10       [000010] A:00C1 X:009E Y:0004 S:0FC4 D:0000 DB:7E nvmxdizc
  37. C1F8BA STA $14       [000014] A:00C1 X:009E Y:0004 S:0FC4 D:0000 DB:7E nvmxdizc
  38. C1F8BC STZ $08       [000008] A:00C1 X:009E Y:0004 S:0FC4 D:0000 DB:7E nvmxdizc
  39. C1F8BE LDA $00       [000000] A:00C1 X:009E Y:0004 S:0FC4 D:0000 DB:7E nvmxdizc
  40. C1F8C0 LDY $04       [000004] A:001C X:009E Y:0004 S:0FC4 D:0000 DB:7E nvmxdizc
  41. C1F8C2 SEC                    A:001C X:009E Y:3384 S:0FC4 D:0000 DB:7E nvmxdizc
  42. C1F8C3 SBC $0006,y   [7E338A] A:001C X:009E Y:3384 S:0FC4 D:0000 DB:7E nvmxdizC
  43. C1F8C6 BCS $F8F6     [C1F8F6] A:0000 X:009E Y:3384 S:0FC4 D:0000 DB:7E nvmxdiZC
  44.  
  45. C1F8C8 SEP #$20               A:0007 X:00A4 Y:3384 S:0FC4 D:0000 DB:7E nvmxdizc
  46. C1F8CA STA $004202   [004202] A:0007 X:00A4 Y:3384 S:0FC4 D:0000 DB:7E nvMxdizc
  47. C1F8CE LDA $0A       [00000A] A:0007 X:00A4 Y:3384 S:0FC4 D:0000 DB:7E nvMxdizc
  48. C1F8D0 STA $004203   [004203] A:00C8 X:00A4 Y:3384 S:0FC4 D:0000 DB:7E NvMxdizc
  49. C1F8D4 REP #$20               A:00C8 X:00A4 Y:3384 S:0FC4 D:0000 DB:7E NvMxdizc
  50. C1F8D6 PHA                    A:00C8 X:00A4 Y:3384 S:0FC4 D:0000 DB:7E Nvmxdizc
  51. C1F8D7 PLA                    A:00C8 X:00A4 Y:3384 S:0FC2 D:0000 DB:7E Nvmxdizc
  52. C1F8D8 NOP                    A:00C8 X:00A4 Y:3384 S:0FC4 D:0000 DB:7E nvmxdizc
  53. C1F8D9 LDA $004216   [004216] A:00C8 X:00A4 Y:3384 S:0FC4 D:0000 DB:7E nvmxdizc
  54. C1F8DD STA $08       [000008] A:0578 X:00A4 Y:3384 S:0FC4 D:0000 DB:7E nvmxdizc
  55. C1F8DF SEP #$20               A:0578 X:00A4 Y:3384 S:0FC4 D:0000 DB:7E nvmxdizc
  56. C1F8E1 LDA $0B       [00000B] A:0578 X:00A4 Y:3384 S:0FC4 D:0000 DB:7E nvMxdizc
  57. C1F8E3 STA $004203   [004203] A:0500 X:00A4 Y:3384 S:0FC4 D:0000 DB:7E nvMxdiZc
  58. C1F8E7 REP #$20               A:0500 X:00A4 Y:3384 S:0FC4 D:0000 DB:7E nvMxdiZc
  59. C1F8E9 PHA                    A:0500 X:00A4 Y:3384 S:0FC4 D:0000 DB:7E nvmxdiZc
  60. C1F8EA PLA                    A:0500 X:00A4 Y:3384 S:0FC2 D:0000 DB:7E nvmxdiZc
  61. C1F8EB NOP                    A:0500 X:00A4 Y:3384 S:0FC4 D:0000 DB:7E nvmxdizc
  62. C1F8EC LDA $004216   [004216] A:0500 X:00A4 Y:3384 S:0FC4 D:0000 DB:7E nvmxdizc
  63. C1F8F0 XBA                    A:0000 X:00A4 Y:3384 S:0FC4 D:0000 DB:7E nvmxdiZc
  64. C1F8F1 CLC                    A:0000 X:00A4 Y:3384 S:0FC4 D:0000 DB:7E nvmxdiZc
  65. C1F8F2 ADC $08       [000008] A:0000 X:00A4 Y:3384 S:0FC4 D:0000 DB:7E nvmxdiZc
  66. C1F8F4 STA $08       [000008] A:0578 X:00A4 Y:3384 S:0FC4 D:0000 DB:7E nvmxdizc
  67.  
  68. C1F8F6 PEI ($18)     [000018] A:0000 X:009E Y:3384 S:0FC4 D:0000 DB:7E nvmxdiZC
  69. C1F8F8 PLB                    A:0000 X:009E Y:3384 S:0FC2 D:0000 DB:7E nvmxdiZC
  70. C1F8F9 PLP                    A:0000 X:009E Y:3384 S:0FC3 D:0000 DB:C3 NvmxdizC
  71. C1F8FA LDA $00       [000000] A:0000 X:009E Y:3384 S:0FC4 D:0000 DB:C3 nvmxdizc
  72. C1F8FC ASL A                  A:001C X:009E Y:3384 S:0FC4 D:0000 DB:C3 nvmxdizc
  73. C1F8FD TAX                    A:0038 X:009E Y:3384 S:0FC4 D:0000 DB:C3 nvmxdizc
  74. C1F8FE LDA $0C       [00000C] A:0038 X:0038 Y:3384 S:0FC4 D:0000 DB:C3 nvmxdizc
  75. C1F900 CMP $7E3776,x [7E37AE] A:4FA3 X:0038 Y:3384 S:0FC4 D:0000 DB:C3 nvmxdizc
  76. C1F904 BCS $F91A     [C1F91A] A:4FA3 X:0038 Y:3384 S:0FC4 D:0000 DB:C3 nvmxdizC
  77.  
  78. C1F906 LDA $0A       [00000A] A:EF01 X:EF01 Y:FFFF S:0FC4 D:0000 DB:C3 Nvmxdizc
  79. C1F908 CLC                    A:00C8 X:EF01 Y:FFFF S:0FC4 D:0000 DB:C3 nvmxdizc
  80. C1F909 ADC $08       [000008] A:00C8 X:EF01 Y:FFFF S:0FC4 D:0000 DB:C3 nvmxdizc
  81. C1F90B STA $08       [000008] A:00C8 X:EF01 Y:FFFF S:0FC4 D:0000 DB:C3 nvmxdizc
  82. C1F90D INC $00       [000000] A:00C8 X:EF01 Y:FFFF S:0FC4 D:0000 DB:C3 nvmxdizc
  83. C1F90F LDA $00       [000000] A:00C8 X:EF01 Y:FFFF S:0FC4 D:0000 DB:C3 nvmxdizc
  84. C1F911 CMP $02       [000002] A:0011 X:EF01 Y:FFFF S:0FC4 D:0000 DB:C3 nvmxdizc
  85. C1F913 BCC $F8FC     [C1F8FC] A:0011 X:EF01 Y:FFFF S:0FC4 D:0000 DB:C3 Nvmxdizc
  86. C1F915 BEQ $F8FC     [C1F8FC] A:004F X:F027 Y:FFFF S:0FC4 D:0000 DB:C3 nvmxdiZC
  87. C1F917 PLB                    A:0050 X:F027 Y:FFFF S:0FC4 D:0000 DB:C3 nvmxdizC
  88. C1F918 PLD                    A:0050 X:F027 Y:FFFF S:0FC5 D:0000 DB:7E nvmxdizC
  89. C1F919 RTL                    A:0050 X:F027 Y:FFFF S:0FC7 D:0FCC DB:7E nvmxdizC  // exit (sprite has been transfered to frame buffer)
  90.  
  91. C1F91A LDA $C1FA8C,x [C1FAC4] A:4FA3 X:0038 Y:3384 S:0FC4 D:0000 DB:C3 nvmxdizC  // load y coordinate in frame buffer
  92. C1F91E STA $1C       [00001C] A:28C0 X:0038 Y:3384 S:0FC4 D:0000 DB:C3 nvmxdizC
  93. C1F920 LDA $08       [000008] A:28C0 X:0038 Y:3384 S:0FC4 D:0000 DB:C3 nvmxdizC
  94. C1F922 XBA                    A:0000 X:0038 Y:3384 S:0FC4 D:0000 DB:C3 nvmxdiZC
  95. C1F923 AND #$007E             A:0000 X:0038 Y:3384 S:0FC4 D:0000 DB:C3 nvmxdiZC
  96. C1F926 TAY                    A:0000 X:0038 Y:3384 S:0FC4 D:0000 DB:C3 nvmxdiZC  
  97. C1F927 LDA ($16),y   [C3EA3F] A:0000 X:0038 Y:0000 S:0FC4 D:0000 DB:C3 nvmxdiZC  // load ptr to sprite column data
  98. C1F929 STA $1A       [00001A] A:EA77 X:0038 Y:0000 S:0FC4 D:0000 DB:C3 NvmxdizC
  99. C1F92B TAX                    A:EA77 X:0038 Y:0000 S:0FC4 D:0000 DB:C3 NvmxdizC
  100. C1F92C LDY $0000,x   [C3EA77] A:EA77 X:EA77 Y:0000 S:0FC4 D:0000 DB:C3 NvmxdizC  // load x coordinate
  101. C1F92F BMI $F906     [C1F906] A:EA77 X:EA77 Y:0044 S:0FC4 D:0000 DB:C3 nvmxdizC  // if $FFFF, end of column data
  102. C1F931 PEA $C1F9              A:EA77 X:EA77 Y:0044 S:0FC4 D:0000 DB:C3 nvmxdizC
  103. C1F934 PEA $597F              A:EA77 X:EA77 Y:0044 S:0FC2 D:0000 DB:C3 nvmxdizC
  104. C1F937 LDA [$0E],y   [C13F34] A:EA77 X:EA77 Y:0044 S:0FC0 D:0000 DB:C3 nvmxdizC  // read from sprite pixel x coordinate table
  105. C1F939 CLC                    A:002D X:EA77 Y:0044 S:0FC0 D:0000 DB:C3 nvmxdizC
  106. C1F93A ADC $1C       [00001C] A:002D X:EA77 Y:0044 S:0FC0 D:0000 DB:C3 nvmxdizc  // add sprite pixel y coordinate
  107. C1F93C SEI                    A:28ED X:EA77 Y:0044 S:0FC0 D:0000 DB:C3 nvmxdizc
  108. C1F93D STA $002181   [002181] A:28ED X:EA77 Y:0044 S:0FC0 D:0000 DB:C3 nvmxdIzc  // store to WRAM address register
  109. C1F941 LDA [$12],y   [C13FB6] A:28ED X:EA77 Y:0044 S:0FC0 D:0000 DB:C3 nvmxdIzc
  110. C1F943 PHA                    A:78DD X:EA77 Y:0044 S:0FC0 D:0000 DB:C3 nvmxdIzc  // push return address (the writing code in RAM)
  111. C1F944 LDY $0002,x   [C3EA79] A:78DD X:EA77 Y:0044 S:0FBE D:0000 DB:C3 nvmxdIzc  // load sprite pixel y coordinate
  112. C1F947 LDA [$12],y   [C13FBE] A:78DD X:EA77 Y:004C S:0FBE D:0000 DB:C3 nvmxdIzc  // load address for storing "RTL"
  113. C1F949 LDY $0004,x   [C3EA7B] A:78FD X:EA77 Y:004C S:0FBE D:0000 DB:C3 nvmxdIzc  // load ptr to sprite pixel data
  114. C1F94C TAX                    A:78FD X:EA77 Y:EBB9 S:0FBE D:0000 DB:C3 NvmxdIzc
  115. C1F94D LDA #$2100             A:78FD X:78FD Y:EBB9 S:0FBE D:0000 DB:C3 nvmxdIzc
  116. C1F950 TCD                    A:2100 X:78FD Y:EBB9 S:0FBE D:0000 DB:C3 nvmxdIzc
  117. C1F951 SEP #$20               A:2100 X:78FD Y:EBB9 S:0FBE D:2100 DB:C3 nvmxdIzc
  118. C1F953 LDA #$6B               A:2100 X:78FD Y:EBB9 S:0FBE D:2100 DB:C3 nvMxdIzc
  119. C1F955 STA $7F0001,x [7F78FE] A:216B X:78FD Y:EBB9 S:0FBE D:2100 DB:C3 nvMxdIzc  // store opcode "RTL" (how many pixels to read)
  120. C1F959 RTL                    A:216B X:78FD Y:EBB9 S:0FBE D:2100 DB:C3 nvMxdIzc
  121.  
  122. // return from storing some pixels to frame buffer
  123. C1F95A CLI                    A:21D3 X:78FD Y:EBB9 S:0FC4 D:2100 DB:C3 nvMxdIzc
  124. C1F95B LDA #$B9               A:21D3 X:78FD Y:EBB9 S:0FC4 D:2100 DB:C3 nvMxdizc
  125. C1F95D STA $7F0001,x [7F78FE] A:21B9 X:78FD Y:EBB9 S:0FC4 D:2100 DB:C3 NvMxdizc  // store opcode "LDA addr,y"
  126. C1F961 REP #$21               A:21B9 X:78FD Y:EBB9 S:0FC4 D:2100 DB:C3 NvMxdizc
  127. C1F963 LDA #$0000             A:21B9 X:78FD Y:EBB9 S:0FC4 D:2100 DB:C3 Nvmxdizc
  128. C1F966 TCD                    A:0000 X:78FD Y:EBB9 S:0FC4 D:2100 DB:C3 nvmxdiZc
  129. C1F967 LDA $1A       [00001A] A:0000 X:78FD Y:EBB9 S:0FC4 D:0000 DB:C3 nvmxdiZc
  130. C1F969 ADC #$0006             A:EADF X:78FD Y:EBB9 S:0FC4 D:0000 DB:C3 Nvmxdizc
  131. C1F96C STA $1A       [00001A] A:EAE5 X:78FD Y:EBB9 S:0FC4 D:0000 DB:C3 Nvmxdizc
  132. C1F96E JMP $F92B     [C1F92B] A:EAE5 X:78FD Y:EBB9 S:0FC4 D:0000 DB:C3 Nvmxdizc
  133.  
  134. // writing code is run dynamically from RAM
  135. 7F78DE LDA $0022,y   [C3EBDB] A:216B X:78FD Y:EBB9 S:0FC1 D:2100 DB:C3 nvMxdIzc  // load 1st pixel data
  136. 7F78E1 STA $80       [002180] A:21C9 X:78FD Y:EBB9 S:0FC1 D:2100 DB:C3 NvMxdIzc
  137. 7F78E3 STA $80       [002180] A:21C9 X:78FD Y:EBB9 S:0FC1 D:2100 DB:C3 NvMxdIzc
  138. 7F78E5 LDA $0023,y   [C3EBDC] A:21C9 X:78FD Y:EBB9 S:0FC1 D:2100 DB:C3 NvMxdIzc  // load 2nd pixel data
  139. 7F78E8 STA $80       [002180] A:21C9 X:78FD Y:EBB9 S:0FC1 D:2100 DB:C3 NvMxdIzc
  140. 7F78EA STA $80       [002180] A:21C9 X:78FD Y:EBB9 S:0FC1 D:2100 DB:C3 NvMxdIzc
  141. 7F78EC STA $80       [002180] A:21C9 X:78FD Y:EBB9 S:0FC1 D:2100 DB:C3 NvMxdIzc
  142. 7F78EE LDA $0024,y   [C3EBDD] A:21C9 X:78FD Y:EBB9 S:0FC1 D:2100 DB:C3 NvMxdIzc  // load 3rd pixel data
  143. 7F78F1 STA $80       [002180] A:21D1 X:78FD Y:EBB9 S:0FC1 D:2100 DB:C3 NvMxdIzc
  144. 7F78F3 STA $80       [002180] A:21D1 X:78FD Y:EBB9 S:0FC1 D:2100 DB:C3 NvMxdIzc
  145. 7F78F5 LDA $0025,y   [C3EBDE] A:21D1 X:78FD Y:EBB9 S:0FC1 D:2100 DB:C3 NvMxdIzc  // load 4th pixel data
  146. 7F78F8 STA $80       [002180] A:21D3 X:78FD Y:EBB9 S:0FC1 D:2100 DB:C3 NvMxdIzc
  147. 7F78FA STA $80       [002180] A:21D3 X:78FD Y:EBB9 S:0FC1 D:2100 DB:C3 NvMxdIzc
  148. 7F78FC STA $80       [002180] A:21D3 X:78FD Y:EBB9 S:0FC1 D:2100 DB:C3 NvMxdIzc
  149. 7F78FE RTL                    A:21D3 X:78FD Y:EBB9 S:0FC1 D:2100 DB:C3 NvMxdIzc  // "RTL" was put here by code so only 4 pixels get read
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top