Jump to content

Recommended Posts

Where's the jerk who said you couldn't make Knight Lore on the TI? Wait, that was me. ;) In these matters there's nothing better than proving yourself wrong. Or almost wrong, because it is pretty slow, perhaps half as fast as on the ZX Spectrum, but I think it's still playable.

 

Anyway, here it is, the entire game converted manually line by line from the ZX Spectrum (Z80) disassembly by tcdev: http://retroports.blogspot.dk/p/blog-page.html. A huge thank you to tcdev for his great disassembly and for answering my questions.

 

 

The game does not fit into 32K RAM, so it will not be available on disk but only as a 256K ROM image for the FinalGROM 99 etc. (I don't plan to make a SAMS version.)

 

Source code on GitHub: https://github.com/Rasmus-M/Knight-lore

 

This is a beta version. I have not played it through or even seen all the screens (but I have confirmed that the ending is working). Please report any issues you may find.

 

Extended title tune edited in MOD2PSG2 and played using Tursi's VGM tools.

 

This conversion is provided free of charge as a labor of love and is not for sale.

 

knightlore8.bin

knightlore.rpk

  • Like 31
Link to comment
https://forums.atariage.com/topic/267989-knight-lore/
Share on other sites

I really do not like the ZX Spectrum Graphics in general but i have to admit you done another nice piece of work with this game conversion Rasmus ! :)

 

Thanks for this title added to our game library.

 

Thanks. The game is quite different from any other TI game (AFAIK) in that it is not using any hardware sprites (everything is drawn on the bitmap screen). Actually all sprites are drawn to a linear screen buffer in CPU RAM first and then the relevant parts are blitted to the VDP memory as needed. Since the screen buffer requires 6K RAM this wouldn't have been possible on a bare console. I did make a small improvement to the graphics on the TI because here the top of the sun and moon do not become colored by the frame. But adding more colors to the game in general would be quite difficult and slow. The reason it works as well as it does is that we can leave the color table alone most of the time.

  • Like 5
Link to comment
https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810321
Share on other sites

An important trick when playing the game (as can be seen once on the video) is to use an item you place on the ground as a platform to jump over tall objects, but then pick up the item again at the same time as you jump.

 

I added a 2-button joystick option to the start menu. This is for people who have rewired button 1 on joystick 2 to button 2 on joystick 1. If you have a joystick like that you should be able to jump using button 1 and pick up using button 2. This should make the jump'n'pickup trick easier.

  • Like 4
Link to comment
https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810334
Share on other sites

Nice :) I like the tranformation(?) at 6:05.

 

This transformation happens every time day turn to night or night turn to day. The aim of the game is for the player to cure himself from being a werewolf by finding and throwing 20 objects into the cauldron in the central room in the right order. Some quests will only work if you're human, like the cauldron telling you which object it needs next.

Link to comment
https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810364
Share on other sites

Truly a great piece of work.

 

And I think you are correct. There is no other game like this in the TI-99 catalogue.

 

Bravo!

 

When I looked at the code briefly I saw that you aliased all the 9900 registers to make it easier to port.

 

EDIT. DOH! Those lines were comments.

 

Never mind...

Edited by TheBF
Link to comment
https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810582
Share on other sites

So.. did you have a lot of issues with status bits? I've always wondered about building an assembler that assembled a foreign CPU into 9900 assembly - I've been looking at the 6502. ;)

 

Not a lot once I learned how to deal with the carry flag after a subtraction. I think the tricky part of automatic conversion is the places where you have to change the program flow slightly, e.g. by swapping two instructions, in order to obtain the same result. Does the 6502 set flags after loading data into registers like the TMS9900? I guess you could validate the result of a conversion by emulating the two programs in parallel and checking that they are in the same state?

  • Like 1
Link to comment
https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810739
Share on other sites

One thing I have learned from this project is to use a linear screen buffer in CPU RAM for drawing, and then only 'blit' the changed parts of the buffer to VDP memory. 'Linear' is the key here, because I have used screen buffers before but making the layout of the buffer linear rather than character based makes drawing of soft sprites, lines, etc. much simpler. Given a register with the y coordinate in the MSB and the x coordinate in the LSB, in a linear buffer you can calculate the byte offset simply by dividing by 8, i.e. by shifting right 3 positions.

 

Blitting from the linear buffer to VDP RAM can be done in at maximum speed by setting up 8 registers, say R0-R7, each one holding the source address of one consecutive line of the buffer. You can then use an unrolled loop to transfer characters like this:

    li r8,vdpwd
    li r9,32       ; Number of characters    
loop:
    movb *r0+,*r8  ; Write a byte to VDP RAM
    movb *r1+,*r8
    movb *r2+,*r8
    movb *r3+,*r8
    movb *r4+,*r8
    movb *r5+,*r8
    movb *r6+,*r8
    movb *r7+,*r8
    dec r9
    jne loop

I think this technique might be fast enough for some simple vector graphics on the TI.

  • Like 6
Link to comment
https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810764
Share on other sites

Would you mind writing a paper for all of us on those topics? :)

 

No, honestly, it would be highly interesting to find all this written down and retrievable from some server. It would be enough to fill a book, but I'm afraid you won't find a publisher with this little user base.

  • Like 1
Link to comment
https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810767
Share on other sites

What an amazing project! Did you actually convert the code manually line by line??? Wow! It was indeed a labor of love...

Regarding the slower running speed, which clearly happens when multiple moving objects are on screen, what is the chief reason for this on the TI as compared to the Spectrum since it is essentially the same program for both?

Link to comment
https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810773
Share on other sites

What an amazing project! Did you actually convert the code manually line by line??? Wow! It was indeed a labor of love...

Regarding the slower running speed, which clearly happens when multiple moving objects are on screen, what is the chief reason for this on the TI as compared to the Spectrum since it is essentially the same program for both?

 

Yes I converted it line by line, except were hardware differences required the code to be rewritten. I even maintained some of the self-modifying code. If you look at the source code you will see all the original code in there as comments. This has been very helpful in order to fix bugs. I think the work involved is comparable to Bouncy or one of my other games. You can get a lot of coding done when you don't have to think about the logic at a higher level. And it's very satisfying when the code suddenly works and graphics appear on the screen.

 

One thing that made this possible is that sprites are drawn to a screen buffer rather than directly to the video memory. This makes the majority of the code hardware independent, and only the blit_to_screen function had to be rewritten. And the sound and keyboard code was also nicely packed away into subroutines.

 

Most Z80 instructions convert to one TMS9900 instruction. In some cases, e.g. bit checking, we need to use two instructions on the TI, and in some cases 2 or 3 Z80 instructions convert to one TMS9900 instruction, but generally there is a one to one match. There is no real benefit of the 16-bit architecture when converting from 8-bit. So for the game to run equally fast on both machines the TI would have to execute instructions as fast as the Spectrum, which is far from being the case according to this table:

 

http://atariage.com/forums/topic/250055-mips/?do=findComment&comment=3462606

  • Like 3
Link to comment
https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810785
Share on other sites

Would you mind writing a paper for all of us on those topics? :)

 

No, honestly, it would be highly interesting to find all this written down and retrievable from some server. It would be enough to fill a book, but I'm afraid you won't find a publisher with this little user base.

Seconded!

Link to comment
https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810797
Share on other sites

This is way cool. It seems similar to the Batman game on ZX Spectrum as well, perhaps they used the same engine code.

 

I have been told that the other Ultimate titles Alien 8 and Pentagram are using a very similar code. Batman was released by Ocean and so was Head over Heels, which is perhaps the most impressive of the 80's isometric games.

Link to comment
https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810926
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...