{"id":7539867,"url":"https://github.com/FluBBaOfWard/WSTimingTest","last_synced_at":"2025-05-09T23:32:34.451Z","repository":{"id":135717774,"uuid":"577877434","full_name":"FluBBaOfWard/WSTimingTest","owner":"FluBBaOfWard","description":"Test the timing of the cpu in the WonderSwan","archived":false,"fork":false,"pushed_at":"2023-09-10T10:19:06.000Z","size":172,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-16T08:32:10.398Z","etag":null,"topics":["assembly-x86","cpu-profiling","wonderswan"],"latest_commit_sha":null,"homepage":"","language":"Assembly","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FluBBaOfWard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-13T18:21:17.000Z","updated_at":"2023-03-26T10:47:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"e2d1fd53-009e-49dd-968d-62bfceb4b9c4","html_url":"https://github.com/FluBBaOfWard/WSTimingTest","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FluBBaOfWard%2FWSTimingTest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FluBBaOfWard%2FWSTimingTest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FluBBaOfWard%2FWSTimingTest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FluBBaOfWard%2FWSTimingTest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FluBBaOfWard","download_url":"https://codeload.github.com/FluBBaOfWard/WSTimingTest/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253341969,"owners_count":21893547,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["assembly-x86","cpu-profiling","wonderswan"],"created_at":"2024-04-08T00:09:13.358Z","updated_at":"2025-05-09T23:32:34.432Z","avatar_url":"https://github.com/FluBBaOfWard.png","language":"Assembly","readme":"# WonderSwan TimingTest V0.4.0 (20230909)\n\nThis is a program to test the timing of the CPU in a Bandai WonderSwan.\nThese results are not an absolute definition of how long an opcode takes, the cpu has an instruction pipeline which is flushed when branching, it takes 1 extra clock when branching to an odd address, it also seems to take more cycles depending on what the destination instruction is. I have tried to make the tests of jump/branch/call avoid these situations but I'm not sure I did it correctly everywhere.\nThe test loop also takes 1 more cycle than it should, I'm not sure why this is yet, in my emulator I check for 3 nops and add 1 extra cycle, this is not correct but is a way to test all opcode timings.\nYou can also not compare the result value between opcodes, the result value is for the whole test loop, not the individual opcode. Some opcodes require more glue code than other, please check the source code to see what is happening.\nThe program test _all_ opcodes, even the undefined ones, on the WonderSwan these are almost allways one or two byte nops, including 0x0F \u0026 0xFF 0x07.\nHalt (0xF4) test uses serial buffer empty interrupt, I also enable VBlank so that it can continue if serial interrupts are not suported.\nAll opcode names are in Intel notation and not in NEC notation.\n\n## How to use\n\nUse X4 (Left) \u0026 X2 (Right) to switch between pages.\nThe result values are number of scanlines to run the test loop for each test, the tests are run 1000 times right now which means that the number of clock cycles x 4 almost should be the test result. Some result values can differ by 1 during certain circumstances this is not an error but happens on HW as well.\nI have run the test on my Pink WonderSwan Color to get the results.\n\n## Cycle counting according to NEC\n\nThe normal cycle count is achieved when:\n\n1. Instruction decoding is completed. (I guess this is that the prefetch is filled).\n2. No wait state occurs during memory access or I/O access. (On the WS you can set the ROM to 3 wait states).\n3. There is no bus hold request.\n4. Word data is allocated to even addresses. (Word access to odd address adds 1 cycle)\n5. Registers required for calculating effective addresses (BX, BP, SP, SI, DI, etc.) do not change at immediately preceding instruction.\n6. There is only 1 register required for calculating effective addresses. (All tested instructions adds 2 cycles except LEA, LDS, LES \u0026 POP Word which only adds 1 cycle).\n7. The branching destination of a branch instruction is an even address. (Branching to odd address adds 1 cycle)\n\n## Credits\n\n```text\nFirst version by Robert Peip. https://github.com/RobertPeip\nAdditions and corrections by Fredrik Ahlström.\n\nThanks to:\nEd Mandy (Flavor) for WonderSwan info \u0026 flashcart. https://www.flashmasta.com\nKoyote for WonderSwan info.\nAlex Marshall (trap15) for WonderSwan info. http://daifukkat.su/docs/wsman/\nGuy Perfect for WonderSwan info http://perfectkiosk.net/stsws.html\nasie for info and inspiration.\nGodzil for boot rom stubs. https://github.com/Godzil/NewOswan\nlidnariq for RTC info.\n```\n\nTwitter/X @TheRealFluBBa\n\n\u003chttps://www.github.com/FluBBaOfWard\u003e\n","funding_links":[],"categories":["Accuracy test ROMs"],"sub_categories":["Peripherals"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFluBBaOfWard%2FWSTimingTest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFluBBaOfWard%2FWSTimingTest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFluBBaOfWard%2FWSTimingTest/lists"}