Skip to content

Baby Steps Monitor

November 25, 2017

I need some kind of simple onboard debugging monitor for the olduino at least until I get the xmodem loader working well. I’ve started one written in C. It counts on getting the registers saved during initialization and it can display the regs and memory. next step will be to add the xmodem receive command and then automate an initial xmodem attempt on startup. I’m doing this all in C of course which makes it large but i don’t care! I have a 32k rom to fill.
In the sequence below I’ve entered ‘r’ to display the registers then 7f00 cr to set the working address to 7f00 where the regs are saved then ? to display memory at that location which verifies the r display.

15:38:54.511> Serial Monitor Here
15:38:57.067> > registers
15:38:57.067> 
15:38:57.145> R00 12DB 0001 7FE3 0506 
15:38:57.145> R04 1321 1331 014E 0072 
15:38:57.223> R08 019D FF0A 000B 0000 
15:38:57.223> R0C 0020 002B 7F1D 0072 
15:44:48.347> > ?
15:44:48.347> 
15:44:48.470> 0000 C0 12 97 00 81 73 91 73 86 73 96 73 87 73 97 73 
15:44:56.472> > 0007
15:44:57.162> > 007F
15:44:58.536> > 07F0
15:44:58.660> > 7F00
15:45:01.910> > ->7F00
15:45:01.910> 
15:45:02.035> 7F00 12 DB 00 01 7F E3 05 06 13 21 13 31 01 4E 00 72 
#include <olduino.h>
#include <nstdlib.h>
#define putc(x) putcser(x)
unsigned char getcser();
#define getc() getcser()
void putcser(unsigned char);
#include <dumper.c>
void regdump(unsigned int* data){
	unsigned int i;
	for(i=0;i<16;i++){
		if (0==(i%4)) printf("\nR%cx ",i);
		printf("%x ",*data++);
	}
	printf("\n");
}
void main(){
	unsigned char cin='?';
	unsigned char * addr=0;
	unsigned int* regaddr=(unsigned int*)0x7f00;
	unsigned int caddr=0;
	asm(" seq\n"); //make sure Q is high to start
	printf("\nSerial Monitor Here\n");
	while(1){
		printf("> ");
		cin=getc();
		if ((cin>='0') &(cin<='9')){
			caddr*=16;caddr+=cin-'0';
			printf("%x\n",caddr);
		}else if ((cin>='a') & (cin<='f')){
			caddr*=16;caddr+=cin-'a'+10;
			printf("%x\n",caddr);
		}else{
			switch (cin){
				case '\r':
					printf("->%x\n",caddr);
					addr=(unsigned char *)caddr;caddr=0;
					dump(addr,16);
					break;
				case '?':
					printf("?\n");
					dump(addr,16);
					break;
				case 'r':
					printf("registers\n");
					regdump(regaddr);
					break;
				case '+':
					printf("+\n");
					addr+=16;
					dump(addr,16);
					break;
				case '-':
					printf("-\n");
					addr-=16;
					dump(addr,16);
					break;
				default:
					printf("%c/%xc unrecognized\n",cin,cin);
					break;
			}
		}
	}
}
void includeser(){

	asm("BAUDRATE EQU 	9600\n");
	asm(" include VELFserial3.inc\n");
}
#include <olduino.c>
#include <nstdlib.c>
void saveregs(){asm("SAVEREGS: EQU 1\n");}

I always want the last word so that wordpress doesn’t eat my code!

Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

w

Connecting to %s

%d bloggers like this: