请选择 进入手机版 | 继续访问电脑版

新模拟器共享论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

1 2

最近看过此主题的会员

查看: 151|回复: 2

[FC源码][可视化精灵版]

  [复制链接]

签到天数: 346 天

[LV.8]以坛为家I

评论头像

发表于 2019-5-2 21:52:43 | 显示全部楼层 |阅读模式

  1. ;[FC][可视化精灵版]
  2. ;FlameCyclone
  3. ;20190502

  4. .ORG $B400

  5. FUNCTION_SUM = 03    ;功能总数
  6. SPIRIT_CHR = $80    ;精灵图形CHR索引
  7. BG_CHR = $80        ;背景图形CHR索引
  8. CHAR_PER = $2F      ;百分号图块索引
  9. CHAR_NUM = $30      ;数字图块索引

  10. ;========================================
  11. Pos_X = $60
  12. Pos_Y = $60

  13. FunIndex = $0040
  14. Sprites_Cur = FunIndex + 1
  15. Button_Keep = Sprites_Cur + 1
  16. Button_Once = Button_Keep + 2
  17. DataPortL = Button_Once + 2
  18. DataPortH = DataPortL + 1
  19. Coordinate_X = DataPortH + 1
  20. Coordinate_Y = Coordinate_X + 1
  21. ;========================================
  22. ROM_Btn_Keep = $F9
  23. ROM_Btn_Once = $F5
  24. ROM_Nmi_Port = $FF
  25. ROM_Pause = $25
  26. PAUSE_VAL = $01
  27. ROM_Palette = $07D0
  28. ;========================================
  29. Check_Addr = $01C0
  30. CHECK_VAL = $FA
  31. Func_Addr = $01C1
  32. ;========================================

  33. ProgramBegin:;程序开始
  34. LDA ROM_Pause
  35. CMP #PAUSE_VAL
  36. BNE ProgramEnd
  37. LDA ROM_Btn_Once
  38. CMP #$20
  39. BNE ProgramEnd
  40. PHA
  41. TXA
  42. PHA
  43. TYA
  44. PHA
  45. LDA #$00
  46. STA $2000
  47. STA $2001
  48. LDA #$00
  49. STA $4015

  50. SaveUsedRam:
  51. LDX #$00
  52. SaveUsedRamBeg:
  53. LDA FunIndex,X
  54. PHA
  55. INX
  56. CPX #$0A
  57. BCC SaveUsedRamBeg

  58. JSR CheckInit
  59. JSR CheatMenu

  60. JSR NmiWait
  61. JSR PaletteRecv
  62. RecvUsedRam:
  63. LDX #$0A - 1
  64. RecvUsedRamBeg:
  65. PLA
  66. STA FunIndex,X
  67. DEX
  68. BPL RecvUsedRamBeg

  69. LDA ROM_Nmi_Port
  70. STA $2000
  71. LDA #$0F
  72. STA $4015
  73. LDA #$00
  74. STA ROM_Btn_Once
  75. LDA #$10
  76. STA ROM_Btn_Keep
  77. PLA
  78. TAY
  79. PLA
  80. TAX
  81. PLA
  82. ProgramEnd:
  83. RTS

  84. ;========================================
  85. PaletteRecv:
  86. LDA #$3F
  87. STA $2006
  88. LDA #$10
  89. STA $2006
  90. LDX #$00
  91. PaletteRecvBeg:
  92. LDA ROM_Palette,X
  93. STA $2007
  94. INX
  95. CPX #$10
  96. BCC PaletteRecvBeg
  97. RTS

  98. ;========================================
  99. CheckInit:
  100. LDA Check_Addr
  101. CMP #CHECK_VAL
  102. BEQ CheckInitEnd
  103. LDX #$00
  104. LDA #$00
  105. CheckInitSet:
  106. STA Func_Addr,X
  107. INX
  108. CPX #$04
  109. BCC CheckInitSet
  110. LDA #CHECK_VAL
  111. STA Check_Addr
  112. CheckInitEnd:
  113. RTS

  114. ;========================================
  115. CheatMenu:
  116. ;-------------------------
  117. SetPpuPattern:;设置PPU图形
  118. JSR NmiWait
  119. JSR PaletteSet
  120. SetPpuPatternA:;设置上页图形2KB*2
  121. LDX #$00
  122. LDY #SPIRIT_CHR
  123. STX $8000
  124. STY $8001
  125. INX
  126. INY
  127. INY
  128. STX $8000
  129. STY $8001
  130. LDX #$02
  131. LDY #BG_CHR
  132. SetPpuPatternB:;设置下页图形1KB*4
  133. STX $8000
  134. STY $8001
  135. INX
  136. INY
  137. CPX #$06
  138. BCC SetPpuPatternB

  139. JSR NmiWait
  140. JSR PaletteSet

  141. LDA #$20
  142. STA Button_Keep
  143. ;========================================
  144. CleanSprites:
  145. LDA #$F8
  146. LDX #$00
  147. CleanSpritesBeg:
  148. STA $0200,X
  149. INX
  150. BNE CleanSpritesBeg

  151. LDA #$00
  152. STA Sprites_Cur
  153. STA FunIndex

  154. JSR ShowOrder
  155. JSR ShowItem
  156. JSR ShowStatus
  157. JSR NmiWait
  158. LDA #$02
  159. STA $4014

  160. LDA #$10
  161. STA $2001
  162. ;========================================
  163. Circle:
  164. LDA $2002
  165. BPL Circle

  166. LDA #$02
  167. STA $4014
  168. LDA #$00
  169. STA Sprites_Cur

  170. JSR Button_Process
  171. JSR SwitchFunction
  172. JSR PaletteSet
  173. LDA Button_Once
  174. CMP #$10
  175. BNE Circle
  176. RTS

  177. ;========================================
  178. NmiWait:
  179. LDA $2002
  180. BPL NmiWait
  181. RTS

  182. ;========================================
  183. ScrollReset:
  184. LDA #$00
  185. STA $2005
  186. STA $2005
  187. RTS

  188. ;========================================
  189. PaletteSet:
  190. LDA #$3F
  191. STA $2006
  192. LDA #$10
  193. STA $2006
  194. LDX #$00
  195. PaletteSetBeg:
  196. LDA Palette_Data,X
  197. STA $2007
  198. INX
  199. CPX #$10
  200. BCC PaletteSetBeg
  201. RTS

  202. ;========================================
  203. ;双人按键扫描
  204. ;========================================
  205. Button_Process
  206. LDX #$01
  207. STX $4016
  208. DEX
  209. STX $4016
  210. LDX #$01
  211. Button_Scan
  212. LDY #$08
  213. Button_Scan_Beg:
  214. LDA $4016,X
  215. LSR
  216. ROL Button_Once,X
  217. LSR
  218. DEY
  219. BNE Button_Scan_Beg
  220. Button_Set:
  221. LDA Button_Once,X
  222. TAY
  223. EOR Button_Keep,X
  224. AND Button_Once,X
  225. STA Button_Once,X
  226. STY Button_Keep,X
  227. DEX
  228. BPL Button_Scan
  229. RTS

  230. ;========================================
  231. ;显示序号
  232. ShowOrder:
  233. LDA #Pos_X + $14
  234. STA Coordinate_X
  235. LDA #Pos_Y - $10
  236. STA Coordinate_Y
  237. LDX Sprites_Cur
  238. ShowOrderBeg:
  239. LDA Coordinate_Y
  240. STA $0200,X
  241. INX
  242. LDA FunIndex
  243. CLC
  244. ADC #$01
  245. ADC #CHAR_NUM
  246. STA $0200,X
  247. INX
  248. LDA #$00
  249. STA $0200,X
  250. INX
  251. LDA Coordinate_X
  252. STA $0200,X
  253. INX

  254. LDA Coordinate_Y
  255. STA $0200,X
  256. INX
  257. LDA #CHAR_PER
  258. STA $0200,X
  259. INX
  260. LDA #$00
  261. STA $0200,X
  262. INX
  263. LDA Coordinate_X
  264. CLC
  265. ADC #$08
  266. STA Coordinate_X
  267. STA $0200,X
  268. INX

  269. LDA Coordinate_Y
  270. STA $0200,X
  271. INX
  272. LDA #FUNCTION_SUM
  273. CLC
  274. ADC #CHAR_NUM
  275. STA $0200,X
  276. INX
  277. LDA #$00
  278. STA $0200,X
  279. INX
  280. LDA Coordinate_X
  281. CLC
  282. ADC #$08
  283. STA Coordinate_X
  284. STA $0200,X
  285. INX
  286. STX Sprites_Cur
  287. RTS

  288. ;========================================
  289. ;显示选项
  290. ShowItem:
  291. LDX FunIndex
  292. LDA Text_Data_L,X
  293. STA DataPortL
  294. LDA Text_Data_H,X
  295. STA DataPortH
  296. LDA #Pos_X
  297. STA Coordinate_X
  298. LDA #Pos_Y
  299. STA Coordinate_Y
  300. LDX Sprites_Cur
  301. LDY #$00
  302. ShowItemBeg:
  303. LDA Coordinate_Y
  304. STA $0200,X
  305. LDA (DataPortL),Y
  306. INX
  307. STA $0200,X
  308. INX
  309. LDA #$01
  310. STA $0200,X
  311. INX
  312. LDA Coordinate_X
  313. STA $0200,X
  314. INX
  315. LDA Coordinate_X
  316. CLC
  317. ADC #$08
  318. STA Coordinate_X
  319. INY
  320. CPY #$08
  321. BNE ShowItemEnd
  322. LDA #Pos_X
  323. STA Coordinate_X
  324. LDA #Pos_Y + 8
  325. STA Coordinate_Y
  326. ShowItemEnd:
  327. CPY #$10
  328. BCC ShowItemBeg
  329. STX Sprites_Cur
  330. RTS

  331. ;========================================
  332. ;显示状态
  333. ShowStatus:
  334. LDX FunIndex
  335. LDA ItemAddrL,X
  336. STA DataPortL
  337. LDA ItemAddrH,X
  338. STA DataPortH
  339. LDY #$00
  340. LDA (DataPortL),Y
  341. AND ItemValue,X
  342. BEQ ShowStatusOFF
  343. ShowStatusON:
  344. LDX #$00
  345. JSR ShowStatusText
  346. RTS
  347. ShowStatusOFF:
  348. LDX #$01
  349. JSR ShowStatusText
  350. RTS
  351. ShowStatusText:
  352. LDA Status_Data_L,X
  353. STA DataPortL
  354. LDA Status_Data_H,X
  355. STA DataPortH
  356. LDA #Pos_X + $08
  357. STA Coordinate_X
  358. LDA #Pos_Y + $18
  359. STA Coordinate_Y
  360. LDX Sprites_Cur
  361. LDY #$00
  362. ShowStatusTextBeg:
  363. LDA Coordinate_Y
  364. STA $0200,X
  365. LDA (DataPortL),Y
  366. INX
  367. STA $0200,X
  368. INX
  369. LDA #$02
  370. STA $0200,X
  371. INX
  372. LDA Coordinate_X
  373. STA $0200,X
  374. INX
  375. LDA Coordinate_X
  376. CLC
  377. ADC #$08
  378. STA Coordinate_X
  379. INY
  380. CPY #$06
  381. BNE ShowStatusTextEnd
  382. LDA #Pos_X + $08
  383. STA Coordinate_X
  384. LDA #Pos_Y + $20
  385. STA Coordinate_Y
  386. ShowStatusTextEnd:
  387. CPY #$0C
  388. BCC ShowStatusTextBeg
  389. STX Sprites_Cur
  390. RTS

  391. ;========================================
  392. ;切换功能
  393. SwitchFunction:
  394. Switch_Last:
  395. LDA Button_Once
  396. AND #$EF
  397. BEQ SwitchFunctionEnd
  398. LDA Button_Once
  399. AND #$0A
  400. BEQ Switch_Next
  401. LDA FunIndex
  402. BNE Switch_Last_Set
  403. LDA #FUNCTION_SUM
  404. STA FunIndex
  405. Switch_Last_Set:
  406. DEC FunIndex
  407. Switch_Next:
  408. LDA Button_Once
  409. AND #$25
  410. BEQ Switch_Enable
  411. LDA FunIndex
  412. CMP #FUNCTION_SUM - 1
  413. BCC Switch_Next_Set
  414. LDA #$FF
  415. STA FunIndex
  416. Switch_Next_Set:
  417. INC FunIndex
  418. Switch_Enable:
  419. LDA Button_Once
  420. CMP #$40
  421. BNE Switch_Disenable
  422. JSR EnableFunction
  423. Switch_Disenable:
  424. LDA Button_Once
  425. CMP #$80
  426. BNE UpdateSprites
  427. JSR DisenableFunction
  428. UpdateSprites:
  429. JSR ShowOrder
  430. JSR ShowItem
  431. JSR ShowStatus
  432. SwitchFunctionEnd:
  433. RTS

  434. ;========================================
  435. EnableFunction:
  436. LDX FunIndex
  437. LDA ItemAddrL,X
  438. STA DataPortL
  439. LDA ItemAddrH,X
  440. STA DataPortH
  441. LDY #$00
  442. LDA ItemValue,X
  443. ORA (DataPortL),Y
  444. STA (DataPortL),Y
  445. RTS

  446. ;========================================
  447. DisenableFunction
  448. LDX FunIndex
  449. LDA ItemAddrL,X
  450. STA DataPortL
  451. LDA ItemAddrH,X
  452. STA DataPortH
  453. LDY #$00
  454. LDA ItemValue,X
  455. EOR #$FF
  456. AND (DataPortL),Y
  457. STA (DataPortL),Y
  458. RTS


  459. ;========================================
  460. Palette_Data:;调色板数据
  461. .BYTE $0F,$27,$27,$27,$0F,$24,$24,$24,$0F,$21,$21,$21,$0F,$2C,$2C,$2C

  462. ;========================================
  463. ItemText_Data:;节目文本
  464. ITEM_001
  465. .DB $80,$81,$84,$85,$88,$89,$8C,$8D
  466. .DB $82,$83,$86,$87,$8A,$8B,$8E,$8F
  467. ITEM_002
  468. .DB $90,$91,$94,$95,$98,$99,$9C,$9D
  469. .DB $92,$93,$96,$97,$9A,$9B,$9E,$9F
  470. ITEM_003
  471. .DB $A0,$A1,$A4,$A5,$A8,$A9,$AC,$AD
  472. .DB $A2,$A3,$A6,$A7,$AA,$AB,$AE,$AF
  473. ITEM_004
  474. .DB $B0,$B1,$B4,$B5,$B8,$B9,$BC,$BD
  475. .DB $B2,$B3,$B6,$B7,$BA,$BB,$BE,$BF
  476. ITEM_005
  477. .DB $C0,$C1,$C4,$C5,$C8,$C9,$CC,$CD
  478. .DB $C2,$C3,$C6,$C7,$CA,$CB,$CE,$CF
  479. ITEM_006
  480. .DB $D0,$D1,$D4,$D5,$D8,$D9,$DC,$DD
  481. .DB $D2,$D3,$D6,$D7,$DA,$DB,$DE,$DF
  482. ITEM_007
  483. .DB $E0,$E1,$E4,$E5,$E8,$E9,$EC,$ED
  484. .DB $E2,$E3,$E6,$E7,$EA,$EB,$EE,$EF
  485. ITEM_008
  486. .DB $F0,$F1,$F4,$F5,$F8,$F9,$FC,$FD
  487. .DB $F2,$F3,$F6,$F7,$FA,$FB,$FE,$FF

  488. Text_Data_L:;节目文本地址低位
  489. .DB <ITEM_001,<ITEM_002,<ITEM_003,<ITEM_004,<ITEM_005,<ITEM_006,<ITEM_007,<ITEM_008

  490. Text_Data_H:;节目文本地址高位
  491. .DB >ITEM_001,>ITEM_002,>ITEM_003,>ITEM_004,>ITEM_005,>ITEM_006,>ITEM_007,>ITEM_008

  492. ;========================================
  493. StatusText:
  494. Text_ON:
  495. .DB $60,$61,$64,$65,$6C,$6D
  496. .DB $62,$63,$66,$67,$6E,$6F
  497. Text_OFF:
  498. .DB $60,$61,$68,$69,$6C,$6D
  499. .DB $62,$63,$6A,$6B,$6E,$6F

  500. Status_Data_L:
  501.   .DB <Text_ON,<Text_OFF

  502. Status_Data_H:
  503.   .DB >Text_ON,>Text_OFF

  504. ;========================================
  505. Function_Data:
  506. ItemAddrL:
  507. .DB $C1,$C1,$C1,$C1,$C1,$C1,$C1,$C1
  508. ItemAddrH:
  509. .DB $01,$01,$01,$01,$01,$01,$01,$01

  510. ItemValue:
  511. .DB $01,$02,$04,$08,$10,$20,$40,$80
复制代码


游客,如果您要查看本帖隐藏内容请回复

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x

签到天数: 253 天

[LV.8]以坛为家I

评论头像

发表于 2019-5-3 14:56:36 | 显示全部楼层
总觉的好高大上
是好东西的样子
回复 支持 反对

使用道具 举报

签到天数: 1971 天

[LV.Master]伴坛终老

评论头像(2)

发表于 2019-5-5 14:24:21 | 显示全部楼层
看样子这个精灵以后是通用的,期待
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

新模拟器共享论坛X

翻译WIKI大量成长力和金钱奖励!

访问http://wiki.nesbbs.com,翻译词条到论坛指定区,每一个完成翻译并有采纳的,有成长力等奖励哟...

点击查看详情 

QQ|申请友链|小黑屋|手机版|Archiver|新模拟器共享网 ( 辽ICP备09001055号|繁體中文   

GMT+8, 2019-5-25 01:20 , Processed in 0.062400 second(s), 25 queries , XCache On.

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表