Wednesday, August 15, 2018

--> 6809

The 6809 is incomplete, but here is work in progress.  The rest of the code will be similar to the 6803.
It pushes two bytes to the screen at once using the user stack pointer.
It's been a while since I did much with the 6809, so this is sure to change when I try to assemble it.
You'll notice clock cycle times per instruction aren't fantastic, but it's competitive with the 6502 and requires fewer instructions.
The 6309 can push 4 bytes to the screen at a time, so only 2 pshu instructions would be required.
*edit*
The 6309 does not have an EOR opcode dealing with the new registers, so pushing 4 bytes at a time is not practical.
The code has been updated to handle 2 bytes at a time.


 ldu  screen
 ldx  leftchar   ; point to left char 4
 ldy  rightchar   ; point to right char 4

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

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

 ldb 2,x     ; get 2 bytes of left character 5
 eorb 3,y     ; add byte of right character 5
 eora 2,y     ; add byte of right character 5
 pshu a,b     ; write to the screen 4

 ldb 0,x     ; get 2 bytes of left character 5
 eorb 1,y     ; add byte of right character 5
 eora 0,y     ; add byte of right character 5
 pshu a,b     ; write to the screen 4

 rts
 

No comments:

Post a Comment