Skip to content

Membership Card Goes Up Past 11!

October 29, 2017

 

img_0026-1I tried another CDP1802ACE chip from my ebay purchase – nominally manufactured by Harris in 1996.  These chips are rated for 3.2MHz at 5V but this one runs quite happily at 12MHz.  To run the Dhrystone benchmark I had to change the putc routine to insert long delays to pace the output to the AVR/PC at no more than 57,600 baud(5760 characters/second).

This will not be the record for 1802 speed – Ian May has been running them at over 32MHz with overvoltage and a Peltier cooler(!) – but it’s certainly a record for Drhrystones/second with my compiler in a more-or-less stock membership card.

At just under 5 seconds for 1000 executions I make it 208 Dhrystones/second.  This is not as fast as a Z-80 at 4MHz but it’s wicked fast for an 1802!

img_0027
UPDATE: I’ve tried 5 of the 10 eBay chips – 3 of them were fine at 12 MHz and two are only reliable at 10. I had also bought some 1802’s from an aliexpress vendor – these were older RCA chips and the one I tried would clock at 8MHz but was only reliable at 6.

14:12:53.231> Execution starts, 1000 runs through Dhrystone !@#
14:12:58.047> Execution ends!@#
14:12:58.047>
14:12:58.047> Final values of the variables used in the benchmark:
14:12:58.047>
14:12:58.047> Int_Glob:            5
14:12:58.047>         should be:   5
14:12:58.047> Bool_Glob:           1
14:12:58.047>         should be:   1
14:12:58.047> Ch_1_Glob:           A
14:12:58.047>         should be:   A
14:12:58.667> Ch_2_Glob:           B
14:12:58.667>         should be:   B
14:12:58.667> Arr_1_Glob[8]:       7
14:12:58.667>         should be:   7
14:12:58.667> Arr_2_Glob[8][7]:    1010
14:12:58.667>         should be:   Number_Of_Runs + 10
14:12:58.667> Ptr_Glob->
14:12:58.667>   Ptr_Comp:          24576
14:12:58.667>         should be:   (implementation-dependent)
14:12:58.667>   Discr:             0
14:12:58.667>         should be:   0
14:12:58.667>   Enum_Comp:         2
14:12:58.667>         should be:   2
14:12:58.667>   Int_Comp:          17
14:12:58.667>         should be:   17
14:12:58.667>   Str_Comp:          DHRYSTONE PROGRAM, SOME STRING
14:12:58.667>         should be:   DHRYSTONE PROGRAM, SOME STRING
14:12:58.667> Next_Ptr_Glob->
14:12:58.667>   Ptr_Comp:          24576
14:12:58.667>         should be:   (implementation-dependent), same as above
14:12:58.667>   Discr:             0
14:12:58.667>         should be:   0
14:12:58.667>   Enum_Comp:         1
14:12:58.667>         should be:   1
14:12:58.667>   Int_Comp:          18
14:12:58.667>         should be:   18
14:12:58.667>   Str_Comp:          DHRYSTONE PROGRAM, SOME STRING
14:12:58.667>         should be:   DHRYSTONE PROGRAM, SOME STRING
14:12:58.667> Int_1_Loc:           5
14:12:58.667>         should be:   5
14:12:58.667> Int_2_Loc:           13
14:12:58.667>         should be:   13
14:12:58.667> Int_3_Loc:           7
14:12:58.667>         should be:   7
14:12:58.667> Enum_Loc:            1
14:12:58.667>         should be:   1
14:12:58.667> Str_1_Loc:           DHRYSTONE PROGRAM, 1'ST STRING
14:12:58.667>         should be:   DHRYSTONE PROGRAM, 1'ST STRING
14:12:58.667> Str_2_Loc:           DHRYSTONE PROGRAM, 2'ND STRING
14:12:58.667>         should be:   DHRYSTONE PROGRAM, 2'ND STRING
14:12:58.667> done

 

;IO1802.inc contains input/output runtime routines for LCC1802
;The port is in regArg1, the output byte is in regArg2
;17-10-16 adding _putcpace(port,byte) to limit output speed to the AVR
;         defaulting putc(x) to putcpace(7,x)
	align 64
_putc:		;default putc(x) is paced output on port 7
	cpy2 	13,12	;move data to second param reg
	ldad	12,7	;select port 7
	br	_putcpace ;drop into paced output
_putcpace:	;putcpace(x,y) does host output on port x at no more than about 57600 baud
		;i'm doing the pacing before the output so i can branch to _out when done.
 if MOMCPU=$1805	;first balance off the call path for the 1806
	nop
	nop
	nop
 endif
 ifdef CPUSPEED
   if CPUSPEED>4000000	;now deal with the processor speed
      ;targetting a thruput of 57600 baud - 5760 characters per second
      ;each character needs CPUSPEED/5760/16 instruction times
      ;the baseline out() is 42 instructions including call/return
       NEEDINST: equ (CPUSPEED/5760/16)
       ldi (NEEDINST-42+1)/2
-:     smi 1
       bnz -
    endif
  endif
  br _out

_inp:		;raw port input
		;stores a small tailored program on the stack and executes it
	dec	sp	;work backwards
	ldi	0xD3	;return instruction
	stxd
	glo	regarg1	;get the port number
	ani	0x07	;clean it
	bz	+	; inp(0) isn't valid
	ori	0x68	;make it an input instruction
	stxd		;store it for execution
	cpy2	rt1,sp	;rt1&sp now point to an empty byte to be overwritten by the inp instruction
	inc	rt1	;rt1 points to the 6x instruction
	sep	rt1	;execute it
;we will come back to here with the input byte in D
	inc	sp	;step over the work area
	plo	retVal	;save it to return
	ldi	0
	phi	retval	;clear top byte
+	inc	sp	;need to get rid of the 6x instruction
	inc	sp	;and the D3
	Cretn		;and we're done

_out:		;raw port output
		;stores a small tailored program on the stack and executes it
		;this could be bolder:
		;store the program as 6x cc D5 where x is the port number and cc is the char
		;then SEP sp
		;the D5 would return to the calling program and finish fixing the stack.
		;saves 6 instructions but it's a bit tricky.
	dec	sp	;work backwards
	ldi	0xD3	;return instruction
	stxd
	cpy2	rt1,sp	;rt1 will point to the OUT instruction
	glo	regarg1	;get the port number
	ani	0x07	;clean it
	ori	0x60	;make it an out instruction - 60 is harmless
	stxd		;store it for execution
	glo	regarg2	;get the byte to be written
	str	sp	;store it where sp points
	sep	rt1	;execute it
;we will come back to here with sp stepped up by one
+	inc	sp	;need to get rid of the 6x instruction
	inc	sp	;and the D3
	Cretn		;and we're done

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

Advertisements

From → Uncategorized

One Comment

Trackbacks & Pingbacks

  1. Odious Comparisons – RCA 1802 vs IBM 370 | olduino

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 )

Connecting to %s

%d bloggers like this: