{"id":13344398,"url":"https://github.com/DW0RKiN/Flood-fill","last_synced_at":"2025-03-12T07:33:08.586Z","repository":{"id":111270390,"uuid":"42370884","full_name":"DW0RKiN/Flood-fill","owner":"DW0RKiN","description":"Flood fill algorithm for ZX Spectrum","archived":false,"fork":false,"pushed_at":"2015-09-15T16:28:12.000Z","size":780,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-07-30T21:10:03.779Z","etag":null,"topics":["compo","flood-fill-algorithm","z80","zx-spectrum"],"latest_commit_sha":null,"homepage":null,"language":"Assembly","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DW0RKiN.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-12T19:53:14.000Z","updated_at":"2021-03-29T09:15:03.000Z","dependencies_parsed_at":"2023-03-05T09:05:54.482Z","dependency_job_id":null,"html_url":"https://github.com/DW0RKiN/Flood-fill","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/DW0RKiN%2FFlood-fill","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DW0RKiN%2FFlood-fill/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DW0RKiN%2FFlood-fill/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DW0RKiN%2FFlood-fill/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DW0RKiN","download_url":"https://codeload.github.com/DW0RKiN/Flood-fill/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221279964,"owners_count":16790562,"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":["compo","flood-fill-algorithm","z80","zx-spectrum"],"created_at":"2024-07-29T19:33:08.687Z","updated_at":"2024-10-24T05:30:35.010Z","avatar_url":"https://github.com/DW0RKiN.png","language":"Assembly","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flood-fill\nFlood fill algorithms optimizing for minimum memory ( Z80 / ZX Spectrum )\n\nContribution to competition Size Z80 Programming Challenge #5\n\nhttp://www.retroprogramming.com/2015/07/z80-size-programming-challenge-5.html\n\nmin-size-fill.asm \n------------------\n171 bytes + 10 bytes stack\n\nRight hand flood fill algorithm \n\n    LOOPING_MODE = false;\n    set DIRECTION;\n    set MASK;\n\n    while ( 1 ) {\n\n    TEST_1:         // Drzime se prave steny\n    if MASK == ? ? ?\n               ?   0\n               ? ? ? TURN_RIGHT();\n\n    TEST_2:         // Jsme zazdeni?\n    if MASK == ? 1 ?\n               1   1\n               ? 1 ? { DRAW_PIXEL(); EXIT; }\n    \n    TEST_3:         // Slepa ulicka?  \n    if MASK == ? 0 ?\n               1   1\n               ? 1 ? { FILL_AND_STEP(); continue; }\n\n    TEST_4:         // Prekazka?\n    if MASK == ? 1 ?\n               ?   ?\n               ? ? ? { TURN_LEFT(); continue; }\n\n    TEST_5:         // Brana?   . 0 .     ? 0 ?      ? 0 1\n                    //          1   ? =\u003e  1   1  or  1   0\n                    //          . . .     ? ? ?      ? ? ?\n    if MASK == ? ? ?\n               1   ?\n               ? ? ? { STEP(); continue; }\n\n    TEST_6:         // Slouporadi\n    if MASK == ? 0 1      1 0 ?      ? ? ?      ? ? ?\n               ?   0  or  0   ?  or  0   ?  or  ?   0\n               ? ? ?      ? ? ?      1 0 ?      ? 0 1 { STEP(); continue; }\n\n    FILL_AND_STEP(); \n\n    }\n\n    ; --------------\n    FILL_AND_STEP() {\n       DRAW_PIXEL;\n       LOOPING_MODE = false;\n       NOW_XY += DIRECTION;\n       set MASK;\n    }\n\n    ; -------------\n    STEP() {\n    \n    if ( LOOPING_MODE ) {\n    \n       if ( BEGIN_LOOP_XY == NOW_XY )) {\n            if ( LOOP_DIRECTION == NOW_DIRECTION ) { \n                FILL_AND_STEP(); \n                return; \n            } else { \n                LOOPING_MODE = false; \n                NOW_DIRECTION = LOOP_DIRECTION;  // smer musime dodrzet, hrozi zacykleni\n                // lepsi je ale zakazat LOOPING_MODE dokud neprojdu krizovatkou\n            }\n        }\n    } else {\n        ; Je to krizovatka? Tzn. ma krome mezery vepredu jeste 2 mezery\n        if  ! ( MASK == ? ? ?       ? ? ?      ? ? ?      ? ? ?\n                        1   0  or   0   1  or  0   0  or  0   0\n                        ? 0 ?       ? 0 ?      ? 0 ?      ? 1 ? ) { \n            LOOPING_MODE = true;  \n            LOOP_BEGIN_XY = NOW_XY; \n            LOOP_DIRECTION = NOW_DIRECTION;\n        }\n    }\n    \n    NOW_XY += DIRECTION;\n    set MASK;\n    \n    }\n    \n\nqueue-fill.asm\n--------------\n84 bytes\n\nVyplneni pomoci emulace fronty na zasobniku. Musi byt vypnute preruseni, protoze v urcitem okamziku pomalu presouvame SP az k zarazce a pak ho vratime zpet na puvodni hodnotu. Mezitim se ale nesmi prepsat data co lezi mezi temito adresami na zasobniku prerusenim.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDW0RKiN%2FFlood-fill","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDW0RKiN%2FFlood-fill","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDW0RKiN%2FFlood-fill/lists"}