Jump to content

Photo

Knight Lore


38 replies to this topic

#1 Asmusr ONLINE  

Asmusr

    River Patroller

  • 2,399 posts
  • Location:Denmark

Posted Thu Jul 20, 2017 2:33 PM

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.bl.../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/R...s-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.

 

Attached Files



#2 Sinphaltimus OFFLINE  

Sinphaltimus

    Stargunner

  • 1,842 posts
  • Distracted at the Keyboard
  • Location:Poconos, PA

Posted Thu Jul 20, 2017 2:47 PM

WOW, that looks amazing! Congrats! 

this is the kind of stuff that the FG99 was meant for - great to see new things already happening!



#3 ti99iuc OFFLINE  

ti99iuc

    Stargunner

  • 1,157 posts
  • Location:Italy

Posted Thu Jul 20, 2017 3:09 PM

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.


Edited by ti99iuc, Thu Jul 20, 2017 3:12 PM.


#4 Asmusr ONLINE  

Asmusr

    River Patroller

  • Topic Starter
  • 2,399 posts
  • Location:Denmark

Posted Thu Jul 20, 2017 3:34 PM

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.



#5 Asmusr ONLINE  

Asmusr

    River Patroller

  • Topic Starter
  • 2,399 posts
  • Location:Denmark

Posted Thu Jul 20, 2017 3:46 PM

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. 



#6 InsaneMultitasker OFFLINE  

InsaneMultitasker

    Stargunner

  • 1,670 posts

Posted Thu Jul 20, 2017 4:02 PM

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



#7 Asmusr ONLINE  

Asmusr

    River Patroller

  • Topic Starter
  • 2,399 posts
  • Location:Denmark

Posted Thu Jul 20, 2017 4:24 PM

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.  



#8 digdugnate OFFLINE  

digdugnate

    Moonsweeper

  • 449 posts
  • Location:SW Missouri

Posted Thu Jul 20, 2017 5:02 PM

wow- that is fantastic!



#9 TheBF OFFLINE  

TheBF

    Moonsweeper

  • 280 posts
  • Location:The Great White North

Posted Thu Jul 20, 2017 8:45 PM

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, Thu Jul 20, 2017 8:52 PM.


#10 vectrexroli OFFLINE  

vectrexroli

    Moonsweeper

  • 458 posts

Posted Fri Jul 21, 2017 12:25 AM

Wow!!!! :-o



#11 Tursi OFFLINE  

Tursi

    River Patroller

  • 4,710 posts
  • Location:BUR

Posted Fri Jul 21, 2017 12:48 AM

That's pretty amazing, I didn't realize when you said 'converted line by line' that you literally meant you converted the Z80 assembly directly. ;)

#12 Tursi OFFLINE  

Tursi

    River Patroller

  • 4,710 posts
  • Location:BUR

Posted Fri Jul 21, 2017 12:51 AM

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. ;)

#13 Asmusr ONLINE  

Asmusr

    River Patroller

  • Topic Starter
  • 2,399 posts
  • Location:Denmark

Posted Fri Jul 21, 2017 2:04 AM

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?



#14 Willsy OFFLINE  

Willsy

    River Patroller

  • 3,002 posts
  • Location:Uzbekistan (no, really!)

Posted Fri Jul 21, 2017 3:36 AM

Absolutely incredible job. I wish I had your skills.

The ZX Spectrum is an excellent candidate for software conversions as the bitmap screen is the same size as the TI, and it has an absolutely massive software catalogue.

#15 Asmusr ONLINE  

Asmusr

    River Patroller

  • Topic Starter
  • 2,399 posts
  • Location:Denmark

Posted Fri Jul 21, 2017 4:02 AM

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.



#16 mizapf OFFLINE  

mizapf

    River Patroller

  • 2,474 posts
  • Location:Germany

Posted Fri Jul 21, 2017 4:36 AM

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.



#17 Vorticon OFFLINE  

Vorticon

    River Patroller

  • 2,678 posts
  • Location:Eagan, MN, USA

Posted Fri Jul 21, 2017 4:54 AM

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?



#18 Asmusr ONLINE  

Asmusr

    River Patroller

  • Topic Starter
  • 2,399 posts
  • Location:Denmark

Posted Fri Jul 21, 2017 5:31 AM

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/...s/#entry3462606



#19 Willsy OFFLINE  

Willsy

    River Patroller

  • 3,002 posts
  • Location:Uzbekistan (no, really!)

Posted Fri Jul 21, 2017 5:56 AM

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!

#20 adamantyr ONLINE  

adamantyr

    Stargunner

  • 1,125 posts

Posted Fri Jul 21, 2017 7:55 AM

Impressive and awesome!

#21 PeteE OFFLINE  

PeteE

    Star Raider

  • 68 posts
  • Location:Beaverton, OR

Posted Fri Jul 21, 2017 8:59 AM

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



#22 Asmusr ONLINE  

Asmusr

    River Patroller

  • Topic Starter
  • 2,399 posts
  • Location:Denmark

Posted Fri Jul 21, 2017 9:56 AM

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.



#23 eebuckeye OFFLINE  

eebuckeye

    Dragonstomper

  • 935 posts

Posted Fri Jul 21, 2017 11:53 AM

You should really setup a Patreon for your work.. The quality of software/games you put out is incredible and you should get something for it!



#24 PeBo OFFLINE  

PeBo

    Dragonstomper

  • 813 posts
  • Location:Toronto, Canada

Posted Fri Jul 21, 2017 8:44 PM

What you continue to accomplish with the 4A is astounding.

 

We are so incredibly fortunate to have you sharing our hobby.

 

Kudos to be certain but more importantly, thanks. .



#25 blakespot OFFLINE  

blakespot

    Chopper Commander

  • 123 posts
  • Location:Alexandria, VA (USA)

Posted Sat Jul 22, 2017 8:44 AM

Extremely impressive.

 

It pains me that the PEB, 32K, and FlashROM99 won't get me there. :-) Might have to step up one day to the other flash cart.

 

 

bp






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users