Skip to content

Boyd Programmer’s Calculator II

January 31, 2018

I’m running out of time before we leave for the winter but I wanted to button the Boyd back up with some sort of code in the ROM. This program just accepts key presses as hex input, converts to decimal and puts it on the display. With another hour I would have shown the hex as i entered it but it wasn’t to be.

The code is simple but it’s using the standard library functions for math and converting integer to ascii for display. I was a bit worried I would run over the 1805’s 64 bytes of RAM with the stack and variables but not so far – I think the lowest the stack got was 10D5 meaning there’s a whole 17 bytes left when i’m down in the bowels of a conversion routince calling a division routine. I imagine i can improve that when i need to.

//boydmonseg - simple keyboard/display program using the boyd display in full segmented mode.
#include "olduino.h"
#define initleds(mode) 	asm(" req\n seq\n dec 2\n ldi " #mode "\n str 2\n out 7\n req\n")
#include "boyd.h" //definitions for the boyd calculator
#define nofloats
unsigned char boydscan();
void disp1(unsigned char d){//display a byte as two hex digits
	asm(" glo 12\n ani 0x0f\n" //prep bottom digit
		" dec 2\n str 2\n out 7\n"
		" glo 12\n shr\n shr\n shr\n shr\n" //prep top digit
		" dec 2\n str 2\n out 7\n"


void dispval(unsigned char v){
	register unsigned int i;
	initleds(0b11010000); //LEDs in hex decode mode
	for (i=6;i!=0;i--) out(7,0);


unsigned int strlen(char *str)
	unsigned int slen = 0 ;
	while (*str != 0) {
      slen++ ;
      str++ ;
   return slen;
char * itoa(int s, char *buffer){ //convert an integer to printable ascii in a buffer supplied by the caller
	unsigned int r,k,n;
	unsigned int flag=0;
	char * bptr; bptr=buffer;
	if (s0){

	return buffer;

void dispstr(char * str){//display 8 or fewer characters on the boyd LEDs
	register unsigned int i,L;
	L=min(strlen((char *)str),8);//length to display
	initleds(0b11110000); //LEDs in no-decode mode
	if (L0;i--){ //blank trailing positions
	for (i=L;i>0;i--){

void main()
	unsigned int acc=0;
	unsigned char k,k2;
	char buf[8]="01234567";

		dispstr("_"); acc=0;

#include "olduino.c" //for the delay routine
void boydinc(){
	asm(" align 256\n");
	asm(" include \"\"\n");

I should mention that I'm using one of Jon Kenneke's adapters to fit a 2732 EPROM into the Calculator. Jon supplied it already made up and added a 2732 EPROM in the package.  It had the original calculator firmware so it fired up on the first try – thanks Jon!

It's much thicker than the original ROM but you can close everything up with a little work.  This is probably just obvious but I had to route the ribbon cable back over the battery box to make a single bend in it rather than having an S bend right on top of the EPROM.

From → Uncategorized

  1. Jon permalink

    Great work, Bill! Sorry it took so long to get an adapter to you.

Trackbacks & Pingbacks

  1. MK48Z02 Non-Volatile RAM for the Boyd Calculator | olduino

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: