v9990_command_timing_test_results.gen 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758
  1. ; This program was used to produce the results of v9990_command_timing_test_results.txt
  2. ; Written by Wouter Vermaelen, based on the code of Peter Mastijn
  3. ; Change the parameters at the top to specify what you are going to measure.
  4. org #0100
  5. FREQ equ 0 ; 0 -> NTSC 8 -> PAL
  6. ENABLE equ #82 ; #82 -> display enabled / sprites(cursor) enabled
  7. ; #C2 -> enabled disabled
  8. ; #02 -> disabled enabled
  9. ; #42 -> disabled disabled
  10. di
  11. call init
  12. ;call set_p2
  13. call set_b0_2bpp ; change this to select mode (set_xxx)
  14. call tst_LMMM
  15. call tst_BMLL
  16. call tst_BMXL
  17. call tst_BMLX
  18. call tst_LMMV
  19. call print_results
  20. xor a
  21. ld ix,#00d1 ; set screen mode
  22. ld iy,(#faf7)
  23. call #001c
  24. ld ix,#0141 ; init palette
  25. ld iy,(#faf7)
  26. call #001c
  27. ld ix,#0156 ; clear keyb buf
  28. ld iy,(#fcc0)
  29. call #001c
  30. ld de,text
  31. ld c,#09
  32. jp #0005
  33. tst_LMMM
  34. call cmd_common
  35. ld hl,#0020
  36. LMMM_0 call wait_vblank
  37. call LMMM_1
  38. call wait_vblank
  39. call LMMM_2
  40. call wait_vblank_cmd
  41. jr nz,LMMM_3
  42. inc hl
  43. jr LMMM_0
  44. LMMM_3 call setres
  45. jp wait_cmd
  46. tst_BMLL
  47. call cmd_common
  48. ld hl,#0020
  49. BMLL_0 call wait_vblank
  50. call BMLL_1
  51. call wait_vblank
  52. call BMLL_2
  53. call wait_vblank_cmd
  54. jr nz,BMLL_3 ; end if still busy
  55. inc hl
  56. jr BMLL_0
  57. BMLL_3 call setres
  58. jp wait_cmd
  59. tst_BMXL
  60. call cmd_common
  61. ld hl,#0020
  62. BMXL_0 call wait_vblank
  63. call BMXL_1
  64. call wait_vblank
  65. call BMXL_2
  66. call wait_vblank_cmd
  67. jr nz,BMXL_3
  68. inc hl
  69. jr BMXL_0
  70. BMXL_3 call setres
  71. jp wait_cmd
  72. tst_BMLX
  73. call cmd_common
  74. ld hl,#0020
  75. BMLX_0 call wait_vblank
  76. call BMLX_1
  77. call wait_vblank
  78. call BMLX_2
  79. call wait_vblank_cmd
  80. jr nz,BMLX_3
  81. inc hl
  82. jr BMLX_0
  83. BMLX_3 call setres
  84. jp wait_cmd
  85. tst_LMMV
  86. call cmd_common
  87. ld hl,#0020
  88. LMMV_0 call wait_vblank
  89. call LMMV_1
  90. call wait_vblank
  91. call LMMV_2
  92. call wait_vblank_cmd
  93. jr nz,LMMV_3
  94. inc hl
  95. jr LMMV_0
  96. LMMV_3 call setres
  97. jp wait_cmd
  98. wait_vblank
  99. in a,(#65)
  100. and #40
  101. jr nz,wait_vblank
  102. wait0 in a,(#65)
  103. and #40
  104. jr z,wait0
  105. ret
  106. wait_cmd
  107. in a,(#65)
  108. and 1
  109. jr nz,wait_cmd
  110. ret
  111. wait_vblank_cmd
  112. in a,(#65)
  113. and #40
  114. jr nz,wait_vblank_cmd
  115. wait1 in a,(#65)
  116. and #40
  117. jr z,wait1
  118. in a,(#65)
  119. and 1
  120. ret
  121. setres dec hl
  122. ex de,hl
  123. ld hl,(resptr)
  124. ld (hl),e
  125. inc hl
  126. ld (hl),d
  127. inc hl
  128. ld (resptr),hl
  129. ret
  130. resptr dw result
  131. dw hexout
  132. digits db "0123456789abcdef"
  133. text db "LMMM BMLL BMXL BMLX LMMV", 13, 10
  134. hexout db "0000 0000 0000 0000 0000", "$"
  135. result ds 80
  136. init ld a,#00
  137. out (#67),a ; MCLK = 0
  138. xor a
  139. out (#6f),a
  140. ld a,#06
  141. out (#64),a
  142. ld bc,#1763
  143. ld hl,init_regs
  144. otir
  145. ret
  146. set_p1
  147. ld a,#00
  148. out (#67),a ; MCLK = 0
  149. ld a,#06
  150. out (#64),a
  151. ld a,#01 ; P1 mode
  152. out (#63),a
  153. ld a,FREQ
  154. out (#63),a ; NTSC
  155. ld a,ENABLE
  156. out (#63),a ; display enabled / sprites enabled
  157. ret
  158. set_p2
  159. ld a,#00
  160. out (#67),a ; MCLK = 0
  161. ld a,#06
  162. out (#64),a
  163. ld a,#41 ; P2 mode
  164. out (#63),a
  165. ld a,FREQ
  166. out (#63),a ; NTSC
  167. ld a,ENABLE
  168. out (#63),a ; display enabled / sprites enabled
  169. ret
  170. set_b0_2bpp
  171. ld a,#01
  172. out (#67),a ; MCLK = 1
  173. ld a,#06
  174. out (#64),a
  175. ld a,#80
  176. out (#63),a ; B0 2bpp
  177. ld a,FREQ
  178. out (#63),a ; NTSC
  179. ld a,ENABLE
  180. out (#63),a ; display enabled / cursor enabled
  181. ret
  182. set_b0_4bpp
  183. ld a,#01
  184. out (#67),a ; MCLK = 1
  185. ld a,#06
  186. out (#64),a
  187. ld a,#81
  188. out (#63),a ; B0 4bpp
  189. ld a,FREQ
  190. out (#63),a ; NTSC
  191. ld a,ENABLE
  192. out (#63),a ; display enabled / cursor enabled
  193. ret
  194. set_b0_8bpp
  195. ld a,#01
  196. out (#67),a ; MCLK = 1
  197. ld a,#06
  198. out (#64),a
  199. ld a,#82
  200. out (#63),a ; B0 8bpp
  201. ld a,FREQ
  202. out (#63),a ; NTSC
  203. ld a,ENABLE
  204. out (#63),a ; display enabled / cursor enabled
  205. ret
  206. set_b0_16bpp
  207. ld a,#01
  208. out (#67),a ; MCLK = 1
  209. ld a,#06
  210. out (#64),a
  211. ld a,#83
  212. out (#63),a ; B0 16bpp
  213. ld a,FREQ
  214. out (#63),a ; NTSC
  215. ld a,ENABLE
  216. out (#63),a ; display enabled / cursor enabled
  217. ret
  218. set_b1_2bpp
  219. ld a,#00
  220. out (#67),a ; MCLK = 0
  221. ld a,#06
  222. out (#64),a
  223. ld a,#80
  224. out (#63),a ; B1 4bpp
  225. ld a,FREQ
  226. out (#63),a ; NTSC
  227. ld a,ENABLE
  228. out (#63),a ; display enabled / cursor enabled
  229. ret
  230. set_b1_4bpp
  231. ld a,#00
  232. out (#67),a ; MCLK = 0
  233. ld a,#06
  234. out (#64),a
  235. ld a,#81
  236. out (#63),a ; B1 4bpp
  237. ld a,FREQ
  238. out (#63),a ; NTSC
  239. ld a,ENABLE
  240. out (#63),a ; display enabled / cursor enabled
  241. ret
  242. set_b1_8bpp
  243. ld a,#00
  244. out (#67),a ; MCLK = 0
  245. ld a,#06
  246. out (#64),a
  247. ld a,#82
  248. out (#63),a ; B1 8bpp
  249. ld a,FREQ
  250. out (#63),a ; NTSC
  251. ld a,ENABLE
  252. out (#63),a ; display enabled / cursor enabled
  253. ret
  254. set_b1_16bpp
  255. ld a,#00
  256. out (#67),a ; MCLK = 0
  257. ld a,#06
  258. out (#64),a
  259. ld a,#83
  260. out (#63),a ; B1 8bpp
  261. ld a,FREQ
  262. out (#63),a ; NTSC
  263. ld a,ENABLE
  264. out (#63),a ; display enabled / cursor enabled
  265. ret
  266. set_b2_2bpp
  267. ld a,#01
  268. out (#67),a ; MCLK = 1
  269. ld a,#06
  270. out (#64),a
  271. ld a,#94 ; B2 8bpp
  272. out (#63),a
  273. ld a,FREQ
  274. out (#63),a ; NTSC
  275. ld a,ENABLE
  276. out (#63),a ; display enabled / cursor enabled
  277. ret
  278. set_b2_4bpp
  279. ld a,#01
  280. out (#67),a ; MCLK = 1
  281. ld a,#06
  282. out (#64),a
  283. ld a,#95 ; B2 8bpp
  284. out (#63),a
  285. ld a,FREQ
  286. out (#63),a ; NTSC
  287. ld a,ENABLE
  288. out (#63),a ; display enabled / cursor enabled
  289. ret
  290. set_b2_8bpp
  291. ld a,#01
  292. out (#67),a ; MCLK = 1
  293. ld a,#06
  294. out (#64),a
  295. ld a,#96 ; B2 8bpp
  296. out (#63),a
  297. ld a,FREQ
  298. out (#63),a ; NTSC
  299. ld a,ENABLE
  300. out (#63),a ; display enabled / cursor enabled
  301. ret
  302. set_b2_16bpp
  303. ld a,#01
  304. out (#67),a ; MCLK = 1
  305. ld a,#06
  306. out (#64),a
  307. ld a,#97 ; B2 8bpp
  308. out (#63),a
  309. ld a,FREQ
  310. out (#63),a ; NTSC
  311. ld a,ENABLE
  312. out (#63),a ; display enabled / cursor enabled
  313. ret
  314. set_b3_2bpp
  315. ld a,#00
  316. out (#67),a ; MCLK = 0
  317. ld a,#06
  318. out (#64),a
  319. ld a,#94 ; B3 8bpp
  320. out (#63),a
  321. ld a,FREQ
  322. out (#63),a ; NTSC
  323. ld a,ENABLE
  324. out (#63),a ; display enabled / cursor enabled
  325. ret
  326. set_b3_4bpp
  327. ld a,#00
  328. out (#67),a ; MCLK = 0
  329. ld a,#06
  330. out (#64),a
  331. ld a,#95 ; B3 8bpp
  332. out (#63),a
  333. ld a,FREQ
  334. out (#63),a ; NTSC
  335. ld a,ENABLE
  336. out (#63),a ; display enabled / cursor enabled
  337. ret
  338. set_b3_8bpp
  339. ld a,#00
  340. out (#67),a ; MCLK = 0
  341. ld a,#06
  342. out (#64),a
  343. ld a,#96 ; B3 8bpp
  344. out (#63),a
  345. ld a,FREQ
  346. out (#63),a ; NTSC
  347. ld a,ENABLE
  348. out (#63),a ; display enabled / cursor enabled
  349. ret
  350. set_b3_16bpp
  351. ld a,#00
  352. out (#67),a ; MCLK = 0
  353. ld a,#06
  354. out (#64),a
  355. ld a,#97 ; B3 8bpp
  356. out (#63),a
  357. ld a,FREQ
  358. out (#63),a ; NTSC
  359. ld a,ENABLE
  360. out (#63),a ; display enabled / cursor enabled
  361. ret
  362. set_b4_2bpp
  363. ld a,#01
  364. out (#67),a ; MCLK = 1
  365. ld a,#06
  366. out (#64),a
  367. ld a,#a8 ; B2 8bpp
  368. out (#63),a
  369. ld a,FREQ
  370. out (#63),a ; NTSC
  371. ld a,ENABLE
  372. out (#63),a ; display enabled / cursor enabled
  373. ret
  374. set_b4_4bpp
  375. ld a,#01
  376. out (#67),a ; MCLK = 1
  377. ld a,#06
  378. out (#64),a
  379. ld a,#a9 ; B2 8bpp
  380. out (#63),a
  381. ld a,FREQ
  382. out (#63),a ; NTSC
  383. ld a,ENABLE
  384. out (#63),a ; display enabled / cursor enabled
  385. ret
  386. set_b4_8bpp
  387. ld a,#01
  388. out (#67),a ; MCLK = 1
  389. ld a,#06
  390. out (#64),a
  391. ld a,#aa ; B2 8bpp
  392. out (#63),a
  393. ld a,FREQ
  394. out (#63),a ; NTSC
  395. ld a,ENABLE
  396. out (#63),a ; display enabled / cursor enabled
  397. ret
  398. set_b4_16bpp
  399. ld a,#01
  400. out (#67),a ; MCLK = 1
  401. ld a,#06
  402. out (#64),a
  403. ld a,#ab ; B2 8bpp
  404. out (#63),a
  405. ld a,FREQ
  406. out (#63),a ; NTSC
  407. ld a,ENABLE
  408. out (#63),a ; display enabled / cursor enabled
  409. ret
  410. set_b7_2bpp
  411. ld a,#00
  412. out (#67),a ; MCLK = 0
  413. ld a,#06
  414. out (#64),a
  415. ld a,#a8 ; B3 2bpp
  416. out (#63),a
  417. ld a,FREQ
  418. out (#63),a ; NTSC
  419. ld a,ENABLE
  420. out (#63),a ; display enabled / cursor enabled
  421. ret
  422. set_b7_4bpp
  423. ld a,#00
  424. out (#67),a ; MCLK = 0
  425. ld a,#06
  426. out (#64),a
  427. ld a,#a9 ; B3 2bpp
  428. out (#63),a
  429. ld a,FREQ
  430. out (#63),a ; NTSC
  431. ld a,ENABLE
  432. out (#63),a ; display enabled / cursor enabled
  433. ret
  434. set_b7_8bpp
  435. ld a,#00
  436. out (#67),a ; MCLK = 0
  437. ld a,#06
  438. out (#64),a
  439. ld a,#aa ; B3 2bpp
  440. out (#63),a
  441. ld a,FREQ
  442. out (#63),a ; NTSC
  443. ld a,ENABLE
  444. out (#63),a ; display enabled / cursor enabled
  445. ret
  446. set_b7_16bpp
  447. ld a,#00
  448. out (#67),a ; MCLK = 0
  449. ld a,#06
  450. out (#64),a
  451. ld a,#ab ; B3 2bpp
  452. out (#63),a
  453. ld a,FREQ
  454. out (#63),a ; NTSC
  455. ld a,ENABLE
  456. out (#63),a ; display enabled / cursor enabled
  457. ret
  458. init_regs
  459. db #00,#00,#82,#00 ; r#8 -> display enable
  460. db #00,#00,#00,#00
  461. db #00,#00,#00,#00
  462. db #00,#00,#00,#00
  463. db #00,#00,#00,#00
  464. db #00,#00,#00
  465. ret ; not used
  466. LMMM_1 ld a,#20
  467. out (#64),a
  468. xor a
  469. out (#63),a
  470. out (#63),a ; SX = 0
  471. out (#63),a
  472. out (#63),a ; SY = 0
  473. out (#63),a
  474. out (#63),a ; DX = 0
  475. out (#63),a
  476. inc a
  477. out (#63),a ; DY = 256
  478. xor a
  479. out (#63),a
  480. inc a
  481. out (#63),a ; NX = 256
  482. ld a,l
  483. out (#63),a
  484. ld a,h
  485. out (#63),a ; NY = hl
  486. ld a,#34
  487. out (#64),a
  488. ret
  489. LMMM_2 ld a,#40 ; LMMM
  490. out (#63),a
  491. ret
  492. BMLL_1 ld a,#20
  493. out (#64),a
  494. xor a
  495. out (#63),a
  496. out (#63),a
  497. out (#63),a
  498. out (#63),a ; srcAddr = 0
  499. out (#63),a
  500. out (#63),a
  501. out (#63),a
  502. ld a,#04
  503. out (#63),a ; dstAddr = 0x40000
  504. xor a
  505. out (#63),a
  506. out (#63),a
  507. ld a,l
  508. out (#63),a
  509. ld a,h
  510. out (#63),a ; numBytes = hl * 256
  511. ld a,#34
  512. out (#64),a
  513. ret
  514. BMLL_2 ld a,#a0 ; BMLL
  515. out (#63),a
  516. ret
  517. BMXL_1 ld a,#20
  518. out (#64),a
  519. xor a
  520. out (#63),a
  521. out (#63),a
  522. out (#63),a
  523. out (#63),a ; srcAddr = 0
  524. out (#63),a
  525. out (#63),a ; DX = 0
  526. out (#63),a
  527. ld a,#02
  528. out (#63),a ; DY = 512
  529. xor a
  530. out (#63),a
  531. inc a
  532. out (#63),a ; NX = 256
  533. ld a,l
  534. out (#63),a
  535. ld a,h
  536. out (#63),a ; NY = hl
  537. ld a,#34
  538. out (#64),a
  539. ret
  540. BMXL_2 ld a,#80 ; BMXL
  541. out (#63),a
  542. ret
  543. BMLX_1 ld a,#20
  544. out (#64),a
  545. xor a
  546. out (#63),a
  547. out (#63),a ; SX = 0
  548. out (#63),a
  549. out (#63),a ; SY = 0
  550. out (#63),a
  551. out (#63),a
  552. out (#63),a
  553. ld a,#04
  554. out (#63),a ; dstAddr = 0x40000
  555. xor a
  556. out (#63),a
  557. inc a
  558. out (#63),a ; NX = 256
  559. ld a,l
  560. out (#63),a
  561. ld a,h
  562. out (#63),a ; NY = hl
  563. ld a,#34
  564. out (#64),a
  565. ret
  566. BMLX_2 ld a,#90 ; BMLX
  567. out (#63),a
  568. ret
  569. LMMV_1 ld a,#24
  570. out (#64),a
  571. xor a
  572. out (#63),a
  573. out (#63),a ; DX = 0
  574. out (#63),a
  575. ld a,#04
  576. out (#63),a ; DY = 1024
  577. xor a
  578. out (#63),a
  579. inc a ; NX = 256
  580. out (#63),a
  581. ld a,l
  582. out (#63),a
  583. ld a,h ; NY = hl
  584. out (#63),a
  585. ld a,#30
  586. out (#64),a
  587. out (#63),a
  588. out (#63),a ; FC = #3030
  589. ld a,#34
  590. out (#64),a
  591. ret
  592. LMMV_2 ld a,#20 ; LMMV
  593. out (#63),a
  594. ret
  595. cmd_common
  596. ld a,#2c
  597. out (#64),a
  598. xor a
  599. out (#63),a ; ARG = 0
  600. ld a,#1c
  601. out (#63),a ; LOGOP = 0x1C (TPSET)
  602. ld a,#ff
  603. out (#63),a
  604. xor a
  605. out (#63),a ; WM = 0x00FF
  606. ret
  607. cmd_common_2
  608. ld a,#2c ; not used
  609. out (#64),a
  610. xor a
  611. out (#63),a ; ARG = 0
  612. ld a,#0c
  613. out (#63),a ; LOGOP = 0x0C (PSET)
  614. ld a,#ff
  615. out (#63),a
  616. xor a
  617. out (#63),a ; WM = 0x00FF
  618. ret
  619. print_results
  620. ld ix,hexout
  621. ld iy,result
  622. call prthex
  623. call prthex
  624. call prthex
  625. call prthex
  626. call prthex
  627. ret
  628. prthex ld hl,digits
  629. ld d,0
  630. ld a,(iy+#01)
  631. srl a
  632. srl a
  633. srl a
  634. srl a
  635. ld e,a
  636. add hl,de
  637. ld a,(hl)
  638. ld (ix+#00),a
  639. ld hl,digits
  640. ld a,(iy+#01)
  641. and #0f
  642. ld e,a
  643. add hl,de
  644. ld a,(hl)
  645. ld (ix+#01),a
  646. ld hl,digits
  647. ld a,(iy+#00)
  648. srl a
  649. srl a
  650. srl a
  651. srl a
  652. ld e,a
  653. add hl,de
  654. ld a,(hl)
  655. ld (ix+#02),a
  656. ld hl,digits
  657. ld a,(iy+#00)
  658. and #0f
  659. ld e,a
  660. add hl,de
  661. ld a,(hl)
  662. ld (ix+#03),a
  663. ld de,#0005
  664. add ix,de
  665. inc iy
  666. inc iy
  667. ret