litwr wrote:
BillG wrote:
The 6502 version is not even twice as fast ...
Thank you very much for your neat code. You have proved that for this case the 6800 is not 100% slower but only 77%.
Consider the following hypothetical scenario...
My manager walked into my office the other day while I was napping at my desk.
She gave me a knudge and said, "Hey, wake up! We have a problem!"
"Wha... wha... what?" I replied.
"Listen, we are getting lots of complaints from the field. Our widgets are just too slow to handle the load. If we cannot fix them, the firm will go under."
Me: "How much faster do they need to be? And at what cost?"
If her answer is: "I need all the speed you can give me. At any cost."
Then I will check this brute into source control:
Code:
0000 1000 00001 Base fdb Tab
00002
0100 00003 org $100
00004
0100 00005 Start
0100 4F [2] 00006 clra
0101 C6 04 [2] 00007 ldab #1024/256
00008
0103 00009 Outer
0103 DE 00 [4] 00010 ldx Base
00011
0105 00012 Loop
0105 A8 00 [5] 00013 eora $00,X
0107 A8 01 [5] 00014 eora $01,X
0109 A8 02 [5] 00015 eora $02,X
010B A8 03 [5] 00016 eora $03,X
010D A8 04 [5] 00017 eora $04,X
010F A8 05 [5] 00018 eora $05,X
0111 A8 06 [5] 00019 eora $06,X
0113 A8 07 [5] 00020 eora $07,X
0115 A8 08 [5] 00021 eora $08,X
0117 A8 09 [5] 00022 eora $09,X
0119 A8 0A [5] 00023 eora $0A,X
011B A8 0B [5] 00024 eora $0B,X
011D A8 0C [5] 00025 eora $0C,X
011F A8 0D [5] 00026 eora $0D,X
0121 A8 0E [5] 00027 eora $0E,X
0123 A8 0F [5] 00028 eora $0F,X
0125 A8 10 [5] 00029 eora $10,X
0127 A8 11 [5] 00030 eora $11,X
0129 A8 12 [5] 00031 eora $12,X
012B A8 13 [5] 00032 eora $13,X
012D A8 14 [5] 00033 eora $14,X
012F A8 15 [5] 00034 eora $15,X
0131 A8 16 [5] 00035 eora $16,X
0133 A8 17 [5] 00036 eora $17,X
0135 A8 18 [5] 00037 eora $18,X
0137 A8 19 [5] 00038 eora $19,X
0139 A8 1A [5] 00039 eora $1A,X
013B A8 1B [5] 00040 eora $1B,X
013D A8 1C [5] 00041 eora $1C,X
013F A8 1D [5] 00042 eora $1D,X
0141 A8 1E [5] 00043 eora $1E,X
0143 A8 1F [5] 00044 eora $1F,X
0145 A8 20 [5] 00045 eora $20,X
BIG SNIP!
02C5 A8 E0 [5] 00237 eora $E0,X
02C7 A8 E1 [5] 00238 eora $E1,X
02C9 A8 E2 [5] 00239 eora $E2,X
02CB A8 E3 [5] 00240 eora $E3,X
02CD A8 E4 [5] 00241 eora $E4,X
02CF A8 E5 [5] 00242 eora $E5,X
02D1 A8 E6 [5] 00243 eora $E6,X
02D3 A8 E7 [5] 00244 eora $E7,X
02D5 A8 E8 [5] 00245 eora $E8,X
02D7 A8 E9 [5] 00246 eora $E9,X
02D9 A8 EA [5] 00247 eora $EA,X
02DB A8 EB [5] 00248 eora $EB,X
02DD A8 EC [5] 00249 eora $EC,X
02DF A8 ED [5] 00250 eora $ED,X
02E1 A8 EE [5] 00251 eora $EE,X
02E3 A8 EF [5] 00252 eora $EF,X
02E5 A8 F0 [5] 00253 eora $F0,X
02E7 A8 F1 [5] 00254 eora $F1,X
02E9 A8 F2 [5] 00255 eora $F2,X
02EB A8 F3 [5] 00256 eora $F3,X
02ED A8 F4 [5] 00257 eora $F4,X
02EF A8 F5 [5] 00258 eora $F5,X
02F1 A8 F6 [5] 00259 eora $F6,X
02F3 A8 F7 [5] 00260 eora $F7,X
02F5 A8 F8 [5] 00261 eora $F8,X
02F7 A8 F9 [5] 00262 eora $F9,X
02F9 A8 FA [5] 00263 eora $FA,X
02FB A8 FB [5] 00264 eora $FB,X
02FD A8 FC [5] 00265 eora $FC,X
02FF A8 FD [5] 00266 eora $FD,X
0301 A8 FE [5] 00267 eora $FE,X
0303 A8 FF [5] 00268 eora $FF,X
00269
0305 7C 0000 [6] 00270 inc Base
0308 5A [2] 00271 decb
0309 27 03 (030E) [4] 00272 beq Done
00273
030B 7E 0103 [3] 00274 jmp Outer
00275
030E 00276 Done
00277
1000 00278 org $1000
00279
1000 00280 Tab
5197 cycles
On the other hand, if she replied, "Twice as fast will do it."
Then I check in this beast:
Anything more gets into diminishing returns.
Code:
0000 1000 00001 Base fdb Tab
0002 00002 Count rmb 1
00003
0100 00004 org $100
00005
0100 00006 Start
0100 4F [2] 00007 clra
0101 C6 20 [2] 00008 ldab #1024/32
0103 D7 02 [4] 00009 stab Count
00010
0105 00011 Outer
0105 DE 00 [4] 00012 ldx Base
00013
0107 A8 00 [5] 00014 eora $00,X
0109 A8 01 [5] 00015 eora $01,X
010B A8 02 [5] 00016 eora $02,X
010D A8 03 [5] 00017 eora $03,X
010F A8 04 [5] 00018 eora $04,X
0111 A8 05 [5] 00019 eora $05,X
0113 A8 06 [5] 00020 eora $06,X
0115 A8 07 [5] 00021 eora $07,X
0117 A8 08 [5] 00022 eora $08,X
0119 A8 09 [5] 00023 eora $09,X
011B A8 0A [5] 00024 eora $0A,X
011D A8 0B [5] 00025 eora $0B,X
011F A8 0C [5] 00026 eora $0C,X
0121 A8 0D [5] 00027 eora $0D,X
0123 A8 0E [5] 00028 eora $0E,X
0125 A8 0F [5] 00029 eora $0F,X
0127 A8 10 [5] 00030 eora $10,X
0129 A8 11 [5] 00031 eora $11,X
012B A8 12 [5] 00032 eora $12,X
012D A8 13 [5] 00033 eora $13,X
012F A8 14 [5] 00034 eora $14,X
0131 A8 15 [5] 00035 eora $15,X
0133 A8 16 [5] 00036 eora $16,X
0135 A8 17 [5] 00037 eora $17,X
0137 A8 18 [5] 00038 eora $18,X
0139 A8 19 [5] 00039 eora $19,X
013B A8 1A [5] 00040 eora $1A,X
013D A8 1B [5] 00041 eora $1B,X
013F A8 1C [5] 00042 eora $1C,X
0141 A8 1D [5] 00043 eora $1D,X
0143 A8 1E [5] 00044 eora $1E,X
0145 A8 1F [5] 00045 eora $1F,X
00046
0147 D6 01 [3] 00047 ldab Base+1
0149 CB 20 [2] 00048 addb #32
014B D7 01 [4] 00049 stab Base+1
014D 26 03 (0152) [4] 00050 bne 2f
014F 7C 0000 [6] 00051 inc Base
00052
0152 00053 2
0152 7A 0002 [6] 00054 dec Count
0155 26 AE (0105) [4] 00055 bne Outer
6016 cycles
Can the 6502 even do this if it's life depended on it?
Edit: added some accidentally omitted code.