Posted By
Litwr on 2013-08-02 13:13:58
| Re: Z80 GUI: SymbOS
Hi, JamesD. Thank you very much for your information. However I have the intention to discover truth! I like any CPU so I have to know all about them. I really want to find more data about speed comparison. Sorry I am only skilled with 6502 and i80x86 assemblers. My dream is to find true speed relationship between 6502, z80, and K1801VM1 (it used at first SU home PC https://en.wikipedia.org/wiki/Electronika_BK). I've just made two algorithms for 6502:
- general addition and assignment of n-byte numbers (n - constant, n < 256), it realizes v3 := v1 + v2 assignment operator;
- the comparison of two n-byte zero-terminated strings (n - variable, any value in range 0..65535).
Algorithm1
the call | cycles | bytes
|
---|
| lda #>v1 | 2 | 2
| | sta bigadd.arg1 + 2 | 4 | 4
| | lda #<v1 | 2 | 2
| | sta bigadd.arg1 + 1 | 4 | 4
| | lda #>v2 | 2 | 2
| | sta bigadd.arg2 + 2 | 4 | 4
| | lda #<v2 | 2 | 2
| | sta bigadd.arg2 + 1 | 4 | 4
| | lda #>v3 | 2 | 2
| | sta bigadd.arg3 + 2 | 4 | 4
| | lda #<v3 | 2 | 2
| | sta bigadd.arg3 + 1 | 4 | 4
| | jsr bigadd | 6 | 3
| | | 42 | 39
|
| |
the subroutine | cycles | bytes
|
---|
bigadd | clc | 2 | 1
| | ldx #0 | 2 | 2
| bigadd.arg1 | lda 0,x | 4 | 3
| bigadd.arg2 | adc 0,x | 4 | 3
| bigadd.arg3 | sta 0,x | 5 | 3
| | inx | 2 | 1
| | cpx #n | 2 | 2
| | bne bigadd.arg1 | 3/2 | 2
| | rts | 6 | 1
| | | 20n+9 | 18
|
|
Algorithm2 (edited)
the call | cycles | bytes
|
---|
| lda #>s1 | 2 | 2
| | sta strcmp.arg1 + 2 | 4 | 4
| | lda #<s1 | 2 | 2
| | sta strcmp.arg1 + 1 | 4 | 4
| | lda #>s2 | 2 | 2
| | sta strcmp.arg2 + 2 | 4 | 4
| | lda #<s2 | 2 | 2
| | sta strcmp.arg2 + 1 | 4 | 4
| | jsr strcmp | 6 | 3
| | | 30 | 27
|
| |
the subroutine | cycles | bytes
|
---|
strcmp | ldx #0 | 2 | 2
| strcmp.arg1 | lda 0,x | 4 | 3
| strcmp.arg2 | cmp 0,x | 4 | 3
| | bne l2 | 2/3 | 2
| | cmp #0 | 2 | 2
| | beq l2 | 2/3 | 2
| | inx | 2 | 1
| | bne strcmp.arg1 | 3/2 | 2
| | inc strcmp.arg1 + 2 | 5 | 3
| | inc strcmp.arg2 + 2 | 5 | 3
| | bne strcmp.arg1 | 3 | 2
| l2 | rts | 6 | 1
| | | 19n+4 if s1=s2 | 28
| | | 19(n+1) if s1≠s2 but first n chars are matched
|
|
Could anybody provide codes or links to the functionally equivalent codes for z80? I'm ready to calculate cycles and bytes by myself. Thanks in advance.
[**edit**] I've just find code for the strings comparison at http://sources.cosam.org/cgi-bin/viewvc.cgi/z80/string.s?view=markup - it gives for the subroutine 57n+50 cycles and 14 bytes, for the call 37 cycles and 9 bytes. So z80 exactly 3 times slower here but the code for it is about 3 times shorter. So we need at least 256K for C+4's SymbOS but it should be at least 50% faster than at CPC!
|