Friday, January 19, 2018

Android Phone Screens under a Microscope

Did you ever wonder what an Android phone screen looks like under a microscope? So did I. So at the start of this weekend, I got the microscope out and took some photos, collected in one picture below. The results are amazing. What looks white to the naked eye, is really a large field of RGB (red-green-blue) elements under magnification. All colors are, of course, obtained by adjusting the brightness of each RGB element appropriately, as illustrated in this picture too.

Monday, December 18, 2017

Chess for Android v5.4: Adjudication

I am rolling out Chess for Android version 5.4 on Google Play. Besides minor improvements, the major new feature consists of draw and resign adjudication during chess engines tournaments.

As shown below, a new tournament dialog has been implemented which shows, besides familiar older options, a section for draw and resign adjudication. If during a game, after the given move number and during the given move count, the score drops below the requested draw score (in cp) or exceeds the requested resign score (in cp, either consistently for white or for black), the game is adjudicated rather than played in full. This feature has been requested many times by tournament managers to avoid wasting time playing e.g. boring drawn games until the 50-move rule applies.

See this talkchess posting for an example game.

As usual, let me know if you encounter problems with the new release. Also, I could use some help translating the new strings into several languages (most will display English for now).

Sunday, April 23, 2017

Micro-KIM Tutorial: The Memory Map

Let’s revisit the Micro-KIM memory map, introduced in the third tutorial.

| 2K EPROM  |$1fff
| monitor   |
| program   |$1800
| 6532 RIOT |$17ff
| I/O, timer|
| and RAM   |$1740
| optional  |$173f
| I/O, timer|
| and RAM   |$1400
|           |$13ff
| 5K RAM    |
|           |$0000

Since the default kit (without any expansion) only uses the lower address bits to access 8K, memory repeats itself every 8K. You can verify this by storing and inspecting values in, for instance, addresses $0000 and $2000. Any value stored in one address will show up in the other. Although an interesting factoid, there is no reason to let Micro-KIM programs address anything outside the range $0000-$1fff.

Addresses $0000-$13ff contain 5K free RAM (another interesting factoid: the Micro-KIM actually wastes 3K of its 8K RAM chip to keep compatibility with the original KIM-1). This memory region can be used to store data and code. To verify this, while running the monitor program, use the keyboard to store and inspect values. For example, type AD followed by 0200, DA, and FF and you will see the value at this address change. Type + a few times to change the address. Then, if you later revisit this address with AD 0200, you will still see the value FF stored at this address.

The first 256 bytes of RAM with addresses $0000-$00ff are called the zero page. The 6502 microprocessor supports zero-page addressing to access this part of RAM with more compact and more efficient instructions. For example, both the following two instructions load the contents of address $0000 into register X, but the first uses just 2 bytes rather than 3 bytes for the instruction encoding and executes in 3 rather than 4 cycles.

a6 00 ldx $00
ae 00 00 ldx $0000

This page is typically used by programs to store frequently accessed bookkeeping variables. In fact, the monitor program uses a few bytes stored at addresses $00ef-$00ff for various functions. The next page of RAM with addresses $0100-$01ff is used as stack by the 6502 microprocessor and should be left alone. From address $0200 all the way up to $13ff can be used freely though, which is why most programs start with the following command.

.org $0200

Addresses $1400-$173f are reserved for an optional second RIOT chip, but are otherwise unused in the default kit. You can verify this by trying to store anything in this range. Type AD, 1400, DA, followed by any value. No matter how hard you try, the data field in the LED display remains 00. Addresses $1740-$17ff are used by the 6532 RIOT chip. The functions of this peripheral chip are made available as regular memory addresses, a technique referred to as memory mapping. The 6532 provides 128 bytes of free RAM, two parallel I/O data ports, and programmable timers with interrupt capability. Details of this chip are given in later tutorials. For now, type AD 1744 while running the monitor program to get a surprise: the data field on the LED does not show one value, but cycles through many, as shown below.

Memory Mapped Address in the Micro-KIM.

Lastly, addresses $1800-$1fff are taken by the 2K EPROM that contains the monitor program, discussed earlier. Although you can use the monitor program to inspect its own values in this memory region, you can obviously not change the values by typing DA and a value. For example, after typing AD and 1FFF, the data field shows the value 1C corresponding to the second byte of IRQT, as can be seen in the listing of the monitor program in the appendix of the Setup and User’s Manual of Briel Computers. However, typing DA followed by any value has no effect, since this part addresses immutable ROM.

That's it again for now! Please like, share, or comment if you like this series. Also, note that the series is now available as single PDF on my Micro-KIM webpage.

Sunday, April 16, 2017

Micro-KIM Tutorial: Available as Single PDF

If you were following (and hopefully enjoying) the Micro-KIM tutorial, you may have noticed a rather long silence after the last posting. Unfortunately, my day job and a move plus remodeling claimed most of my spare time. However, I plan to continue the tutorial really soon again!

In the meanwhile, I have made all previous tutorials available as a single PDF on my Micro-KIM website, where you can also find the source code of all examples. Future tutorials will be added to this PDF to keep the collection available as a single file.

Thursday, October 13, 2016

New Chess Graphics for Chess for Android

Bryan Whitby, who contacted me earlier to tell about very cool USB chess board projects, contacted me recently with a very generous offer to use his awesome chess graphics in Chess for Android. I am very thankful, since these graphics look really good, and combine well with the various board types already supported. So, expect an updated on Android Play and my website really soon! And, thank you Bryan!