Tuesday, August 28, 2018

8 bit vs 8 bit (Processor wars) Update + 6309 code

The graphics text code for the 6803 has been updated.  It has been optimized a bit by loading two bytes from the font at a time with a single LDDD instead of just 1.   It also cuts the number of left and right font pointer changes for the index register in half.

It now takes a total of 92 clock cycles for the 6803 to write a pair of characters to the screen.  The 6502 takes 152 clock cycles to do the same thing.

For one full screen of characters, the 6803 now takes 46080 fewer clock cycles to write the characters to the screen vs the 6502.   I haven't looked up the cycles for the font address or screen address calculation yet, but the 6803 appears to be faster overall even though the 6502 uses tables.  The screen scroll is even worse for the 6502.

Counting white space, the 6803 code is now 63 lines long and the 6502 code is 80 lines long not counting the font and all the extra address tables for the 6502.  Total size wise it isn't even close.

The 6303 code will benefit from the same optimization but it should be noted that the push instructions take 1 clock cycle more than the 6803.  The difference in clock cycles there is more than made up for with faster code in the address calculation section.

The 6809 code also benefits from this optimization, and it only requires 16 instructions to write the pair of characters to the screen vs 24 for the 6803, and 40 for the 6502.

The 6309 code supports the 16 bit instruction EORD, which drops 4 opcodes vs the 6809.  There doesn't appear to be an EOR for the new registers, so we can't use 32 bit loads & pushes like I had hoped, but we are only looking at around 60 clock cycles.

As I stated before, this is based on writing to a graphics memory map like on the Plus/4, or C64.

6309 code to write the 2 characters to the screen:


 ; print characters to screen
 ldd  6,x     ; get 2 bytes of left character 5
 eord 6,y     ; add the right character 5
 pshu a,b     ; write to the screen 4

 ldd  4,x     ; get 2 bytes of left character 5
 eord 4,y     ; add the right character 5
 pshu a,b     ; write to the screen 4

 ldd  2,x     ; get 2 bytes of left character 5
 eord 2,y     ; add the right character 5
 pshu a,b     ; write to the screen 4

 ldd  ,x     ; get 2 bytes of left character 5
 eord ,y     ; add the right character 5
 pshu a,b     ; write to the screen 4

 rts

No comments:

Post a Comment