{"id":20760987,"url":"https://github.com/tophercantrell/ay38910","last_synced_at":"2025-03-11T17:18:29.564Z","repository":{"id":254038058,"uuid":"776411856","full_name":"topherCantrell/AY38910","owner":"topherCantrell","description":null,"archived":false,"fork":false,"pushed_at":"2024-11-28T12:18:04.000Z","size":1376,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-18T05:29:45.386Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/topherCantrell.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":"2024-03-23T12:41:26.000Z","updated_at":"2024-11-28T12:18:08.000Z","dependencies_parsed_at":"2024-11-28T16:18:25.762Z","dependency_job_id":null,"html_url":"https://github.com/topherCantrell/AY38910","commit_stats":null,"previous_names":["tophercantrell/ay38910"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/topherCantrell%2FAY38910","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/topherCantrell%2FAY38910/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/topherCantrell%2FAY38910/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/topherCantrell%2FAY38910/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/topherCantrell","download_url":"https://codeload.github.com/topherCantrell/AY38910/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243076603,"owners_count":20232438,"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":[],"created_at":"2024-11-17T10:17:03.787Z","updated_at":"2025-03-11T17:18:29.540Z","avatar_url":"https://github.com/topherCantrell.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AY38910\n\n| Game        | CPU  | Chips | Sound Frequency        | Caps      | CPU Freq |\n| ---         | ---  | ---   | ---                    | ---       | ---      |\n| Time Pilot  | Z80  | 2     | 14.318M / 8 = 1.78975M | .22 .047  | 1.78975M |\n| Moon Patrol | 6803 | 2     | 3.579M / 4 = 0.89475M  | None      | 0.89475M |\n| Forgger     | Z80  | 1     | 14.318M / 8 = 1.78975M | .22 .047  | 1.78975M |\n| Scramble    | Z80  | 2     | 14.318M / 8 = 1.78975M | .22 .047  | 1.78975M |\n| Omega Race  | Z80  | 2     | 15M / 12 = 1.25M       | None      | 1.5M     |\n| 1942        | Z80  | 2     | 12M / 4 = 3M           | None      | 1.5M     |\n| Tron        | Z80  | 2     | 2M                     | TODO      | 2M       |\n| Spy Hunter  | Z80  | 2     | 2M                     | TODO      | 2M       |\n\nThe AY understands 3.3V signals. But if you read from the chip, it will return 5V signals, which\nwill damage a 3.3V micro.\n\nI tried using the 3.3-5V converter boards, but I had trouble with two AYs on the data bus. I can read\nfrom one AY just fine. But a second AY confuses the read. Writing to an AY with two on the bus works\njust fine.\n\n# Z80 on the rpi\n\nhttps://pypi.org/project/z80/\n\n```\nmkdir z80\ncd z80\ngit clone https://github.com/kosarev/z80.git\nsudo apt-get install cmake\ncmake z80\nmake # There are errors compiling one of the tests, but the main library compiles.\nmake test\nmake hello  # Or 'make examples' to build all examples at once.\n```\n\nThen the python wrapper:\n\n```\npython3 -m pip install z80\n```\n\nHave a look at the py files in the examples folder.\n\n# Reading the Macro Pad\n\nhttps://python-evdev.readthedocs.io/en/latest/tutorial.html\n\n```\npython3 -m pip install evdev\n```\n\n```python\nfrom evdev import InputDevice, categorize, ecodes\ndev = InputDevice('/dev/input/event0')\n\nprint(dev)\ndevice /dev/input/event1, name \"Dell Dell USB Keyboard\", phys \"usb-0000:00:12.1-2/input0\"\n\nfor event in dev.read_loop():\n    if event.type == ecodes.EV_KEY:\n        print(categorize(event))\n\n```\n\n# Effects\n\n  - A Coin inserted\n  - B Hop\n  - C Die in water\n  - D Die in road\n  - E Time running out\n  - F Next life begins\n  - G Extra frog\n  - H Landing safe\n  - I Pick up mate\n  - J Snake\n  - K Race car\n  - L Level complete\n  - M Music: Intro\n  - N Music: Main\n  - O Play Intro+Main\n  - P Music: Game over\n  - Q Play next interlude\n  - a-t Music: Interlude (20 songs)\n\n# Managing the Frogger sound code\n\nThere are 14 spots of IN/OUT. They are all to port 0x40 or 0x80.\n\nThe main CPU signals the sound CPU with an interrupt. The sound CPU reads the command value from\nthe AY register 0x0E. The main loop enables interrupts briefly to check for new commands.\n\nCapacitor filters set by reading from 0x6XXX.\n\nStartup:\n  - Clears RAM 4000 throiugh 43FF\n  - Set SP to 4400\n  - AR:7 = 3F (everything off, both I/O as inputs)\n  - Amplitudes to 0\n\n0136: Main loop\n  - Wait for AY Port B to have bit 4 clear (700Hz sound loop)\n  - Interrupts are on while waiting\n  - Wait for AY Port B to set bit 4 clear\n  - Process all 3 voices one by one\n  - Turn interrupts on briefly between the voices\n\nWe'll assume that interrupts are checked/called in the python port B check","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftophercantrell%2Fay38910","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftophercantrell%2Fay38910","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftophercantrell%2Fay38910/lists"}