{"url":"https://api.github.com/repos/stella-emu/stella/issues/173","repository_url":"https://api.github.com/repos/stella-emu/stella","labels_url":"https://api.github.com/repos/stella-emu/stella/issues/173/labels{/name}","comments_url":"https://api.github.com/repos/stella-emu/stella/issues/173/comments","events_url":"https://api.github.com/repos/stella-emu/stella/issues/173/events","html_url":"https://github.com/stella-emu/stella/issues/173","id":242114268,"node_id":"MDU6SXNzdWUyNDIxMTQyNjg=","number":173,"title":"Inconsistent behaviour when reading from write-only TIA registers","user":{"login":"sa666666","id":16061066,"node_id":"MDQ6VXNlcjE2MDYxMDY2","avatar_url":"https://avatars.githubusercontent.com/u/16061066?v=4","gravatar_id":"","url":"https://api.github.com/users/sa666666","html_url":"https://github.com/sa666666","followers_url":"https://api.github.com/users/sa666666/followers","following_url":"https://api.github.com/users/sa666666/following{/other_user}","gists_url":"https://api.github.com/users/sa666666/gists{/gist_id}","starred_url":"https://api.github.com/users/sa666666/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sa666666/subscriptions","organizations_url":"https://api.github.com/users/sa666666/orgs","repos_url":"https://api.github.com/users/sa666666/repos","events_url":"https://api.github.com/users/sa666666/events{/privacy}","received_events_url":"https://api.github.com/users/sa666666/received_events","type":"User","user_view_type":"public","site_admin":false},"labels":[{"id":497208650,"node_id":"MDU6TGFiZWw0OTcyMDg2NTA=","url":"https://api.github.com/repos/stella-emu/stella/labels/possible%20regression","name":"possible regression","color":"ff7038","default":false,"description":"","archived_at":null,"archived_by":null}],"state":"closed","locked":false,"assignees":[],"milestone":null,"comments":5,"created_at":"2017-07-11T16:50:10Z","updated_at":"2017-07-11T19:49:52Z","closed_at":"2017-07-11T19:49:52Z","assignee":null,"author_association":"MEMBER","issue_field_values":[],"type":null,"active_lock_reason":null,"sub_issues_summary":{"total":0,"completed":0,"percent_completed":0},"issue_dependencies_summary":{"blocked_by":0,"total_blocked_by":0,"blocking":0,"total_blocking":0},"body":"This is from http://atariage.com/forums/topic/259633-testing-the-new-stella-tia-core/page-15#entry3803462.  Basically, the ROM shows pink invaders in Stella 5.0, and white in Stella 4.0 (and all other emulators).  I think I fixed this in Stella 4.x, but it may be a regression in the current core.\r\n\r\nIn the current code:\r\n>// If pins are undriven, we start with the last databus value\r\n>// Otherwise, there is some randomness injected into the mix\r\n>// In either case, we start out with D7 and D6 disabled (the only\r\n>// valid bits in a TIA read), and selectively enable them\r\n>uInt8 lastDataBusValue =\r\n    !myTIAPinsDriven ? mySystem->getDataBusState() : mySystem->getDataBusState(0xFF);\r\n> ...\r\n>return (result & 0xC0) | (lastDataBusValue & 0x3F);\r\n\r\nNote that this seems to sometimes enable the upper 2 bits.\r\n\r\nFrom Stella 4.x: \r\n>// If pins are undriven, we start with the last databus value\r\n>// Otherwise, there is some randomness injected into the mix\r\n>// In either case, we start out with D7 and D6 disabled (the only\r\n>// valid bits in a TIA read), and selectively enable them\r\n>uInt8 value = 0x3F & (!myTIAPinsDriven ? mySystem->getDataBusState() :\r\n>                        mySystem->getDataBusState(0xFF));\r\n>  ...\r\n>// This shouldn't happen, but if it does, we essentially just\r\n>// return the last databus value with bits D6 and D7 zeroed out\r\n>return value;\r\n\r\nSo it seems that in Stella 4.x, bits D7 and D6 are always 0.  And in Stella 5.0, they can sometimes be 1.  Tests on real hardware seem to confirm that Stella 4.x is correct here.","closed_by":{"login":"sa666666","id":16061066,"node_id":"MDQ6VXNlcjE2MDYxMDY2","avatar_url":"https://avatars.githubusercontent.com/u/16061066?v=4","gravatar_id":"","url":"https://api.github.com/users/sa666666","html_url":"https://github.com/sa666666","followers_url":"https://api.github.com/users/sa666666/followers","following_url":"https://api.github.com/users/sa666666/following{/other_user}","gists_url":"https://api.github.com/users/sa666666/gists{/gist_id}","starred_url":"https://api.github.com/users/sa666666/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sa666666/subscriptions","organizations_url":"https://api.github.com/users/sa666666/orgs","repos_url":"https://api.github.com/users/sa666666/repos","events_url":"https://api.github.com/users/sa666666/events{/privacy}","received_events_url":"https://api.github.com/users/sa666666/received_events","type":"User","user_view_type":"public","site_admin":false},"reactions":{"url":"https://api.github.com/repos/stella-emu/stella/issues/173/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0},"timeline_url":"https://api.github.com/repos/stella-emu/stella/issues/173/timeline","performed_via_github_app":null,"state_reason":"completed","pinned_comment":null}