sometimes99er Posted August 9, 2015 Author Share Posted August 9, 2015 (edited) So I want to implement a timer in the Minesweeper game. There's a chip inside the TI-99/4A called the TMS9901 and it has a timer. ref.:Nouspikel's TI-99/4A Tech Pages Back in 2006 I started experimental work on a Sudoku clone, and it used the timer. It worked fine in Mess. At one point Tursi implemented support for the 9901 timer. And then it worked fine in Classic99. Later Mantadoc burned the ROM and tested it on the real iron. And there were some problems with the graphics. Luckily another 3 demos worked fine. Later again Classic99 developed the same issue with graphics. A handful of my demos had issues. I think it's safe to say now, that the reason was code at uneven addresses. TIAsm and WinAsm99 do not warn or report as error. Edit: Mistake and assumptions about emulators deleted. Edited August 9, 2015 by sometimes99er Quote Link to comment Share on other sites More sharing options...
+mizapf Posted August 9, 2015 Share Posted August 9, 2015 Hmm ... I'm pretty sure (really close to 100%) that MESS won't execute code on uneven locations. I know I once had this issue, but I think it was with the 9995 emulation. Can you tell exactly where it happens? 1 Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted August 9, 2015 Author Share Posted August 9, 2015 (edited) Hmm ... I'm pretty sure (really close to 100%) that MESS won't execute code on uneven locations. I know I once had this issue, but I think it was with the 9995 emulation. Can you tell exactly where it happens? Ahhh, my fault. The compiler can compile to an odd address, and then things go wrong. That error does not have to do with the emulator. Sorry, and thanks for feedback. Edited August 12, 2015 by sometimes99er Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted August 9, 2015 Share Posted August 9, 2015 So I want to implement a timer in the Minesweeper game. There's a chip inside the TI-99/4A called the TMS9901 and it has a timer. ref.: Nouspikel's TI-99/4A Tech Pages ... Here is a discussion of using the 9901 as a timer: TurboForth Assembler As you will see, there was concern expressed that using the 9901 (as it is wired in the TI-99/4A) as a timer may not be safe. ...lee 1 Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted August 9, 2015 Author Share Posted August 9, 2015 (edited) Here is a discussion of using the 9901 as a timer: TurboForth Assembler As you will see, there was concern expressed that using the 9901 (as it is wired in the TI-99/4A) as a timer may not be safe. ...lee Thanks. Maybe I should simply do a brute force count between vdp interrupts a few times, and then decide if it's a 50 or 60 Hz system. Didn't we (here on AtariAge) do that some time ago ? I guess emulation should be able to give a rough but good enough estimate ? Edited August 9, 2015 by sometimes99er Quote Link to comment Share on other sites More sharing options...
+mizapf Posted August 9, 2015 Share Posted August 9, 2015 I did not follow the discussions about the 9901 at that time (maybe I was not yet member of AA), but "reading too fast" sounds not too likely for me. I don't know what caused the damage of the 9901 as described. The 9901 is a pretty "dumb" chip. It looks complicated from the outside, but things inside are pretty much synchronized to the external clock. It does not even have a READY line. The timer is actually a decrementer that is triggered on every 64 clock pulses. The specs do not reveal anything about minimum timing with respect to program operation. At least it's not comparable to the VDP which has an own flow of control. I think the worst thing that can happen to the 9901 is when its outputs are short-circuited (e.g. when one of the lines INT7* - INT10* are configured to be outputs instead of inputs). Still, there are resistors for protection inside the TI console, so this somewhat remains mysterious. 2 Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted August 9, 2015 Share Posted August 9, 2015 (edited) I did not follow the discussions about the 9901 at that time (maybe I was not yet member of AA), but "reading too fast" sounds not too likely for me. I don't know what caused the damage of the 9901 as described. The 9901 is a pretty "dumb" chip. It looks complicated from the outside, but things inside are pretty much synchronized to the external clock. It does not even have a READY line. The timer is actually a decrementer that is triggered on every 64 clock pulses. The specs do not reveal anything about minimum timing with respect to program operation. At least it's not comparable to the VDP which has an own flow of control. I think the worst thing that can happen to the 9901 is when its outputs are short-circuited (e.g. when one of the lines INT7* - INT10* are configured to be outputs instead of inputs). Still, there are resistors for protection inside the TI console, so this somewhat remains mysterious. I agree. I just wanted to bring that discussion reference here to evoke more input —especially from @Tursi because he suggested the 9901's use here and was also in on that older discussion and may have some more recent insight. ...lee [EDIT: Re above strikethroughs, I'm not sure where I got the idea that @Tursi recently suggested using the 9901 as a timer. It obviously wasn't here!] Edited August 9, 2015 by Lee Stewart Quote Link to comment Share on other sites More sharing options...
Tursi Posted August 9, 2015 Share Posted August 9, 2015 I wondered about that.. everything I know about the 9901 timer I learned from Sometimes99er! In the other thread, it's worth noting that hardware was also being developed. We should dedicate a console or two to determining whether timer mode is safe or not. 1 Quote Link to comment Share on other sites More sharing options...
+Ksarul Posted August 9, 2015 Share Posted August 9, 2015 I tried Minesweeper on real iron today, Sometimes99er. I got to the menu selection fine, but the cartridge went off into nirvana when I tried to execute. . .I used my known good cartridge test board with a ZIF socket, jumpered properly for an 8K/16K cartridge, using a known good EPROM. I'll validate the EPROM again in my programmer, just in case it failed to burn properly, but that is the current test status. . . 1 Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted August 10, 2015 Author Share Posted August 10, 2015 I tried Minesweeper on real iron today, Sometimes99er. I got to the menu selection fine, but the cartridge went off into nirvana when I tried to execute. . .I used my known good cartridge test board with a ZIF socket, jumpered properly for an 8K/16K cartridge, using a known good EPROM. I'll validate the EPROM again in my programmer, just in case it failed to burn properly, but that is the current test status. . . Thanks. Also if you could try it out on a minimal configuration. I'm assuming a few things when control is transfered from OS to cartridge *), but has tested with the Classic99's Scramble RAM feature. Also works fine with Js99'er, Win994a, older, newer, 32 and 64 bit versions of MESS. *) I only change 3 vdp registers instead of all 8. Assuming a state of limi 0. Assuming workspace at >83e0. Assuming r15 is >8c02 (vdp address). I don't know if you want to go any further and test more. We could take a route of incremental testing to narrow in on the faulty part(s). - I guess one way for me to go is make an EA3 version. That would maybe reveal a thing or two. And I guess it would be much more easy for many to test. In the end I could eat my hat and release the source. 2 Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted August 10, 2015 Author Share Posted August 10, 2015 I wondered about that.. everything I know about the 9901 timer I learned from Sometimes99er! You're giving me too much credit. It could maybe be "because of" and not "from" ... 1 Quote Link to comment Share on other sites More sharing options...
+Ksarul Posted August 10, 2015 Share Posted August 10, 2015 You just gave me a thought--I had my Myarc MPES-50 connected to the machine when I did my tests. I don't usually see problems from that one, but I'll try again without it, just in case that introduces something weird into the mix. This one runs from cartridge space and doesn't use the 32K space for anything, correct? The fact that it runs in that many different emulators points to incompatibilities with something in my setup, and that has my curiosity piqued. If it is the MPES-50, I wouldn't worry about changing the code, as I doubt there are more than five or six of them left in the community--and two of those belong to me. 2 Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted August 10, 2015 Author Share Posted August 10, 2015 You just gave me a thought--I had my Myarc MPES-50 connected to the machine when I did my tests. I don't usually see problems from that one, but I'll try again without it, just in case that introduces something weird into the mix. This one runs from cartridge space and doesn't use the 32K space for anything, correct? The fact that it runs in that many different emulators points to incompatibilities with something in my setup, and that has my curiosity piqued. If it is the MPES-50, I wouldn't worry about changing the code, as I doubt there are more than five or six of them left in the community--and two of those belong to me. Yes, that's correct. I'm also thinking that a DSR could screw up what I see as default values. I know I shouldn't assume too much, just my minimalistic nature around this TI-99/4A retro-computing. Maybe I'm being too smart (in that department), it would only cost a handful of bytes to set all vdp registers, do a limi 0, set the workspace registers, and effectively clear scratch-pad prior to the game and when trying to boot (detecting Fctn Quit (as recommended by Tursi in another thread)). 1 Quote Link to comment Share on other sites More sharing options...
Opry99er Posted August 10, 2015 Share Posted August 10, 2015 Ahh, but minimalism can be quite beautiful and effective when in the proper hands. That is one of the reasons I love tape-loaded programs for TI BASIC. Hope all goes well in testing. Id love to play this game on my TI. 1 Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted August 11, 2015 Author Share Posted August 11, 2015 Created the EA3 file: That was relatively easy. Removed the aorg and created a def. Still version 0.4. Please test on real iron. 1 Quote Link to comment Share on other sites More sharing options...
Willsy Posted August 11, 2015 Share Posted August 11, 2015 Yes, that's correct. I'm also thinking that a DSR could screw up what I see as default values. I know I shouldn't assume too much, just my minimalistic nature around this TI-99/4A retro-computing. Maybe I'm being too smart (in that department), it would only cost a handful of bytes to set all vdp registers, do a limi 0, set the workspace registers, and effectively clear scratch-pad prior to the game and when trying to boot (detecting Fctn Quit (as recommended by Tursi in another thread)). I load the VDP registers in a loop: ; load the vdp registers li r2,col32d ; address of register data ldvdpr mov r2,r7 ; save address for later movb *r2+,r1 ; number of registers to load sra r1,8 ; move the count to the low byte clr r0 ; start with register 0 ldvdpl movb *r2+,r0 ; get register data in r0 MSB swpb r0 ; swap it over bl @_vwtr ; write the register swpb r0 ; swap it back again inc r0 ; add 1 to register dec r1 ; finished? jne ldvdpl ; repeat if not col32d ; register count and data byte 8,>00,>e0,>00,>0e,>01,>06,>02,>f4 Could maybe make this code a little shorter by loading the registers backwards (from register 7 to 0) rather than forwards. If going backwards, R1 can be the loop counter, and the VDP register. 1 Quote Link to comment Share on other sites More sharing options...
Opry99er Posted August 11, 2015 Share Posted August 11, 2015 I like using that little tactic when flashing colors or creating funny visual effects when showing my son stuff in XB. He loves Hunt the Wumpus... Im sure he will get a real kick out of Minesweeper. 1 Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted August 12, 2015 Author Share Posted August 12, 2015 I like using that little tactic when flashing colors or creating funny visual effects when showing my son stuff in XB. I'm afraid I don't know exactly what you're referring to. He loves Hunt the Wumpus... Im sure he will get a real kick out of Minesweeper. That would be cool. Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted August 12, 2015 Author Share Posted August 12, 2015 (edited) Unfortunately I'm a sorry-no-good-irritating-no-I-don't-have-real-iron-son-of-a- ... Also I'd like to have a certain degree of confirmation that the game is working and playable on real iron before moving along. EA3 version is in post #40 and cartridge binary is in post #23. As said, it's in a state where it's quite playable, with timer and sounds being the only things missing from making the more complete experience. When these things are done, I'll look into saving a few bytes, maybe add a splash-screen and perhaps doing a built-in optional or standalone "Macintosh" version (opposed to the current "Amiga" style). So, please ... Edited August 12, 2015 by sometimes99er Quote Link to comment Share on other sites More sharing options...
TheMole Posted August 12, 2015 Share Posted August 12, 2015 (edited) *nevermind; obvious question answered in your animated gif.* Edited August 12, 2015 by TheMole 1 Quote Link to comment Share on other sites More sharing options...
Opry99er Posted August 12, 2015 Share Posted August 12, 2015 If going backwards, R1 can be the loop counter, and the VDP register. 100 CALL CLEAR :: FOR I=1 TO 16 :: CALL SCREEN(I) :: FOR DELAY=1 TO 100 :: NEXT DELAY :: NEXT I That is what I was referring to. In this case, I is the counter and the screen color. Not a shot for shot likeness, but similar in principle. 1 Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted August 12, 2015 Author Share Posted August 12, 2015 (edited) Oh. Okay. Edited August 13, 2015 by sometimes99er Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted August 13, 2015 Author Share Posted August 13, 2015 I load the VDP registers in a loop: ... col32d ; register count and data byte 8,>00,>e0,>00,>0e,>01,>06,>02,>f4 Could maybe make this code a little shorter by loading the registers backwards (from register 7 to 0) rather than forwards. If going backwards, R1 can be the loop counter, and the VDP register. Yes. I'll be doing the loop thing from now on. Thanks. 1 Quote Link to comment Share on other sites More sharing options...
TheMole Posted August 13, 2015 Share Posted August 13, 2015 (edited) Unfortunately I'm a sorry-no-good-irritating-no-I-don't-have-real-iron-son-of-a- ... Also I'd like to have a certain degree of confirmation that the game is working and playable on real iron before moving along. EA3 version is in post #40 and cartridge binary is in post #23. As said, it's in a state where it's quite playable, with timer and sounds being the only things missing from making the more complete experience. When these things are done, I'll look into saving a few bytes, maybe add a splash-screen and perhaps doing a built-in optional or standalone "Macintosh" version (opposed to the current "Amiga" style). So, please ... I want to test it, but I'm having trouble creating a disk image that works for me... I'm probably missing something obviously stupid, but somehow I'm not succeeding... Just for clarity, a disk image to put on my cf7+, not for an emulator Edited August 13, 2015 by TheMole 1 Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted August 13, 2015 Author Share Posted August 13, 2015 (edited) I want to test it, but I'm having trouble creating a disk image that works for me... I'm probably missing something obviously stupid, but somehow I'm not succeeding... Just for clarity, a disk image to put on my cf7+, not for an emulator Thanks. Edit: New disk with help from mizapf. Video below changed accordingly. Edited August 14, 2015 by sometimes99er 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.