Monday, 9 November 2020

Key Debounce Delay POKEs

Greg Dionne has been working on a TRS-80 BASIC compiler. In the midst of  corresponding with him about the developments we discussed my normal PEEK(2)ANDPEEK(17023) routine for continuous polling of key input. He then mentioned the "debounce" key delay, which could apparently be adjusted by way of a couple of POKEs.  Here are his comments, which might be helpful for MC-10 BASIC programmers:

More notes for you now that I'm looking at the keyboard routines.

1.  If you want the interpreter to go faster when a key is pressed, set the debounce delay to 1.  (POKE 16925,0 : POKE 16926,1).

2.  To examine the state of the BREAK key, (well, for the compiler at least), take a PEEK at 16955.  255=PRESSED  0=NOT PRESSED

3.  The keys for the KEYSCAN are stored in 16945 to 16952.  This gives you access to each individual key.  So you can tell if more than one key is pressed and which keys.  

4.  CONTROL, SHIFT and BREAK do not have dedicated memory allocated for them. You can query the SHIFT key state via doing a PEEK(3).  But the others will be lost since the interpreter will immediately stomp on the keystrobe after catching a key, so only SHIFT can (reliably) be caught this way.  The compiler will have no trouble querying the other states. 

To see all of this in action:

10 POKE 16925,0:POKE 16926,1 : REM MAKE IT SNAPPY

20 MC=16384:KS=16945



50 POKE2,251:POKE 16394,PEEK(3):REM BREAK

60 POKE2,127:POKE 16395,PEEK(3):REM SHIFT


80 GOTO 30

I have added his debounce delay POKES (set to 1) to the following programs and updated my compilations:












































It seems to make a noticeable difference.  Movement seems much smoother and responsive.  I'll be adding the POKEs to other programs over the next little while.

Sunday, 8 November 2020

Warren's World: The Lost Colony

Working on a conversion of "Warren's World: The Lost Colony"

Here is a description I found on the Net, which I have fixed up a little (I think it was translated from Russian or the author was a Russian speaker).  I have also added a few highlighted terms for items that are needed during play):

Lost Colony is a turn-based economic strategy game that tells the story of the difficult fate of a human colony in a distant solar system. The game is based on the mechanics of the popular early 1980s game Hammurabi (the progenitor of the "construction and management simulation" video game subgenre), the essence of which boils down to the extraction and distribution of useful resources among the constantly growing population of the state/city/society.

There is a Lost Colony and the plot is as follows: In the distant future, during the exploration of deep space, a planet suitable for life was found, and since resources on Earth were dwindling, it was agreed to seek to colonize the newly discovered world. The first people sent were farmers and construction workers to prepare a new "home" to receive the rest of the settlers. But alas, everything did not turn out as planned. While the first starship was getting to the colony another war broke out on Earth and the colonists were left to fend for themselves. The pioneers, abandoned to their fate, suffered significant losses in the first years in a new place until they developed an ability to supply a minimum number of necessities. These had to be carefully issued per person. To organize production and distribution of these benefits an elected position was established-- "Chief Economist." This is the role the player takes on.

         Goal: To hold the position of Chief Economist for 15 years (i.e. 15 moves).

Management is quite simple: At the beginning it is necessary to distribute people and robots (the latter are intended only to increase productivity-- machines cannot completely replace people) across five sectors of the "economy" (Transport, Mining, Energy, Farms and Manufacturing). Then, each turn, the computer asks a series of questions: What products will be produced (Robots, Transports, Manufacturing Plants, and Consumer goods) and in what quantities, what amount of "wages" will go to the workers, and what percentage of those wages will go to taxes. Nevertheless, the player is not limited to being a mere "accountant"-- You will also be asked to explore new territories. To do this, a map of the entire colony is displayed divided into regions; just indicate the regions you wish to select with the cursor and the computer will display information on the resources located there. But it is not enough just to explore new lands-- full-fledged mining and expansion of farming of these lands requires that they be populated. Finally, at the end of the turn, a certain event can happen (or maybe not)-- as a rule they are not very pleasant, such as: epidemic, explosion, etc.

Remember, in Lost Colony you will have two "opponents"-- these are the ever-growing population and proper adjustments to the wage level required each turn. If you cannot provide people with everything they need, you will lose your post as chief economist, which will automatically lead to the end of the game.

Summarizing all of the above: this game, despite the relative simplicity of mastering it, is not suitable for only "a couple of evenings" of play. It requires a very detailed approach, preferably with a calculator. Also be prepared for the fact that Lost Colony does not have much in the way of graphics and looks more like a specialized piece of software for financial workers.

-- Skud

My TRS-80 MC-10 version is a port of a GW BASIC version for the PC. It's a work in progress.  My progress right now is hampered by my inability to play the game very well.  So if there's anyone out there willing to do some play testing, the game can be played online here:

Just select WARRENS from the Cassette menu and type RUN.  I'll leave it open to be played for a while during the debugging process before removing it until I can fully determine the original author's intentions regarding distribution.

Here is a screenshot of the PC version of the game map:

Here's another Description of the game that I found online:

Lost Colony is a resource management game which takes place on another planet, site of the first human settlement off Earth. As the economic administrator of the colony, your job is to keep the population happy and occupied, and to generally run things smoothly until the next supply ship arrives from Earth - in 15 years.

Each turn tasks you with allocating resources for the upcoming year, by dividing them among the five major industries (farming, mining, energy, manufacturing and transportation). These resources include human labor, robotic machinery and the planet's raw materials; production quotas can be diverted towards various goals, consumer goods handed out to keep the populace contented (and obedient), and new areas can be explored and settled.

Along the way, you'll have to deal with such misfortunes as labor strikes, famine, industrial accidents, plagues and natural disasters. Savvy governance will ensure that the struggling colony prospers, while continued mismanagement will have you booted out of office in disgrace.

Cebion # 2020-03-05 16:04:38

 Here is a PC Magazine Review: