{"action":"closed","issue":{"url":"https://api.github.com/repos/lronaldo/cpctelera/issues/85","repository_url":"https://api.github.com/repos/lronaldo/cpctelera","labels_url":"https://api.github.com/repos/lronaldo/cpctelera/issues/85/labels{/name}","comments_url":"https://api.github.com/repos/lronaldo/cpctelera/issues/85/comments","events_url":"https://api.github.com/repos/lronaldo/cpctelera/issues/85/events","html_url":"https://github.com/lronaldo/cpctelera/issues/85","id":367785254,"node_id":"MDU6SXNzdWUzNjc3ODUyNTQ=","number":85,"title":"cpct_px2byteM0 not working properly when accessing dc_mode0_ct table produces an 8 bit overflow","user":{"login":"johnlobo","id":9567672,"node_id":"MDQ6VXNlcjk1Njc2NzI=","avatar_url":"https://avatars3.githubusercontent.com/u/9567672?v=4","gravatar_id":"","url":"https://api.github.com/users/johnlobo","html_url":"https://github.com/johnlobo","followers_url":"https://api.github.com/users/johnlobo/followers","following_url":"https://api.github.com/users/johnlobo/following{/other_user}","gists_url":"https://api.github.com/users/johnlobo/gists{/gist_id}","starred_url":"https://api.github.com/users/johnlobo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnlobo/subscriptions","organizations_url":"https://api.github.com/users/johnlobo/orgs","repos_url":"https://api.github.com/users/johnlobo/repos","events_url":"https://api.github.com/users/johnlobo/events{/privacy}","received_events_url":"https://api.github.com/users/johnlobo/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-10-08T13:16:17Z","updated_at":"2018-10-08T15:57:59Z","closed_at":"2018-10-08T15:57:59Z","author_association":"NONE","body":"In the code of cpct_px2byteM0 there is an initialization of the \"a\" registry using \"sub a\", apparently because in that way the carry flag is preserved... but in my code \"sub a\" actually resets the carry flag, what is generating a random number as reesult of the cpct_px2byteM0 function when the dc_mode0_ct is not 8 bit aligned.\r\n\r\n;; Pixel colour table defined in cpct_drawCharM0\r\n.globl dc_mode0_ct\r\n\r\n;; Macro that computes A = *(DE + A)\r\n;;  to access vales stored in tables pointed by DE\r\n;;\r\n.macro A_eq__DEplusA__\r\n   ;; Compute DE += A\r\n   add   e               ;; [1] | E += A\r\n   ld    e, a            ;; [1] |\r\n   sub   a               ;; [1] A = 0 (preserving Carry Flag)    <----------------  HERE \r\n   adc   d               ;; [1] | D += Carry\r\n   ld    d, a            ;; [1] |\r\n\r\n   ;; A = *(DE + A)\r\n   ld    a, (de)         ;; [2] A = Value stored at the table pointed by DE \r\n.endm\r\n....\r\n\r\nIt could be fixed replacing \"sub a\" by \"ld a, 0\".\r\n"}}
{"actor":{"display_login":"lronaldo"}}