Jump to content
Jet Set Willy & Manic Miner Community

source code for JSW


Norman Sword

Recommended Posts

I have edited three posts to remove the conflict of BLOCK_MOVE32: being used with differing routines.

The routine that uses a long line of ldi's and returns without decrementing the "A" register has had its labels changed

 

That block move now uses the labels BLOCKX_MOVE32 and BLOCKX_MOVE31. the inclusion of the X mid label hopefully removing confusion between two very similar routines, which are mentioned sporadically over a few posts.  

Edited by Norman Sword
Link to comment
Share on other sites

I suppose you could modify this routine to use a similar raster copy routine as the one posted above.

Surely the raster copy code would have to revert back to your earlier method of using the Accumulator to keep track of when it is time to copy a row of attributes. Because if you are using the shared (and not self-modified) subroutine Shift_block32, then that subroutine always RETurns with the same conditionality of the Overflow Flag.

 

e.g. use the same code as in this post, only replacing the two LDIR commands with CALLs to Shift_block32:

http://jswmm.co.uk/topic/299-file-jsw-jagged-finger-effect-demo/page-4?do=findComment&comment=6069

Edited by IRF
Link to comment
Share on other sites

All the raster copy posts under the heading "source code for JSW" work as stated. None use the piece of code listed back in APRIL 2017 and quoted in post #62.

Because you are reverting between differing pieces of code used over many years, I have expanded each reference to raster copy listed under "source code for JSW" to be self contained. Each and every version works and none use the "A" register.    

Link to comment
Share on other sites

Sorry, crossed wires - when you suggested "modify[ing] this routine to use a similar raster copy routine as the one posted above", I thought you were referring to amending the substantive raster routine, rather than self-modifying the subroutine to truncate it with a RET.  Hence my reference in my previous post to: "if you are using a shared (and not self-modified) subroutine".

 

 

 


Each and every version works and none use the "A" register.

 

...except before and afterwards, where 'A' is used to self-modify the code (toggling an early RET in and then back out again).  But I think that could be done using HL as a pointer instead (if necessary?):

 

LD HL, S_M_C_New_Mod

LD (HL), $C9                          ; ;opcode for RET

 

and

 

LD HL, S_M_C_New_Mod

LD (HL), $EA                          ;opcode for JP PE,xx

Edited by IRF
Link to comment
Share on other sites

Semantics:-

 

 

Every version of the raster copy routine listed under "source code for JSW"  does not use the "a" register. I subsequently added before and after the actual routine a part which modified the Block_Copy routine (which ever variant of the block copy routine as listed in each post). The raster copy routine still does not use the a register, but the modifying code before and after did use the "a" register. 

 

 I have done the trivial change to each modifying addition to remove the usage of the "a" register throughout the whole raster copy.  

Link to comment
Share on other sites

I've just noticed that the two commands in the raster copy routine which you previously struck through:

 

  ld b,0                         ; this was set for usage in a different routine

  ld c,32                             ; this was set for usage in a different routine

 

are no longer struck out in posts 59 and 60.  Although the accompanying comment after the semicolon remains in place, suggesting that those commands are still not necessary (and from my interpretation of the code, they aren't needed).

 

Perhaps the strikethrough font 'fell off' in the process of copying and pasting?

 

****

 

The LDI subroutine in post 60 gets around the problem in the 'Lose a Life' routine (#8C01), whereby the screen attributes are updated repeatedly on a loop, whilst the A register is used to count down the INK colours (the 'fade to black' moment). :)

Link to comment
Share on other sites

I've just noticed that the two commands in the raster copy routine which you previously struck through:

 

  ld b,0                         ; this was set for usage in a different routine

  ld c,32                             ; this was set for usage in a different routine

 

are no longer struck out in posts 59 and 60.  Although the accompanying comment after the semicolon remains in place, suggesting that those commands are still not necessary (and from my interpretation of the code, they aren't needed).

 

Perhaps the strikethrough font 'fell off' in the process of copying and pasting?

 

 

 

The strike through fell off and is lying somewhere in cyberspace.

 

The op codes in the listings which are unwanted have been rem'ed out and also struck through again.  (just in case I paste and copy again) with that statement I am reminded that the original still has only the strike through. So I will edit that as well.

 

Code with the unwanted parts will still work. But since it is not needed best rem'out in addition to the strike through.  (or just deleted completely)

Edited by Norman Sword
Link to comment
Share on other sites

  • 4 months later...

                       Current saving                 Total saving

Rope compression    258                          258

cheat code                51                           309

room draw                 50                           359

lower att draw +

logo draw                400+                         759+

twinkle                     39                            798+

clock update            14                             812+

room exits               36                             848

 

I would be very interested in being able to apply the above-mentioned savings, or a part of them, to a JSW48 game file.

 

I am particularly interested in the rope compression and logo draw.

 

It would be perfect for me to be able to just copy a chunk of the new code as a binary file into another file. I would make all other necessary adjustments.

 

However, I can't figure out where all that new code is. Is it in the "HeadsJSW.tap" file attached for download to this thread? If so, where does the code responsible for the rope compression and for the logo draw start there?

 

Any help on this would be appreciated :).

Link to comment
Share on other sites

OK, after further investigation, I am able to answer, in part, my own question.

 

In Norman Sword's file HeadsJSW.tap the code which he describes as "draw_bottom_att", as per:

 

Both of these LDIR routines are replaced with a call to draw_bottom_att which is new code sitting in ram somewhere.

 

starts at # 944F.

 

draw_bottom_att

    ld de,ATT16  = 11 00 5A
    ld ix,bottom_att   ------------- This "bottom_att" starts at # 966B
    ld hl,bottom_translate ----------- This "bottom_translate" starts at #965E
 
Furthermore,
 
; expander sub
expand: --------------- This starts at #94D5
    ld (S_M_C_translate),hl
(....)
 jr draw_logo_loop

;=======================================================================

; expander sub routine  -------------- This starts at # 94EC
indexer
    ld c,a
    rrca

(....)

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.