{"id":7539846,"url":"https://github.com/FluBBaOfWard/WSHWTest","last_synced_at":"2025-05-09T23:32:36.150Z","repository":{"id":135717766,"uuid":"594838319","full_name":"FluBBaOfWard/WSHWTest","owner":"FluBBaOfWard","description":"Hardware test suite for WonderSwan","archived":false,"fork":false,"pushed_at":"2025-04-07T16:22:04.000Z","size":115,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-07T17:33:24.387Z","etag":null,"topics":["bandai-wonderswan","testing-tools","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":"2023-01-29T19:40:58.000Z","updated_at":"2025-04-07T16:22:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"ad3a5159-54d5-409e-8b65-d31a142b979d","html_url":"https://github.com/FluBBaOfWard/WSHWTest","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FluBBaOfWard%2FWSHWTest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FluBBaOfWard%2FWSHWTest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FluBBaOfWard%2FWSHWTest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FluBBaOfWard%2FWSHWTest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FluBBaOfWard","download_url":"https://codeload.github.com/FluBBaOfWard/WSHWTest/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":["bandai-wonderswan","testing-tools","wonderswan"],"created_at":"2024-04-08T00:09:06.697Z","updated_at":"2025-05-09T23:32:36.126Z","avatar_url":"https://github.com/FluBBaOfWard.png","language":"Assembly","funding_links":[],"categories":["Accuracy test ROMs"],"sub_categories":["Peripherals"],"readme":"# WSHWTest V0.2.0 (20250410)\n\nHardware test suite for WonderSwan\nThese descriptions are my interpretation of what is happening, that doesn't mean this is actualy what is happening, I'm open to pull requests for both code and interpretations of how things work.\n\nThere are also 2 other test programs that I have made.\n\n* [WSCPUTest](https://github.com/FluBBaOfWard/WSCpuTest) - Tests functions of the NEC V30MZ CPU instructions.\n* [WSTimingTest](https://github.com/FluBBaOfWard/WSTimingTest) - Tests timing of the NEC V30MZ CPU instruction.\n\n## Start Registers\n\nOn all boot roms in all modes:\nSP is set to 0x2000.\nPS/CS is set to start segment, if booting in PCV2 mode it's set to 0x4000.\nDS0/DS is set to boot rom base (0xFF00 for ASWAN and 0xFE00 for SPHINX/SPHINX2).\n\n## Interrupts\n\nIt's important to make distinction between the actual CPU part and the interrupt manager/handler. Even though they are part of the same physical chip in the WonderSwan they are logicaly different parts. The interrupt manager can set the interrupt pin high or low on the CPU and then it can supply an interrupt vector on the low 8 bits of the databus when the cpu request it (when it wants to take an interrupt).\n\nThe interrupt manager latches all enabled incoming interrupt requests until they are acknowledged with a write to port 0xB6, the interrupt requests are not cleared by disabling them through 0xB2. The 2 Timer interrupts, VBlank, Line Compare \u0026 Key interrupts are edge sensitive  and latched (remembered) until they are acknowledged. The serial \u0026 cartridge interrupts are latched as well but they can't be acknowledged as long as they are enabled and asserted by the corresponding device.\n\nAll interrupts that are latched and visible in 0xB4 also cause interrupts if/when the cpu is able to accept them.\n\nThe interrupt pin on the cpu is asserted as long as there are bits set in 0xB4, the interrupt manager allways sends the vector for the highest enabled interrupt.\n\n## Timers\n\nThe timer logic is a bit backwards, the on/off bit is used to write back the downcounted value, the downcount always happens, this means that if the timer is off and the counter value is 1 an interrupt will happen but zero is not written back to the counter so it's basicly the same as timer on with repeat.\nWriting to the timer values instantly updates the counter value.\nToggling the Timer on/off doesn't reload the counter value, it just pauses / resumes the counter.\n\nSo what happens is:\n\n1. Check if counter is zero, if so stop doing anything more.\n2. Count down counter, if it's now zero tell the interrupt manager.\n3. If counted down value was zero, check repeat bit and fetch timer value.\n4. Is Timer on? Write back downcounted/timer value to counter.\n\n## IO Registers\n\nThis tests the writability of the IO registers, this does not test the functionality of the registers. Not all registers are tested.\n\n## LCD off\n\nThis turns on the Star icon and sleep mode for the LCD, turns off all interrupts except KEY.\nIt waits for a KEY interrupt and then disables LCD sleep \u0026 star icon.\nKey interrupt seem to always happen on row 0x90.\n\n### IO Startup Values\n\nASWAN IO Registers:\n\n```text\n0x00 = 0\n0x01 = 0\n0x02 = 0x01\n0x03 = 0x40/0x20\n0x04 = 0\n0x05 = 0\n0x06 = 0\n0x07 = rnd\n0x08 = 0x10\n0x09 = 0x60\n0x0A = 0\n0x0B = 0\n0x0C = 0x8A\n0x0D = 0/0x40?\n0x0E = 0x10\n0x0F = 0x04\n0x10-0x13 = rnd\n0x14 = 0\n0x15 = 0\n0x16 = 0x9C\n0x17 = 0x92\n0x18 = 0x90\n0x19 = 0x90\n0x1A = 0x00/0x20/0x22, depending on if cart ok / headphones are connected or not.\n0x1B = 0\n0x1C-0x3F = rnd\n0x40-7F = 0x90\n0x80-0x8D = rnd\n0x8E = 0\n0x8F = rnd\n0x90 = 0\n0x91 = 0x00/0x80, depending on if headphones are connected or not.\n0x92,0x93 = 0\n0x94 = rnd, often 0\n0x95-0x9D = 0\n0x9E-0x9F = 0x90\n0xA0 = 0x04\n0xA1 = 0x90\n0xA2-0xA4 = 0\n0xA5-0xA7 = rnd\n0xA8-0xB0 = 0\n0xAC-0xAF = 0x90\n0xB0 = 0\n0xB1 = rnd (0x25/0x27/0xA5)\n0xB2-0xB7 = 0\n0xB8,0xB9 = 0x90\n0xB8-0xBF = 0\n```\n\nSphinx IO Registers:\n\n```text\n0x00 = 0\n0x01 = 0\n0x02 = 0x01\n0x03 = rnd (0xB9/0xBB/0xBD)\n0x04 = 0\n0x05 = 0\n0x06 = 0\n0x07-0x12 = rnd\n0x13 = 0x07/0x87?\n0x14 = 0\n0x15 = 0\n0x16 = 0x9E\n0x17 = 0x9B\n0x18 = 0\n0x19 = 0\n0x1A = 0x00/0x20/0x22, depending on if cart ok / headphones are connected or not.\n0x1B = 0\n0x1C-0x3F = rnd\n0x40-5F = 0\n0x60 = 0x0A\n0x61-0x6A = 0\n0x6B = 0x0F\n0x6C-0x7F = 0\n0x80-0x8D = rnd\n0x8E = 0\n0x8F = rnd\n0x90 = 0\n0x91 = 0x00/0x80, depending on if headphones are connected or not.\n0x92,0x93 = 0\n0x94 = rnd\n0x95-0x9F = 0\n0xA0 = 0x06\n0xA1-0xA3 = 0\n0xA4-0xA7 = rnd\n0xA8-0xB0 = 0\n0xB1 = rnd (0x25/0x27/0xA5)\n0xB2-0xBF = 0\n```\n\nSphinx2 IO Registers:\n\n```text\n0x00 = 0\n0x01 = 0\n0x02 = 0x01\n0x03 = rnd (0x1A)\n0x04 = 0\n0x05 = 0\n0x06 = 0\n0x07-0x12 = rnd\n0x13 = 0x30?\n0x14 = 0\n0x15 = 0\n0x16 = 0x9E\n0x17 = 0\n0x18 = 0\n0x19 = 0\n0x1A = 0x00/0x20/0x22, depending on if cart ok / headphones are connected or not.\n0x1B = 0\n0x1C-0x3F = rnd\n0x40-5F = 0\n0x60 = 0x0A\n0x61 = 0\n0x62 = 0x80\n0x63-0x6A = 0\n0x6B = 0x0F\n0x6C-0x6F = 0\n0x70-0x77 = SC LCD values (0xd0, 0x77, 0xf7, 0x06, 0xe2, 0x0a, 0xea, 0xee)\n0x78-0x7F = 0\n0x80-0x8D = rnd\n0x8E = 0\n0x8F = rnd\n0x90 = 0\n0x91 = 0x00/0x80, depending on if headphones are connected or not.\n0x92,0x93 = 0\n0x94 = 0x04?\n0x95-0x9F = 0\n0xA0 = 0x06\n0xA1-0xA3 = 0\n0xA4-0xA7 = rnd\n0xA8-0xB0 = 0\n0xB1 = rnd (0xe0?)\n0xB2-0xBF = 0\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFluBBaOfWard%2FWSHWTest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFluBBaOfWard%2FWSHWTest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFluBBaOfWard%2FWSHWTest/lists"}