Norman Sword Posted February 6, 2018 Report Share Posted February 6, 2018 A flurry of posts whilst I sat with the above text in the editor. IRF 1 Quote Link to comment Share on other sites More sharing options...
IRF Posted February 6, 2018 Author Report Share Posted February 6, 2018 (edited) Thanks Norman - silly mistake I made using LD A,(HL) instead of LD A,L (picking up an actual value from the item table, rather than picking up the index pointing at that value). I notice the little optimisation at the end of the item-filter loop as well. :) Hopefully with those edits applied, the 128 room version will work too. Edited March 4, 2018 by IRF Quote Link to comment Share on other sites More sharing options...
IRF Posted March 6, 2018 Author Report Share Posted March 6, 2018 (edited) ; this code moves the tile in hl down by one line ; xor a ld d,a ld b,8 loop ld e,(hl) ;the current line or d ;the line above ld (hl),d ld d,e inc h djnz loop ; ; a=the accumalative value of the bits drawn ; or a ;if a value exists then the floor is still collapsing This permits a one pixel line to be moved down the screen How about this slight rewrite of the loop: xor a ld d,a ld b,8 loop ld e,(hl) ;the current line or d ;the line above ld (hl),d ld d,e ld a,h add a,c ld h,a djnz loop Set C=01 beforehand for regular crumbling tiles, or C=FF for bashing away at wall tiles from below(?) Edited March 8, 2018 by IRF Spider 1 Quote Link to comment Share on other sites More sharing options...
IRF Posted March 6, 2018 Author Report Share Posted March 6, 2018 (edited) Also, HL has to start off pointing at the top pixel-row of the cell in the case of a crumbly, or start off pointing at the bottom pixel-row for bashing a wall tile.Coming from 'Move Willy', HL starts off pointing at an attribute coordinate (#5Cxx or #5Dxx). Use PUSH and POP HL to preserve that address, for updating the attribute of the cell to Air once crumbling is complete.For a wall tile, use a similar approach as the 'old' crumbly tile code, in order to point HL at the bottom pixel-row:LD A,HADD A, #1BOR #07LD H,AFor a crumbly tile, point HL at the top pixel-row by using:LD A,HADD A, #1BAND #78LD H,AThe command in bold can be a common entry point to a shared part of the code (if the C register is used to increment or decrement H as per my previous post). Edited March 14, 2018 by IRF Spider 1 Quote Link to comment Share on other sites More sharing options...
IRF Posted March 12, 2018 Author Report Share Posted March 12, 2018 How about this slight rewrite of the loop: xor a ld d,a ld b,8 loop ld e,(hl) ;the current line or d ;the line above ld (hl),d ld d,e EX AF, AF' ld a,h add a,c ld h,a EX AF, AF' djnz loop Set C=01 beforehand for regular crumbling tiles, or C=FF for bashing away at wall tiles from below(?) Update: you would need to preserve A (e.g. by bookending the new code with two EX AF, AF' commands), so that after the loop has ended, A still holds a cumulative tally of all the infilled pixels in the cell. Spider 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.