Wednesday, August 15, 2018

--> 6801/6803

The 6801 group of microcontrollers was introduced in 1978.
They build on the 6800 instruction set by adding the 16 bit D register, several new opcodes including a hardware multiply, and many opcodes take fewer cycles.
It was only used as the primary CPU in the MC-10, Alice, and the world's first laptop, the Epson HX-20 was based on the Hitachi version of the chip.
It probably would have been a better choice for the Tandy 100 as it is faster than the 8085.  Both have low power design features but I'm not sure which takes the least power.

*edit Aug 28, 2018*
The screen output code has been optimized quite a bit.  This change cuts the number of loads in half.
It now takes a total of 92 clock cycles to write a pair of characters to the screen.


;**************************************************
; write two characters at once
;**************************************************
print_642:
; a already contains left character
; Multiply character # by 8 for byte offset in table
; multiply version, 12 clock cycles, 9 on 6303
 ldab #8     ; 7 bytes per character ;2
 mul       ; multiply them ;10 - 7
 addd #leftfont-225  ; base address of font, -224 to subtract ' ' from char, -1 to adjust for using stack as a pointer
 std  leftchar   ; save to character pointer

 ldd  row     ; put the row to the MSB, col in LSB
 lsrb
 addd #screen+7   ; 8 row font data
 pshb      ; transfer to x, then s for our screen pointer
 psha
 pulx
 sts  stacktmp   ; save the stack pointer
 txs       ; put screen pointer in s

 ldaa 1,x     ; get right character
 ldab #8     ; 7 bytes per character
 mul       ; multiply them
 addd #rightfont-224  ; base address of font, -224 to subtract ' ' from char
 std  rightchar
 ldx  rightchar

 ; print characters to screen
 ldd  6,x     ; get 2 bytes of right character 5
 ldx  leftchar   ; point to left char 4
 eorb 7,x     ; add the left character to B 4
 eora 6,x     ; add the left character to A 4
 pshb      ; write the 1st byte to the screen 3
 psha      ; write the 2nd byte to the screen 3

 ldd  4,x     ; get 2 bytes of left character 5
 ldx  rightchar   ; point to right char 4
 eorb 5,x     ; add the right character to the byte 4
 eora 4,x     ; add the right character to the byte
 pshb      ; write the 1st byte to the screen 3
 psha      ; write the 2nd byte to the screen 3

 ldd  2,x     ; get 2 bytes of right character 5
 ldx  leftchar   ; point to left char 4
 eorb 3,x     ; add the left character to the byte 4
 eora 2,x     ; add the left character to the byte
 pshb      ; write the 1st byte to the screen 3
 psha      ; write the 2nd byte to the screen 3

 ldd  0,x     ; get 2 bytes of left character 5
 ldx  leftchar   ; point to left char 4
 eorb 1,x     ; add the right character to the byte 4
 eora 0,x     ; add the right character to the byte
 pshb      ; write the 1st byte to the screen 3
 psha      ; write the 2nd byte to the screen 3

 lds  stacktmp
 rts

No comments:

Post a Comment