IRF Posted February 26, 2021 Report Share Posted February 26, 2021 Ah, I get what you mean now, Norman Sword. It's more efficient with the Guardian Classes to use several instances of a single Guardian Class in The Attic, and adjust each of them vertically when building the room before Willy enters (to create the sinuous shape of the Centipede/Bug/whatever), rather than using difference Guardian Classes for each segment. Quote Link to comment Share on other sites More sharing options...
Norman Sword Posted February 26, 2021 Report Share Posted February 26, 2021 (edited) This has been tested and works exactly as specified. It needs the room data changing to stop the giant heads being shifted and the forgotten Abbey and the attic data being shifted- An easy enough task Half an hour to write. Somewhere near the end of the room set up a call is made to rephase_room The data at offset #e0 in every room is changed to #00 modify the sprites or #ff leave alone. Or the bits in the byte signal which sprites must be left alone. So writing 1110 0000b would instruct the routine to leave the first three sprites alone. ( eg. stop it phase shifting the big heads if they are the first 3 sprites in a room) random_sp equ #80e0 return_2_me equ #91b6 entity1 equ #8100 ; rephase a room rephase_room: ld hl,random_sp ; this address is any free byte in the room data - each room needs this setting up - most rooms can be left as zero ld a,(hl) cp #ff ret z ld c,a ; this is the entity bit move mask ;initialise the guardians ld a,#c9 ld (return_2_me),a ; modify the next sprite entry - return2 me is at address #91b6 LD IX,entity1 ; Point IX at the first byte of the first entity buffer at L8100 Phase_shift: ;test the end of sprite data then test the bit held in c; this signals a possible move LD A,(Ix+0) inc a ; cp #ff jr z,no_more bit 7,c jr nz,a_static cALL RANDOM AND 127 INC A ; instead of INC B LD B,A SHIFT_IT PUSH BC CALL L90C4 ; MOVE THE SPRITE POP BC DJNZ SHIFT_IT a_static ld de,8 add ix,de rlc c jr Phase_shift ; ensure it is put back no_more ld a,#11 ;ld de,# ld (return_2_me),a ret ; the RANDOM routine does not produce RANDOM numbers it produces a sequence of numbers that is fixed in sequence. The number of digits in the sequence is large before it repeats. At machine speed calling random will produce a pattern based on its output. RANDOM: PUSH HL S_M_C_address equ $+1 LD HL,$-$ S_M_C_SEED equ $+1 LD A,$-$ xor (HL) XOR L XOR H inc hl res 5,h LD (S_M_C_address),HL LD (S_M_C_SEED),A POP HL RET ; *** NOTE *** only 6 rooms have a value that is not 0 (zero) - 7,20,28,39,42,48 ---- rooms value start at 1 in this list ; values for byte #e0 ;"The Off Licence" 1 db #00 ;"The Bridge" 2 db #00 ;"Under the MegaTree" 3 db #00 ;"At the Foot of the MegaTree" 4 db #00 ;"The Drive" 5 db #00 ;"The Security Guard" 6 db #00 ;"Entrance to Hades" 7 db 11100000b ;<<<<<<<<<<<<<< ;"Cuckoo's Nest" 8 db #00 ;"Inside the MegaTrunk" 9 db #00 ;"On a Branch Over the Drive" 10 db #00 ;"The Front Door" 11 db #00 ;"The Hall" 12 db #00 ;"Tree Top" 13 db #00 ;"Out on a limb" 14 db #00 ;"Rescue Esmerelda" 15 db #00 ;"I'm sure I've seen this before.." 16 db #00 ;"We must perform a Quirkafleeg" 17 db #00 ;"Up on the Battlements" 18 db #00 ;"On the Roof" 19 db #00 ;"The Forgotten Abbey" 20 db #ff ;<<<<<<<<<<<<<<< ;"Ballroom East" 21 db #00 ;"Ballroom West" 22 db #00 "To the Kitchens Main Stairway" 23 db #00 ;"The Kitchen" 24 db #00 ;"West of Kitchen" 25 db #00 ;"Cold Store" 26 db #00 ;"East Wall Base" 27 db #00 ;"The Chapel" 28 db 11100000b ;<<<<<<<<<<<<<<< ;"First Landing" 29 db #00 ;"The Nightmare Room" 30 db #00 ;"The Banyan Tree" 31 db #00 ;"Swimming Pool" 32 db #00 ;"Halfway up the East Wall" 33 db #00 ;"The Bathroom" 34 db #00 ;"Top Landing" 35 db #00 ;"Master Bedroom" 36 db #00 ;"A bit of tree" 37 db #00 ;"Orangery" 38 db #00 ;"Priests' Hole" 39 db 11100000b ;<<<<<<<<<<<<<<< ;"Emergency Generator" 40 db #00 db Jones will never believe this" 41 db #00 ;"The Attic" 42 db #ff ;<<<<<<<<<<<<<<< ;"Under the Roof" 43 db #00 ;"Conservatory Roof" 44 db #00 ;"On top of the house" 45 db #00 ;"Under the Drive" 46 db #00 ;"Tree Root" 47 db #00 ;"[" 48 db #FF ; no sprite data ;<<<<<<<<<<<<<<< ;"Nomen Luni" 49 db #00 ;"The Wine Cellar" 50 db #00 ;"Watch Tower" 51 db #00 ;"Tool Shed" 52 db #00 "Back Stairway" 53 db #00 ;"Back Door" 54 db #00 ;"West Wing" 55 db #00 ;"West Bedroom" 56 db #00 ;"West Wing Roof" 57 db #00 ;"Above the west Bedroom" 58 db #00 ;"The Beach" 59 db #00 ;"The Yacht" 60 db #00 ;"The Bow" 61 db #00 The data followed by ;<<<<<<<<<<< is indicating values that are NOT zero Edited March 1, 2021 by Norman Sword corrections - and probably more to come jetsetdanny, Spider, andrewbroad and 1 other 3 1 Quote Link to comment Share on other sites More sharing options...
IRF Posted February 26, 2021 Report Share Posted February 26, 2021 (edited) Nice one Norman! Offset #8E in JSW is in the middle of the room name, but there are plenty of other unused offset bytes (such as #DF). I notice that in this sequence: INC B LD B,A The INC B appears to be redundant as B is immediately overwritten by A... should it be an INC A? Edited February 26, 2021 by IRF jetsetdanny 1 Quote Link to comment Share on other sites More sharing options...
Norman Sword Posted February 26, 2021 Report Share Posted February 26, 2021 supposed to say #80e0- When I write these routines I do not have the original data. I have my own and I do not use direct memory references, I have to work backward and calculate where the original might have been. Yes it should be INC A. I will slowly correct whatever I see as being incorrect. It does however work as seen. The problems arise most of the time from having to change most of the code to fit in with the original data/layout. So I will do another edit/update and change the { inc b } to { inc a } jetsetdanny and IRF 2 Quote Link to comment Share on other sites More sharing options...
IRF Posted February 26, 2021 Report Share Posted February 26, 2021 I've just realised the purpose behind the INC instruction - it's so that B isn't assigned a value of zero going into the start of the DJNZ loop (otherwise the loop would be executed 256 times, slowing the process down). jetsetdanny and Spider 2 Quote Link to comment Share on other sites More sharing options...
Norman Sword Posted February 26, 2021 Report Share Posted February 26, 2021 Yes a 256 loop when b=0 with DJNZ. The edits I do when I change the code from the original (as written in my own version) to the version that is seen above. Create more problems as I go along. I constantly change the code from the original layout, without any checking/testing. Sometimes those modification create all the subsequent edits I need to do. I think it is 99% there. Spider and IRF 2 Quote Link to comment Share on other sites More sharing options...
RuffledBricks Posted February 27, 2021 Author Report Share Posted February 27, 2021 On 2/26/2021 at 12:01 AM, IRF said: Question: shouldn't that be the other way round for the Attic Centipede? i.e. the horizontal position of each segment is fixed, whilst the vertical position varies? I just imagined a randomised version of Attic Centipede and laughed out loud. Spider 1 Quote Link to comment Share on other sites More sharing options...
IRF Posted February 27, 2021 Report Share Posted February 27, 2021 Something like the Human Centipede from the movies? That's some 'Attic Bug'! 😜 jetsetdanny and Spider 2 Quote Link to comment Share on other sites More sharing options...
Norman Sword Posted March 1, 2021 Report Share Posted March 1, 2021 DSCF9962.MOV The centipede moving with a smoother path. RuffledBricks, andrewbroad, IRF and 1 other 3 1 Quote Link to comment Share on other sites More sharing options...
MtM Posted March 1, 2021 Report Share Posted March 1, 2021 Norman, is that a crt that The Attic is displayed on? Lovely colours anyway, it looks superb. 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.