Wednesday, August 15, 2018

--> HD6303

The Hitachi 6303 can run the 6803 code, but this version is slightly faster. 
 The 6803 will not run this code due to the use of the XGDX instruction.
The numbers in the top section are clock cycles 6803 vs 6303

;**************************************************
; write two characters at once
;**************************************************
print_642:
 ; a already contains left character
 ; Multiply character # by 8 for byte offset in table
 ; shifted version, 13 clock cycles on 6803, 5 on 6303
 tab       ;2 - 1
 clra      ;2 - 1
 aslb      ;3 - 1
 aslb      ;3 - 1
 asld      ;3 - 1
 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
 xgdx      ; put screen address in x
 sts  stacktmp   ; save the stack pointer
 txs       ; put screen address in s
 xgdx      ; return character pointer to x
 
 ldab 1,x     ; get right character
 clra      ;2 - 1
 aslb      ;3 - 1
 aslb      ;3 - 1
 asld      ;3 - 1
 addd #rightfont-224  ; base address of font, -224 to subtract ' ' from char
 std  rightchar
 xgdx
 
 ; print characters to screen
 ldaa 7,x     ; get byte of left character 4
 ldx  leftchar   ; point to right char 4
 eora 7,x     ; add the right character to the byte 4
 psha      ; write to the screen 4

 ldaa 6,x     ; get byte of right character
 ldx  rightchar   ; point to left char
 eora 6,x     ; add the left character to the byte
 psha

 ldaa 5,x     ; get byte of left character
 ldx  leftchar   ; point to right char
 eora 5,x     ; add the right character to the byte
 psha

 ldaa 4,x     ; get byte of right character
 ldx  rightchar   ; point to left char
 eora 4,x     ; add the left character to the byte
 psha

 ldaa 3,x     ; get byte of right character
 ldx  leftchar   ; point to left char
 eora 3,x     ; add the left character to the byte
 psha

 ldaa 2,x     ; get byte of right character
 ldx  rightchar   ; point to left char
 eora 2,x     ; add the left character to the byte
 psha

 ldaa 1,x     ; get byte of right character
 ldx  leftchar   ; point to left char
 eora 1,x     ; add the left character to the byte
 psha

 ldaa 0,x     ; get byte of right character
 ldx  rightchar   ; point to left char
 eora 0,x     ; add the left character to the byte
 psha

 lds  stacktmp
 rts

No comments:

Post a Comment