Kenbak-1 Program Counter Update

58 views
Skip to first unread message

Ricky Bryce

unread,
Sep 19, 2022, 7:56:15 PM9/19/22
to uKenbak-1
I was messing around with some "relative" jumps on the Kenbak, and came across a difference between Mr. Richardson's Emulator, and the Kenbakuino.  I've narrowed this down to the program counter updates.

It seems as though the Kenbakuino updates the program counter before executing an instruction, and the Kenbak Web emulator updates after.  This means that if I load the program counter into the "A" register, then I get two different answers.

The code is very simple:  On the Kenbakuino, I get a program counter of 006.
000,000,000,004,024,003,034,200,000,000,s

The same program running on the emulator at: http://www.neocomputer.org/kenbak/kenbak1-JS.html
will return 004
The format is slightly different:
000 000 000 004 024 003 034 200 000 000

I was looking at the Kenbak-1 Programming Reference manual, and it looks like the update should be after the instruction executes, so this may be a bug in the kenbakuino?  I'm just basing this on the fact that the manual describes the program counter incrementing after it describes what the instruction does.

Just wanted to get your thoughts on this if anyone knows what is happening.



Mark Wilson

unread,
Sep 19, 2022, 8:12:12 PM9/19/22
to uKenbak-1
Interesting. It may be a bug.  I will investigate soon.

M

Ricky Bryce

unread,
Sep 19, 2022, 8:39:21 PM9/19/22
to uken...@googlegroups.com

Thanks, Mr. Wilson...

I know everyone strives to be as accurate as possible with the emulators, but from time to time, we always come across something.  Haha  On the other hand, it could just be me. 

It's also my understanding on the original Kenbak that while a program is running, and a user presses a button, [200] display goes "dim", and [377] overrides while buttons are active.  I don't know if that is possible on the kenbakuino, but that doesn't seem to affect the logic itself.  Mr. Richardson was explaining that to me in PR-20 of the programming reference manual.

Thanks for all the hard work everyone's done on these emulators.  They really help a person to understand how things came about, and how these machines really work.

Take care,

Ricky

--
You received this message because you are subscribed to a topic in the Google Groups "uKenbak-1" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ukenbak-1/Sjh069Mx3lo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ukenbak-1+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ukenbak-1/8ea93d4e-ae27-4edd-8ff9-c8948534f2e6n%40googlegroups.com.

Mark Wilson

unread,
Sep 19, 2022, 8:45:08 PM9/19/22
to uKenbak-1
No worries.

I don't do the "dim" display of entry values while running

Ricky Bryce

unread,
Sep 20, 2022, 3:58:43 AM9/20/22
to uken...@googlegroups.com

Thanks for the reference on the documentation.  That has very useful information.  Know that we all appreciate the work you do on this.

Enjoy the rest of your week!

Ricky

Mark Wilson

unread,
Sep 22, 2022, 10:04:42 PM9/22/22
to uKenbak-1
OK, I've made the fix and updated the repo (https://github.com/funnypolynomial/Kenbakuino)
Memory location 3, i.e. the "program counter", is incremented after the instruction is executed (rather than during execution, as each instruction byte is fetched).
The effect is that now
.lbl   LDA 003
sets A to lbl, and
       STA 003
sets the PC to A+2.

Well spotted Ricky, thanks for finding this.

Mark

Ricky Bryce

unread,
Sep 23, 2022, 3:24:46 AM9/23/22
to uken...@googlegroups.com

Thanks Mark!  Again, appreciate all the work you do on this.

Take care,

Ricky

Frank P.

unread,
Sep 23, 2022, 11:00:28 AM9/23/22
to uKenbak-1
If you want to upload this new sketch to either a nanoKenbak-1 or one of the newer µKenbak-1 units that use the DS3231 RTC instead of the older DS1307 RTC, don't forget to modify the second and third constants in clock.h to 0x0E and 0x00.

Note that the last EEPROM page will be reduced in length by 8 bytes if you do this. That's a lot better than all the strange things that will happen if you don't do this :)

Reply all
Reply to author
Forward
0 new messages