Asmusr Posted July 20, 2017 Share Posted July 20, 2017 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 31 Quote Link to comment https://forums.atariage.com/topic/267989-knight-lore/ Share on other sites More sharing options...
Sinphaltimus Posted July 20, 2017 Share Posted July 20, 2017 WOW, that looks amazing! Congrats! this is the kind of stuff that the FG99 was meant for - great to see new things already happening! Quote Link to comment https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810286 Share on other sites More sharing options...
ti99iuc Posted July 20, 2017 Share Posted July 20, 2017 (edited) 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 July 20, 2017 by ti99iuc 1 Quote Link to comment https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810300 Share on other sites More sharing options...
Asmusr Posted July 20, 2017 Author Share Posted July 20, 2017 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 Quote Link to comment https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810321 Share on other sites More sharing options...
Asmusr Posted July 20, 2017 Author Share Posted July 20, 2017 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. 4 Quote Link to comment https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810334 Share on other sites More sharing options...
+InsaneMultitasker Posted July 20, 2017 Share Posted July 20, 2017 Nice I like the tranformation(?) at 6:05. 1 Quote Link to comment https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810346 Share on other sites More sharing options...
Asmusr Posted July 20, 2017 Author Share Posted July 20, 2017 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. Quote Link to comment https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810364 Share on other sites More sharing options...
digdugnate Posted July 20, 2017 Share Posted July 20, 2017 wow- that is fantastic! Quote Link to comment https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810396 Share on other sites More sharing options...
+TheBF Posted July 21, 2017 Share Posted July 21, 2017 (edited) 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 July 21, 2017 by TheBF Quote Link to comment https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810582 Share on other sites More sharing options...
vectrexroli Posted July 21, 2017 Share Posted July 21, 2017 Wow!!!! Quote Link to comment https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810711 Share on other sites More sharing options...
Tursi Posted July 21, 2017 Share Posted July 21, 2017 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. Quote Link to comment https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810722 Share on other sites More sharing options...
Tursi Posted July 21, 2017 Share Posted July 21, 2017 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. Quote Link to comment https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810724 Share on other sites More sharing options...
Asmusr Posted July 21, 2017 Author Share Posted July 21, 2017 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? 1 Quote Link to comment https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810739 Share on other sites More sharing options...
Willsy Posted July 21, 2017 Share Posted July 21, 2017 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. 1 Quote Link to comment https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810758 Share on other sites More sharing options...
Asmusr Posted July 21, 2017 Author Share Posted July 21, 2017 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. 6 Quote Link to comment https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810764 Share on other sites More sharing options...
+mizapf Posted July 21, 2017 Share Posted July 21, 2017 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. 1 Quote Link to comment https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810767 Share on other sites More sharing options...
+Vorticon Posted July 21, 2017 Share Posted July 21, 2017 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? Quote Link to comment https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810773 Share on other sites More sharing options...
Asmusr Posted July 21, 2017 Author Share Posted July 21, 2017 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 3 Quote Link to comment https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810785 Share on other sites More sharing options...
Willsy Posted July 21, 2017 Share Posted July 21, 2017 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! Quote Link to comment https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810797 Share on other sites More sharing options...
+adamantyr Posted July 21, 2017 Share Posted July 21, 2017 Impressive and awesome! Quote Link to comment https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810852 Share on other sites More sharing options...
PeteE Posted July 21, 2017 Share Posted July 21, 2017 This is way cool. It seems similar to the Batman game on ZX Spectrum as well, perhaps they used the same engine code. Quote Link to comment https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810886 Share on other sites More sharing options...
Asmusr Posted July 21, 2017 Author Share Posted July 21, 2017 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. Quote Link to comment https://forums.atariage.com/topic/267989-knight-lore/#findComment-3810926 Share on other sites More sharing options...
+eebuckeye Posted July 21, 2017 Share Posted July 21, 2017 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! 3 Quote Link to comment https://forums.atariage.com/topic/267989-knight-lore/#findComment-3811008 Share on other sites More sharing options...
PeBo Posted July 22, 2017 Share Posted July 22, 2017 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. . 2 Quote Link to comment https://forums.atariage.com/topic/267989-knight-lore/#findComment-3811329 Share on other sites More sharing options...
blakespot Posted July 22, 2017 Share Posted July 22, 2017 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 Quote Link to comment https://forums.atariage.com/topic/267989-knight-lore/#findComment-3811601 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.