6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 22, 2024 5:53 pm

All times are UTC




Post new topic Reply to topic  [ 163 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8, 9 ... 11  Next
Author Message
PostPosted: Sat Oct 17, 2020 3:28 pm 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1949
Location: Sacramento, CA, USA
Re:
Code:
          ...
          puls   B         ; Get rid of first value
          puls   Y         ; Get return address
          leas   3,S       ; Clean the stack
          jmp    ,Y        ; Return
          ...

Is something like the following okay to try?
Code:
          ...
          ldy    1,S       ; Get return address
          leas   6,S       ; Clean the stack
          jmp    ,Y        ; Return
          ...

_________________
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!

Mike B. (about me) (learning how to github)


Top
 Profile  
Reply with quote  
PostPosted: Sat Oct 17, 2020 3:41 pm 
Offline

Joined: Thu Mar 12, 2020 10:04 pm
Posts: 704
Location: North Tejas
Yes, that works. Thanks.


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 29, 2020 3:11 pm 
Offline

Joined: Thu Mar 12, 2020 10:04 pm
Posts: 704
Location: North Tejas
barrym95838 wrote:
Re:
Code:
          ...
          puls   B         ; Get rid of first value
          puls   Y         ; Get return address
          leas   3,S       ; Clean the stack
          jmp    ,Y        ; Return
          ...

Is something like the following okay to try?
Code:
          ...
          ldy    1,S       ; Get return address
          leas   6,S       ; Clean the stack
          jmp    ,Y        ; Return
          ...


I finally got around to updating these two pieces of code.

Code:
                                  00023 *
                                  00024 * 27,033,175 cycles checking x <= y before calling tarai  Thanks Mike B!
                                  00025 * 27,860,317 cycles checking x <= y before calling tarai
                                  00026 * 47,803,543 cycles after tail recursion elimination
                                  00027 * 49,209,528 cycles after replacing jsr with bsr
                                  00028 * 53,628,345 cycles originally
                                  00029 *


SNIP!


 0151                             00119 Return
 0151 10AE 61                 [7] 00120          ldy    1,S       ; Get return address  Thanks Mike B!
                                  00121
 0154 32 66                   [5] 00122          leas   6,S       ; Clean the stack
                                  00123
 0156 6E A4                   [3] 00124          jmp    ,Y        ; Return
                                  00125
 0158                             00126 Test
 0158 CC 010A                 [3] 00127          ldd    #10+1*256
 015B 34 06                   [7] 00128          pshs   D
 015D 4F                      [2] 00129          clra
 015E 34 02                   [6] 00130          pshs   A
 0160 8D 9E (0100)            [7] 00131          bsr    tarai
                                  00132
 0158                             00133          end    Test




Code:
                                  00023 *
                                  00024 *      5,656 cycles checking x <= y after tarai(x - 1, ...) and (y - 1, ...)
                                  00025 *      5,926 cycles checking x <= y after tarai(x - 1, ...) and (y - 1, ...)
                                  00026 * 27,033,175 cycles checking x <= y before calling tarai  Thanks Mike B!
                                  00027 * 27,860,317 cycles checking x <= y before calling tarai
                                  00028 * 47,803,543 cycles after tail recursion elimination
                                  00029 * 49,209,528 cycles after replacing jsr with bsr
                                  00030 * 53,628,345 cycles originally
                                  00031 *
                                  00032


SNIP!


 014F                             00119 Return
 014F 10AE 61                 [7] 00120          ldy    1,S       ; Get return address  Thanks Mike B!
                                  00121
 0152 32 66                   [5] 00122          leas   6,S       ; Clean the stack
                                  00123
 0154 6E A4                   [3] 00124          jmp    ,Y        ; Return
                                  00125
 0156                             00126 Test
 0156 CC 010A                 [3] 00127          ldd    #10+1*256
 0159 34 06                   [7] 00128          pshs   D
 015B 4F                      [2] 00129          clra
 015C 34 02                   [6] 00130          pshs   A
 015E 8D A0 (0100)            [7] 00131          bsr    tarai
                                  00132
 0156                             00133          end    Test


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 29, 2020 3:26 pm 
Offline

Joined: Thu Mar 12, 2020 10:04 pm
Posts: 704
Location: North Tejas
BillG wrote:
This step revealed an area where Motorola took a huge step backward with the design of the 6809. The 6800 had some instructions for interacting between the two accumulators such as transfer, add, subtract, compare, etc.

These were removed. In its place was the TFR (transfer) instruction and suggestions to use the new addressing modes.

In this particular case, instead of the CBA (compare accumulators) instruction, Motorola suggested doing:

Code:
    pshs    B
    cmpa    ,S+


which is three bytes bigger and a whopping ten cycles slower. Using a temporary variable is a bit faster.


A solution is available with a CPU replacement. Instead of substituting the CBA with something four times bigger and six times slower, a new instruction is only three times the size and takes twice as long:

Code:
    cmpr    B,A


Hitachi is a second source for many Motorola chips. Their "clone" of the 6809, the 6309 came with some major bonuses:

https://en.wikipedia.org/wiki/Hitachi_6309

The memo which broke the story:

http://atjs.mbnet.fi/mc6809/Information/6309.txt

A good document about the 6309:

http://atjs.mbnet.fi/mc6809/Information/6309.techref

And an entire book about it:

https://colorcomputerarchive.com/repo/Documents/Books/The%206309%20Book%20(Burke%20&%20Burke).pdf


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 29, 2020 6:39 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
Thanks for the links! I recognise the 6309 as something specially good.


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 29, 2020 10:16 pm 
Offline

Joined: Thu Mar 12, 2020 10:04 pm
Posts: 704
Location: North Tejas
I remembered that I have a working copy of the Intel PL/M-80 compiler. This is the code it generated:

Code:
                          00003 ;
                          00004 ; FIB: PROCEDURE(N) ADDRESS REENTRANT;
                          00005 ; DECLARE N BYTE;
                          00006 ;
                          00007 ;     IF N < 2
                          00008 ;         THEN
                          00009 ;             RETURN N;
                          00010 ;         ELSE
                          00011 ;             RETURN FIB(N - 1) + FIB(N - 2);
                          00012 ;
                          00013 ; END FIB;
                          00014 ;
                          00015 ;
                          00016 ; 15,672,184 cycles
                          00017 ;
 0100                     00018 FIB:
 0100 41              [5] 00019         mov     B,C             ; Put N in upper byte
 0101 C5             [11] 00020         push    B               ; Push it on the stack
 0102 33              [5] 00021         inx     SP              ; Give back unused lower byte
                          00022
 0103 21 0000        [10] 00023         lxi     H,0             ; Point to N on the stack
 0106 39             [10] 00024         dad     SP
 0107 7E              [7] 00025         mov     A,M             ; Get N
 0108 FE 02           [7] 00026         cpi     2               ; Is it < 2?
 010A D2 0116        [10] 00027         jnc     L_0116          ; No
                          00028
 010D 21 0000        [10] 00029         lxi     H,0             ; Point to N on the stack
 0110 39             [10] 00030         dad     SP
 0111 6E              [7] 00031         mov     L,M             ; Get N
 0112 26 00           [7] 00032         mvi     H,0
                          00033
 0114 33              [5] 00034         inx     SP              ; Get rid of N on the stack
                          00035
 0115 C9             [10] 00036         ret
                          00037
 0116                     00038 L_0116:
 0116 21 0000        [10] 00039         lxi     H,0             ; Point to N on the stack
 0119 39             [10] 00040         dad     SP
 011A 7E              [7] 00041         mov     A,M             ; Get N
 011B 3D              [5] 00042         dcr     A               ; Make that N - 1
 011C 4F              [5] 00043         mov     C,A             ; Pass it in register C
 011D CD 0100        [17] 00044         call    FIB             ; Calculate FIB(N - 1)
                          00045
 0120 E5             [11] 00046         push    H               ; Stash result
                          00047
 0121 21 0002        [10] 00048         lxi     H,2             ; Point to N on the stack
 0124 39             [10] 00049         dad     SP
 0125 7E              [7] 00050         mov     A,M             ; Get N
 0126 3D              [5] 00051         dcr     A               ; Make that N - 2
 0127 3D              [5] 00052         dcr     A
 0128 4F              [5] 00053         mov     C,A             ; Pass it in register C
 0129 CD 0100        [17] 00054         call    FIB             ; Calculate FIB(N - 2)
                          00055
 012C C1             [10] 00056         pop     B               ; Recover FIB(N - 1)
 012D 09             [10] 00057         dad     B               ; Add them
                          00058
 012E 33              [5] 00059         inx     SP              ; Get rid of N on the stack
                          00060
 012F C9             [10] 00061         ret
                          00062
 0130                     00063 Test:
 0130 0E 17           [7] 00064         mvi     C,23            ; Calculate FIB(23)
 0132 CD 0100        [17] 00065         call    FIB
                          00066
 0130                     00067         end     Test



PL/M provides only two types of variables, unsigned 8-bit called BYTE and unsigned 16-bit called ADDRESS. Coding TARAI in PL/M required biasing the numbers by two to keep them positive, otherwise the X <= Y comparison does not work.

It took quite a bit of study to figure out what was going on with this one. It is not very tight code, but it still managed to beat SDCC.

Code:
                          00003 ;
                          00004 ; TARAI: PROCEDURE(X, Y, Z) BYTE REENTRANT;
                          00005 ; DECLARE (X, Y, Z) BYTE;
                          00006 ;
                          00007 ;     IF X <= Y
                          00008 ;         THEN
                          00009 ;             RETURN Y;
                          00010 ;         ELSE
                          00011 ;             RETURN TARAI(TARAI(X - 1, Y, Z),
                          00012 ;                          TARAI(Y - 1, Z, X),
                          00013 ;                          TARAI(Z - 1, X, Y));
                          00014 ;
                          00015 ; END TARAI;
                          00016 ;
                          00017 ;
                          00018 ; 275,171,653 cycles
                          00019 ;
 0100                     00020 TARAI:
                          00021
                          00022 ; SP ---+
                          00023 ;       !
                          00024 ;    +-----+-----+-----+-----+
                          00025 ;    | RAL | RAH |  X  |  ?  |
                          00026 ;    +-----+-----+-----+-----+
                          00027
 0100 21 0000        [10] 00028         lxi     H,0             ; Point to return address on the stack
 0103 39             [10] 00029         dad     SP
                          00030
 0104 53              [5] 00031         mov     D,E             ; Put Z in upper byte
 0105 D5             [11] 00032         push    D               ; Push it on the stack
 0106 33              [5] 00033         inx     SP              ; Give back unused lower byte
                          00034
                          00035 ; SP ---+
                          00036 ;       !
                          00037 ;    +-----+-----+-----+-----+-----+
                          00038 ;    |  Z  | RAL | RAH |  X  |  ?  |
                          00039 ;    +-----+-----+-----+-----+-----+
                          00040
 0107 41              [5] 00041         mov     B,C             ; Put Y in upper byte
 0108 C5             [11] 00042         push    B               ; Push it on the stack
 0109 33              [5] 00043         inx     SP              ; Give back unused lower byte
                          00044
                          00045 ; SP ---+
                          00046 ;       !
                          00047 ;    +-----+-----+-----+-----+-----+-----+
                          00048 ;    |  Y  |  Z  | RAL | RAH |  X  |  ?  |
                          00049 ;    +-----+-----+-----+-----+-----+-----+
                          00050
 010A 5E              [7] 00051         mov     E,M             ; Get low byte of return address
 010B 23              [5] 00052         inx     H
 010C 56              [7] 00053         mov     D,M             ; Get high byte of return address
 010D 23              [5] 00054         inx     H
                          00055
 010E 46              [7] 00056         mov     B,M             ; Get X
                          00057
 010F 73              [7] 00058         mov     M,E             ; Replace X and unused byte with return addr
 0110 23              [5] 00059         inx     H
 0111 72              [7] 00060         mov     M,D
                          00061
 0112 C5             [11] 00062         push    B               ; Push X into the stack
 0113 33              [5] 00063         inx     SP              ; Give back unused lower byte
                          00064
                          00065 ; SP ---+
                          00066 ;       !
                          00067 ;    +-----+-----+-----+-----+-----+-----+-----+
                          00068 ;    |  X  |  Y  |  Z  | RAL | RAH | RAL | RAH |
                          00069 ;    +-----+-----+-----+-----+-----+-----+-----+
                          00070
 0114 21 0001        [10] 00071         lxi     H,1             ; Point to Y on the stack
 0117 39             [10] 00072         dad     SP
                          00073
 0118 7E              [7] 00074         mov     A,M             ; Get Y
                          00075
 0119 21 0000        [10] 00076         lxi     H,0             ; Point to X on the stack
 011C 39             [10] 00077         dad     SP
                          00078
 011D BE              [7] 00079         cmp     M               ; If X <= Y?
 011E DA 012A        [10] 00080         jc      L_012A          ; No
                          00081
 0121 21 0001        [10] 00082         lxi     H,1             ; Point to Y on the stack
 0124 39             [10] 00083         dad     SP
                          00084
 0125 7E              [7] 00085         mov     A,M             ; Get Y
                          00086
 0126 33              [5] 00087         inx     SP              ; Get rid of X
 0127 E1             [10] 00088         pop     H               ; Get rid of Y and Z
 0128 E1             [10] 00089         pop     H               ; Get rid of extra copy of return address
                          00090
 0129 C9             [10] 00091         ret
                          00092
 012A                     00093 L_012A:
                          00094
                          00095 ; SP ---+
                          00096 ;       !
                          00097 ;    +-----+-----+-----+-----+-----+-----+-----+
                          00098 ;    |  X  |  Y  |  Z  | RAL | RAH | RAL | RAH |
                          00099 ;    +-----+-----+-----+-----+-----+-----+-----+
                          00100
 012A 21 0000        [10] 00101         lxi     H,0             ; Point to X on the stack
 012D 39             [10] 00102         dad     SP
                          00103
 012E 7E              [7] 00104         mov     A,M             ; Get X
 012F 3D              [5] 00105         dcr     A               ; Make it X - 1
 0130 4F              [5] 00106         mov     C,A             ; Push it in the lower byte
 0131 C5             [11] 00107         push    B
                          00108
                          00109 ; SP ---+
                          00110 ;       !
                          00111 ;    +-----+-----+-----+-----+-----+-----+-----+-----+-----+
                          00112 ;    | X-1 |  ?  |  X  |  Y  |  Z  | RAL | RAH | RAL | RAH |
                          00113 ;    +-----+-----+-----+-----+-----+-----+-----+-----+-----+
                          00114
 0132 23              [5] 00115         inx     H               ; Point to Y
 0133 4E              [7] 00116         mov     C,M             ; Get Y
 0134 21 0004        [10] 00117         lxi     H,4             ; Point to Z
 0137 39             [10] 00118         dad     SP
 0138 5E              [7] 00119         mov     E,M             ; Get Z
 0139 CD 0100        [17] 00120         call    TARAI           ; Calculate TARAI(X - 1, Y, Z)
                          00121
                          00122 ; SP ---+
                          00123 ;       !
                          00124 ;    +-----+-----+-----+-----+-----+-----+-----+
                          00125 ;    |  X  |  Y  |  Z  | RAL | RAH | RAL | RAH |
                          00126 ;    +-----+-----+-----+-----+-----+-----+-----+
                          00127
 013C 4F              [5] 00128         mov     C,A             ; Push first value in lower byte
 013D C5             [11] 00129         push    B
                          00130
                          00131 ; SP ---+
                          00132 ;       !
                          00133 ;    +-----+-----+-----+-----+-----+-----+-----+-----+-----+
                          00134 ;    | 1st |  ?  |  X  |  Y  |  Z  | RAL | RAH | RAL | RAH |
                          00135 ;    +-----+-----+-----+-----+-----+-----+-----+-----+-----+
                          00136
 013E 21 0003        [10] 00137         lxi     H,3             ; Point to copy of Y on the stack
 0141 39             [10] 00138         dad     SP
 0142 7E              [7] 00139         mov     A,M             ; Get Y
 0143 3D              [5] 00140         dcr     A               ; Make it Y - 1
 0144 4F              [5] 00141         mov     C,A             ; Push it in the lower byte
 0145 C5             [11] 00142         push    B
                          00143
                          00144 ; SP ---+
                          00145 ;       !
                          00146 ;    +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
                          00147 ;    | Y-1 |  ?  | 1st |  ?  |  X  |  Y  |  Z  | RAL | RAH | RAL | RAH |
                          00148 ;    +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
                          00149
 0146 23              [5] 00150         inx     H               ; Point to Z on the stack
 0147 4E              [7] 00151         mov     C,M             ; Get Z
 0148 21 0004        [10] 00152         lxi     H,4             ; Point to X on the stack
 014B 39             [10] 00153         dad     SP
 014C 5E              [7] 00154         mov     E,M
 014D CD 0100        [17] 00155         call    TARAI           ; Calculate TARAI(Y - 1, Z, X)
                          00156
                          00157 ; SP ---+
                          00158 ;       !
                          00159 ;    +-----+-----+-----+-----+-----+-----+-----+-----+-----+
                          00160 ;    | 1st |  ?  |  X  |  Y  |  Z  | RAL | RAH | RAL | RAH |
                          00161 ;    +-----+-----+-----+-----+-----+-----+-----+-----+-----+
                          00162
 0150 F5             [11] 00163         push    PSW             ; Push second value in upper byte
                          00164
                          00165 ; SP ---+
                          00166 ;       !
                          00167 ;    +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
                          00168 ;    | CCR | 2nd | 1st |  ?  |  X  |  Y  |  Z  | RAL | RAH | RAL | RAH |
                          00169 ;    +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
                          00170
 0151 21 0006        [10] 00171         lxi     H,6             ; Point to Z on the stack
 0154 39             [10] 00172         dad     SP
 0155 7E              [7] 00173         mov     A,M             ; Get Z
 0156 3D              [5] 00174         dcr     A               ; Make it Z - 1
 0157 4F              [5] 00175         mov     C,A             ; Push it in the lower byte
 0158 C5             [11] 00176         push    B
                          00177
                          00178 ; SP ---+
                          00179 ;       !
                          00180 ;    +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
                          00181 ;    | Z-1 |  ?  | CCR | 2nd | 1st |  ?  |  X  |  Y  |  Z  | RAL | RAH | RAL | RAH |
                          00182 ;    +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
                          00183
 0159 2B              [5] 00184         dcx     H               ; Point to X on the stack
 015A 2B              [5] 00185         dcx     H
 015B 4E              [7] 00186         mov     C,M             ; Get X
 015C 21 0007        [10] 00187         lxi     H,7             ; Point to Y on the stack
 015F 39             [10] 00188         dad     SP
 0160 5E              [7] 00189         mov     E,M             ; Get Y
 0161 CD 0100        [17] 00190         call    TARAI           ; Calculate TARAI(Z - 1, X, Y)
                          00191
                          00192 ; SP ---+
                          00193 ;       !
                          00194 ;    +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
                          00195 ;    | CCR | 2nd | 1st |  ?  |  X  |  Y  |  Z  | RAL | RAH | RAL | RAH |
                          00196 ;    +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
                          00197
 0164 5F              [5] 00198         mov     E,A             ; Pass as third value
 0165 C1             [10] 00199         pop     B               ; Recover second value
                          00200
                          00201 ; SP ---+
                          00202 ;       !
                          00203 ;    +-----+-----+-----+-----+-----+-----+-----+-----+-----+
                          00204 ;    | 1st |  ?  |  X  |  Y  |  Z  | RAL | RAH | RAL | RAH |
                          00205 ;    +-----+-----+-----+-----+-----+-----+-----+-----+-----+
                          00206
 0166 48              [5] 00207         mov     C,B
 0167 CD 0100        [17] 00208         call    TARAI           ; Calculate final TARAI
                          00209
                          00210 ; SP ---+
                          00211 ;       !
                          00212 ;    +-----+-----+-----+-----+-----+-----+-----+
                          00213 ;    |  X  |  Y  |  Z  | RAL | RAH | RAL | RAH |
                          00214 ;    +-----+-----+-----+-----+-----+-----+-----+
                          00215
 016A 33              [5] 00216         inx     SP              ; Get rid of X
 016B E1             [10] 00217         pop     H               ; Get rid of Y and Z
 016C E1             [10] 00218         pop     H               ; Get rid of extra copy of return address
                          00219
 016D C9             [10] 00220         ret
                          00221
 016E                     00222 Start:
 016E 0E 0C           [7] 00223         mvi     C,12
 0170 C5             [11] 00224         push    B
 0171 1E 02           [7] 00225         mvi     E,2
 0173 0E 03           [7] 00226         mvi     C,3
 0175 CD 0100        [17] 00227         call    TARAI
                          00228
 016E                     00229         end     Start


Top
 Profile  
Reply with quote  
PostPosted: Sat Nov 14, 2020 6:16 am 
Offline

Joined: Sat Jul 09, 2016 6:01 pm
Posts: 180
There is a table https://litwr2.github.io/8080-8085-z80- ... -6502.html which shows the correspondence between the 6502 and Z80.
Another one - https://litwr2.github.io/8080-8085-z80- ... -8088.html - it shows the correspondence between the 8080, Z80, and 8088.

_________________
my blog about processors


Top
 Profile  
Reply with quote  
PostPosted: Sat Nov 14, 2020 10:34 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
Just a bit of orientation for those two pages, litwr: it looks like they are both written from a perspective of how to emulate one microprocessor on another. This is interesting, of course, but it's not a symmetric relationship. As "compare" and "correspondence" are not quite the words which introduce an asymmetric relationship, I'd recommend you add a sub heading or a sentence at the beginning.


Top
 Profile  
Reply with quote  
PostPosted: Sat Nov 14, 2020 3:29 pm 
Offline

Joined: Sat Jul 09, 2016 6:01 pm
Posts: 180
BigEd wrote:
Just a bit of orientation for those two pages, litwr: it looks like they are both written from a perspective of how to emulate one microprocessor on another. This is interesting, of course, but it's not a symmetric relationship. As "compare" and "correspondence" are not quite the words which introduce an asymmetric relationship, I'd recommend you add a sub heading or a sentence at the beginning.

Thank you. But how can I write about this? Maybe "It shows the correspondence between the 6502 and Z80 if we emulate the Z80 on the 6502"?

_________________
my blog about processors


Top
 Profile  
Reply with quote  
PostPosted: Sat Nov 14, 2020 4:24 pm 
Offline

Joined: Thu Mar 12, 2020 10:04 pm
Posts: 704
Location: North Tejas
litwr wrote:
There is a table https://litwr2.github.io/8080-8085-z80- ... -6502.html which shows the correspondence between the 6502 and Z80.


You seem to totally ignore the effects of instructions of the condition code flags.

For example, the Z80 instruction

Code:
    inc     A


Does not affect the carry flag. Your 6502 "equivalent" does.


Top
 Profile  
Reply with quote  
PostPosted: Sat Nov 14, 2020 5:21 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
litwr wrote:
...how can I write about this? Maybe "It shows the correspondence between the 6502 and Z80 if we emulate the Z80 on the 6502"?

Maybe "modelling Z80 instructions on the 6502"?


Top
 Profile  
Reply with quote  
PostPosted: Sun Nov 15, 2020 7:34 am 
Offline

Joined: Sat Jul 09, 2016 6:01 pm
Posts: 180
BillG wrote:
You seem to totally ignore the effects of instructions of the condition code flags.

No, it is not "totally". All this sheet just shows an idea of the Z80 -> 6502 translation, it skips some details sometimes. IMHO it is 98-99% accurate. Indeed for INC A it would generally be better to use sequence TAY INY TYA which is 2 clocks longer (or even just INC A for the CMOS 6502) but it is quite possible that the changed carry doesn't affect the further code execution so we can use CLC ADC quite safely in such cases.
My experience shows that it is quite easy to convert the Z80 code to the 6502 and the 6502 code will usually require about 2.5 times less cycles. But if we do this translation absolutely mechanically (just copying from a table) we get only less than 1.5 times less cycles.
BTW one of the unpleasant problem with the Z80 is in fact that it doesn't set flags after 16-bit ops. Interestingly, the 68k has the inverted problem, it sets all flags after almost every instructions - it is a bit odd because the 680x doesn't have such a problem.

BigEd wrote:
Maybe "modelling Z80 instructions on the 6502"?

Thank you very much. I have just done all fixes. BTW there is also a table - https://litwr2.github.io/8080-8085-z80- ... -8088.html - it is about modelling additional 8085 instructions on the 8088.

_________________
my blog about processors


Top
 Profile  
Reply with quote  
PostPosted: Sat Mar 20, 2021 11:41 am 
Offline

Joined: Sat Jul 09, 2016 6:01 pm
Posts: 180
I have recently discovered information about a rare computer with a fantastic processor. It is the Tomy Tutor. It uses the TMS9995 processor @10Mhz (!). This processor is 16-bit but with 8-bit data bus and it is about three times faster than the TMS9900. So the processor power of this toy computer from 1982 exceeds the processor power of the serious IBM PC AT from 1984! It is odd why Texas Instruments, having so powerful and cheap CPU, didn't make more serious computers based on it. There were only prototypes like the TI99/8...

_________________
my blog about processors


Top
 Profile  
Reply with quote  
PostPosted: Fri Apr 16, 2021 12:02 pm 
Offline

Joined: Sat Jul 09, 2016 6:01 pm
Posts: 180
I have overestimated the TMS9995 in the Tomy Tutor. The TMS9995 instruction timings are based on a frequency which is only 1/4 of the input frequency. So the Tomy Tutor could only match the IBM PC AT @2.5MHz. I added an information about the TMS9900 and TMS9995 to my pi-spigot project. I also added information about the TMS9995 to my blog entry about the TMS9900.
Quote:
The TMS9995 was also used in the late (1987) Geneve 9640 computer, which is compatible with the TI-99/4A and therefore became the most well-known system based on this processor.

The TMS9995 deserves to have a few words said about it. This is a very unusual processor. The external data bus is 8-bit. But there is an internal memory of 256 bytes located at two fixed addresses, which works through the internal 16-bit bus. The TMS9995 already uses only one supply voltage and one clock signal, which made systems based on it simpler and cheaper. There is a built-in timer. Compared to the TMS9900, it has only 4 new instructions that only optimize some operations rather than introduce something fundamentally new. The control system for external masked interrupts became more primitive, only 3 levels remained from 16 levels. However, support for internal interrupts-exceptions appeared: by incorrect instruction, by timer and by overflow – the latter was implemented with an error that may not have been fixed. Only 6 of the 17 vectors for interrupts in the TMS9900 are left in the TMS9995. It is interesting that the TMS9995 actually divides its clock frequency by 4 – all instruction timings are based on a frequency 4 times lower than the input clock. Instructions on the TMS9995 became much faster to execute. However, if we take an external clock frequency as the base, then even with the internal memory, the TMS9995 is slower than the TMS9900 at the same frequency.

The instruction set of both the TMS9900 and TMS9995 is a subset of the instruction set used on the TI-990 series minicomputers. Interestingly, in the first TI-990 manual, the instructions had no mnemonics, only opcodes! In conclusion, we can conclude that the first home 16-bit computers are a side branch of the development of mini-computers.

_________________
my blog about processors


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 26, 2021 5:24 pm 
Offline

Joined: Sat Jul 09, 2016 6:01 pm
Posts: 180
I have gotten an interesting benchmark results for the TMS9995, TMS9900, Intel 8088, and Motorola 6809. BTW it was a surprise for me that the best TI processor, the TMS9995 is actually British. It was designed in England.
Attachment:
782427930_20210424_1918541.thumb.jpg.aa3c4cc38e28b1e11a90dbe323e707eb.jpg
782427930_20210424_1918541.thumb.jpg.aa3c4cc38e28b1e11a90dbe323e707eb.jpg [ 55.22 KiB | Viewed 1021 times ]

_________________
my blog about processors


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 163 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7, 8, 9 ... 11  Next

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 26 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: