Jump to content
Sign in to follow this  
retroclouds

Optimize TMS9900 assembly code for speed

Recommended Posts

It looks like all of high memory is available. (Pages 399 and 400 of E/A manual)

On the other hand, page 411 shows the E/A loader being able to use A000 to >FFE0 and on page 410 being able to load from >A000 to >FFD7.

So it's not totally clear, but I would think that once the program is loaded it can use those memory addresses safely.

  • Like 1

Share this post


Link to post
Share on other sites
Posted (edited)

Metric is the only sensible way to go.

 

Once your assembly program is in there, you make the rules. It's only if you want to use various system supplied services you may be out of luck, if you use memory these services need to work properly.

Edited by apersson850
  • Thanks 1

Share this post


Link to post
Share on other sites
Posted (edited)
1 hour ago, apersson850 said:

system supplied services

Yup, that is why I mentioned I'm not using FP, as an example of using other resources, but that's cool I got it, and I'm using it without problems, just wanted a little clarification. Thank you!

Edited by GDMike

Share this post


Link to post
Share on other sites
15 hours ago, apersson850 said:

Metric is the only sensible way to go.

 

Once your assembly program is in there, you make the rules. It's only if you want to use various system supplied services you may be out of luck, if you use memory these services need to work properly.

Exactly. I put a "terminal input buffer" at >FF7E.  Never had a problem.

 

Metric is of course the only system to use but it's "cute" how it has permutations in different countries.  In Netherlands the old people might still refer to a pound but it's 100 grams. :)  That has probably faded away.

In Canada people still often quote their own weight in pounds.  The construction industry has been slow to fully change probably because Canada's economy is so closely coupled to the USA. We can still buy "eight foot, two by fours"  which are pieces of wood 8 feet long but are NOT 2 inches by 4 inches thick. :)  This is not unusual in a country that speaks a language where "cough" is pronounced "koff". :) 

 

At this time, only three countries—Burma, Liberia, and the USA use a variant of the old imperial measurement system.

I say variant because for half of my life USA and Canada had different size units that they each called gallons and fluid ounces!!!!!

 

Here is a question for the people living in those three countries. 

It was asked on a call-in radio show years ago by a European pharmacist who immigrated to Canada before metric and had to re-learn weights and measures for her profession.

 

What is the weight of five eights (5/8) of  [one ounce,8 drams and twelve grains] ? 😎

 

 

 

 

Share this post


Link to post
Share on other sites

I don't know of what would require that amount, so I would estimate it. Round it off. Most of us don't work for NASA haha so I think whatever it is wouldn't matter if it's underestimated. Now, my question is, can you build forth on the metric number system? Is it a thing or doesn't matter since it's base 16 or whatever base I guess.

16 hours ago, apersson850 said:

system supplied services

Yup, that is why I mentioned I'm not using FP, as an example of using other resources, but that's cool I got it, and I'm using it without problems, just wanted a little clarification. Like switching from a great decimal system to weenie metric. Lol, well call it what you want, simple minds, whatever. It established it's dominance here in the USA and we built some of the best stuff the world has ever seen based on it, hmm how hard is it to create forth using metric? I'm not a mathematician like you guys, and I'm stuck on decimal system, good or bad, it's only what works for me. There's pros and cons, but again, I'm not dependent on it myself as everyday life has shown and we get along. But I'll tell you, working on a car that says built in USA needs more metric tooling that my standard set. Now, my USAF jet engine is simple, standard tools. 

Share this post


Link to post
Share on other sites
16 hours ago, GDMike said:

Yup, that is why I mentioned I'm not using FP, as an example of using other resources, but that's cool I got it, and I'm using it without problems, just wanted a little clarification. Thank you!

You know, >FFFC thru >FFFF, can be used with the LOAD interrupt. I was thinking earlier, that I could use the interrupt key, in one of the supporting emulators, to toggle through the switch settings on your Supernotes!:ponder:
 

  • Like 1

Share this post


Link to post
Share on other sites
1 minute ago, HOME AUTOMATION said:

You know, >FFFC thru >FFFF, can be used with the LOAD interrupt. I was thinking earlier, that I could use the interrupt key, in one of the supporting emulators, to toggle through the switch settings on your Supernotes!:ponder:
 

See, I'd never know. I can remove a couple items I have slated for that range and free it back up. Thanks for letting me know. I'll release my source to you all here soon once I get to break point in coding. Maybe you can clean it up for us, it's a bees nest. But clear as mud for me to read it. Actually there's just one area that I treated like that so it's not that bad. But it needs optimizing. Would you be up for that?

  • Like 1

Share this post


Link to post
Share on other sites

I put the LOAD interrupt on PrtScrn by default in MAME. You find it in the menu, "Input (this machine)", and you can put it somewhere else if desired. It is a bare LOAD interrupt, no debouncing. The only thing you can rely on is that your keystroke in the emulator is a clear signal.

  • Like 2

Share this post


Link to post
Share on other sites
On 5/28/2020 at 10:24 AM, senior_falcon said:

Only if I can go along with you. What is the weather like in Bhakti? Scenic methane thunderstorms? Ammonia clouds? (At least your porthole windows would stay clean)

 

If you haven't heard of it, look up Gimli Glider. In short, an Air Canada Boeing 767 took off with insufficient fuel due to faulty conversion between pounds and kilograms. (They thought they had 22,300 kilograms of fuel when in reality they had 22,300 pounds of fuel. They made an unpowered landing at Gimli, a former Canadian Air Force base. No fatalities, 10 minor injuries. They flew in fuel, fixed some minor damage, and flew the plane out.

 

Yes, I believe I would consider granting you passage. However, realistically speaking, Liquefied Deutronium:lust: has been very difficult to acquire. I'm far from certain I'm going anywhere, anytime soon!:roll: I think I've monitored all the episodes of your ACI/MAYDAY video program series.:twisted: I think my favorite episode is the one where the plane is forced to land on an atoll and later is able to power almost directly into the sky with very little fuel!:grin:
 

Share this post


Link to post
Share on other sites
9 minutes ago, mizapf said:

I put the LOAD interrupt on PrtScrn by default in MAME. You find it in the menu, "Input (this machine)", and you can put it somewhere else if desired. It is a bare LOAD interrupt, no debouncing. The only thing you can rely on is that your keystroke in the emulator is a clear signal.

I wonder if Dr. Nouspikel's effort would pay-off here...:ponder:

 

Spoiler
Quote

I struggled with this problem for quite a time before a found a solution. It's fairly intricate, so study it carefully.

 

* Unmaskable interrupts service routine  Version 2
UISR   MOV  @NEWWR,@>FFFC        Change workspace for futur interrupts
       MOV  @NEWPC,@>FFFE        Change PC: now points at RTWP
       CI   R13,UREGS2           Check for rentrancy
       JEQ  ENDUI                We came from the end point (before TORTWP)
       CI   R13,UREGS3           Double re-entrancy (after ENDUI + after UISR)
       JEQ  TORTWP               Return from the second one
       CI   R13,UREGS1           From next instruction after UISR or after ENDUI 
       JNE  UIOK                 From outside UISR: no re-entrancy
       CI   R14,ENDUI            We re-entered, but from where?
       JL   TORTWP               From line 2, just after we changed >FFFC
       JMP  ENDUI                From ENDUI, after we changed >FFFC or >FFFE
 
UIOK   MOV  R13,@UREGS2+26       OK, we did not re-enter
       MOV  R14,@UREGS2+28       Save return parameters in R13-R15 of UREGS2
       MOV  R15,@UREGS2+30
 
*      ...                       Do what we want to do in this UISR
 
       MOV  @OLDUWR,R13          (Optional) Link to previously installed  UISR
       JEQ  ENDUI                None
       BLWP @OLDUWR              Call previously installed UISR
 
ENDUI  MOV  @UISRPC,@>FFFE       Restore pointer to UISR entry point
       MOV  @UISRWR,@>FFFC       Restore initial UISR workspace
       LWPI UREGS2               Switch to worskspace that contains saved values
TORTWP RTWP                      Return to caller
UISRWR DATA UREGS1               Normal workspace for UISR
UISRPC DATA UISR                 UISR entry point
NEWWR  DATA UREGS3               Alternate workspace, if re-entered
NEWPC  DATA TORTWP               Points to a RTWP
 
OLDUWR DATA 0                    To save WS of previous UISR, if any
OLDUPC DATA 0                    To save PC of previous UISR
 
UREGS1 BSS  6                    Regular UISR worskpace
UREGS2 BSS  6                    Worskpace used to save R13-R15
UREGS3 BSS  32                   Alternate worksapce (uses only R13-R15)
 

* These routines install the UISR vectors in memory
HOOKUI DATA UREGS2,ENDUI         Just install our UISR
 
LINKUI DATA UREGS2,LNK0          Check is another one is here, link to it
 
LNK0   CLR  @OLDUWR              Flag: no link to previous UISR
       MOV  @>FFFC,R1            Get current UISR worskpace
       C    R1,@UISRWR           Is it ours?
       JEQ  ENDUI                Yes: don't link
       CI   R1,>2000             Check if valid
       JL   ENDUI                A workspace can't be in ROM
       CI   R1,>8400
       JL   LNK1
       CI   R1,>A000
       JL   ENDUI                Can't be in mapped area either
       SRL  R1,1
       JOC  ENDUI                Shouldn't be an uneven address
LNK1   MOV  @>FFFE,R1            Get current UISR vector
       JEQ  ENDUI                None
       C    R1,@UISRPC           Is it our UISR?
       JEQ  ENDUI                Yes: then don't link
       CI   R1,>8400             Check if valid
       JL   LNK2
       CI   R1,>A000
       JL   ENDUI                Can't be in mapped area
LNK2   SRL  R1,1
       JOC  ENDUI                Shouldn't be an uneven address
       MOV  @>FFFC,@OLDUWR       Ok, we may have a valid hook: save its workspace 
       MOV  @>FFFE,@OLDUPC       Save its vector
       JMP  ENDUI                And install ours instead
 
*This routine unhooks the UISR
UNHOKU MOV  @OLDUWR,@>FFFC       Restore previous workspace (or >0000)
       MOV  @OLDUPC,@>FFFE       Restore previous vector
       B    *R11                 Called with BL for simplicity

 

 

Share this post


Link to post
Share on other sites
26 minutes ago, GDMike said:

I don't know of what would require that amount, so I would estimate it. Round it off. Most of us don't work for NASA haha so I think whatever it is wouldn't matter if it's underestimated. Now, my question is, can you build forth on the metric number system? Is it a thing or doesn't matter since it's base 16 or whatever base I guess.

 

Yup, that is why I mentioned I'm not using FP, as an example of using other resources, but that's cool I got it, and I'm using it without problems, just wanted a little clarification. Like switching from a great decimal system to weenie metric.

 

Lol, well call it what you want, simple minds, whatever. It established it's dominance here in the USA and we built some of the best stuff the world has ever seen based on it, hmm how hard is it to create forth using metric? I'm not a mathematician like you guys, and I'm stuck on decimal system, good or bad, it's only what works for me. There's pros and cons, but again, I'm not dependent on it myself as everyday life has shown and we get along. But I'll tell you, working on a car that says built in USA needs more metric tooling that my standard set. Now, my USAF jet engine is simple, standard tools. 

<way off topic>

I guess my real point was that people have already abandoned imperial measurement where things really matter. Medicine, science, engineering, money... because the old system is more error prone to calculate.

 

"Like switching from a great decimal system to weenie metric."  

Imperial measurement is not decimal. Inches are divided into 1/2, 1/4, 1/8, 1/16 etc as the system was designed. However machinists made inches decimal because it is simpler. 

 

Metric measurement is a decimal system like Dollars and cents.

Everything is units of 10. 

In other words you are already using it everyday for money. :) 

</way off topic>

  • Like 2

Share this post


Link to post
Share on other sites

Yeah. I see. Thx for clarifying that. 

Nuff said on that topic as we continue to argue that personal preference at a later time. 

But no hard feelings, good to get an opinion and some facts. Thanks

Well, gotta get busy. Trying to get some code pushed, hopefully I can make progress on that front. Have a super day everyone!!!!

 

  • Like 2

Share this post


Link to post
Share on other sites
Posted (edited)
1 hour ago, HOME AUTOMATION said:

I wonder if Dr. Nouspikel's effort would pay-off here...:ponder:

The easiest way to get an effective debounce was once described in some magazine, don't remember which. I used it for all my LOAD interrupt applications quite effectively.

 

START  CLR  @>FFFC
       LWPI SOMEWS
       CLR  R0
LOOP   DEC  R0
       JNE  LOOP
       LWPI WS
       STWP R0
       MOV   R0,@>FFFC
       ...
       AORG >FFFC
       DATA  WS,START

 

The point is that you have to consider a storm of LOAD signals that keep interrupting your routine all the time. The first instruction at START clears the WP pointer, which means that subsequent LOAD signals shoot their return vector into ROM. Then you pause for about a second to allow the user to take the finger off the LOAD switch, and restore the LOAD vector. When you select the original workspace again, your return vector should still be there. As I said, it actually worked, and if there were any problems, they were pretty rare.

Edited by mizapf
Again, blank lines in the code
  • Like 5

Share this post


Link to post
Share on other sites

The main advantage with the metric system is that there is only one unit for one unity. Length has only one unit, meter, not inches, feet, yards, furlongs, miles and I don't know them all.

We (in Sweden) used to have the same mess as you still have in the US today, or maybe even worse, since every region had at least two different local definitions of a mile (that's like you would have two different definitions of a mile in each state, and these two were not identical to the definitions in any other state), but we changed to the consistent metric system before I was born.

Share this post


Link to post
Share on other sites

The only system uses of memory at the high end of expansion RAM I can think of are

  • >FFFC, >FFFE:   LOAD interrupt vectors  <----mentioned earlier
  • >FFD8, >FFE8:   XOP 1 vectors               <----you would know if you were using the eXtended OPeration instruction, XOP 1

To my knowledge, there are no other system uses of that memory, including math routines, floating point or otherwise.

 

...lee

  • Like 2

Share this post


Link to post
Share on other sites
Quote
20 hours ago, GDMike said:

Yup, that is why I mentioned I'm not using FP, as an example of using other resources, but that's cool I got it, and I'm using it without problems, just wanted a little clarification. Thank you!

You know, >FFFC thru >FFFF, can be used with the LOAD interrupt. I was thinking earlier, that I could use the interrupt key, in one of the supporting emulators, to toggle through the switch settings on your Supernotes!:ponder:

Hmm... This isn't even close to the passage I quoted! For months now I have noticed repeated errors as to when and whom have been quoted.:twisted:

 

Lets try again...

  • Like 1

Share this post


Link to post
Share on other sites
On 5/28/2020 at 12:20 PM, GDMike said:

Smart pilot, dumb rules to go metric swap out.

Hey, anyone? Can I use the area >FE00 through let's say, >FFFD or so for general use as a holding area for some data? I read in the ea manual something about not user space. 

I'm not using any fp math formulas.

 

8):ponder:

Share this post


Link to post
Share on other sites
4 hours ago, GDMike said:

See, I'd never know. I can remove a couple items I have slated for that range and free it back up. Thanks for letting me know. I'll release my source to you all here soon once I get to break point in coding. Maybe you can clean it up for us, it's a bees nest. But clear as mud for me to read it. Actually there's just one area that I treated like that so it's not that bad. But it needs optimizing. Would you be up for that?

Mmm well, maybe somewhat,:ponder: I'm no guru where that's concerned. Also, not a lot of free resources... as I am making a renewed effort ...to face some difficult challenges.:-o

  • Like 1

Share this post


Link to post
Share on other sites
Posted (edited)
1 hour ago, HOME AUTOMATION said:

Mmm well, maybe somewhat,:ponder: I'm no guru where that's concerned. Also, not a lot of free resources... as I am making a renewed effort ...to face some difficult challenges.:-o

I thought about this and, sure my code could use cleanup on isle, pick one, but as i thought about that, it wouldn't make sense because I'm pretty sure, not a hundred percent but maybe 98.7-3/4 sure that you would blow it away and rewrite the whole thing. Hmmm right?

So let's not go there, I suppose the better option is for me to go back through it from time to time and clean up my own mess. 

And, as far as I know and see, it's not too terrible.

Edited by GDMike
  • Haha 1

Share this post


Link to post
Share on other sites

The main reason for that the memory expansion has limited use by the system is of course that it's just that - an expansion. Hence the system must be able to work without it.

It's different with the p-system, which requires the expansion. It makes extensive use of the 8 K RAM, for example, for the system's own purposes.

  • Like 1

Share this post


Link to post
Share on other sites
6 hours ago, Lee Stewart said:

The only system uses of memory at the high end of expansion RAM I can think of are

  • >FFFC, >FFFE:   LOAD interrupt vectors  <----mentioned earlier
  • >FFD8, >FFE8:   XOP 1 vectors               <----you would know if you were using the eXtended OPeration instruction, XOP 1

To my knowledge, there are no other system uses of that memory, including math routines, floating point or otherwise.

 

...lee

TI Debugger card also from >FFFF down to >FFE8 8 bytes are allotted from XB for that card. Also EA Cart.

  • Like 1

Share this post


Link to post
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.

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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...