In anticipation of this pending acquisition Altair 8800 mini-clone up for grabs, I have begun writing the run-time library code for the 8080.
This is a bit of 6502 code:
039D AD 378C [4] 00373 lda Zero_List ; Get list of variables to zero
03A0 85 18 [3] 00374 sta Ptr0
03A2 AD 378D [4] 00375 lda Zero_List+1
03A5 85 19 [3] 00376 sta Ptr0+1
00377
03A7 00378 InitRTL1
03A7 05 18 [3] 00379 ora Ptr0
03A9 F0 18 (03C3) [2/3] 00380 beq InitRTL2 ; No more uninitialized variables
00381
03AB A9 00 [2] 00382 lda #0 ; Zero out this variable
03AD A0 02 [2] 00383 ldy #2 ; Point to the variable
03AF 91 18 [6] 00384 sta (Ptr0),Y
03B1 C8 [2] 00385 iny
03B2 91 18 [6] 00386 sta (Ptr0),Y
00387
03B4 A0 00 [2] 00388 ldy #0
03B6 B1 18 [5/6] 00389 lda (Ptr0),Y
03B8 AA [2] 00390 tax
03B9 C8 [2] 00391 iny
03BA B1 18 [5/6] 00392 lda (Ptr0),y
03BC 85 19 [3] 00393 sta Ptr0+1
03BE 86 18 [3] 00394 stx Ptr0
00395
03C0 4C 03A7 [3] 00396 jmp InitRTL1
00397
03C3 00398 InitRTL2
03C3 AD 378E [4] 00399 lda Init_List ; Get list of variables to initialize
03C6 85 18 [3] 00400 sta Ptr0
03C8 AD 378F [4] 00401 lda Init_List+1
03CB 85 19 [3] 00402 sta Ptr0+1
00403
03CD 00404 InitRTL3
03CD 05 18 [3] 00405 ora Ptr0
03CF F0 1E (03EF) [2/3] 00406 beq InitRTL4 ; No more initialized variables
00407
03D1 A0 02 [2] 00408 ldy #2 ; Load variable value
03D3 B1 18 [5/6] 00409 lda (Ptr0),Y
03D5 AA [2] 00410 tax
03D6 C8 [2] 00411 iny
03D7 B1 18 [5/6] 00412 lda (Ptr0),Y
00413
03D9 C8 [2] 00414 iny ; Store variable value
03DA 91 18 [6] 00415 sta (Ptr0),Y
03DC C8 [2] 00416 iny
03DD 8A [2] 00417 txa
03DE 91 18 [6] 00418 sta (Ptr0),Y
00419
03E0 A0 00 [2] 00420 ldy #0
03E2 B1 18 [5/6] 00421 lda (Ptr0),Y
03E4 AA [2] 00422 tax
03E5 C8 [2] 00423 iny
03E6 B1 18 [5/6] 00424 lda (Ptr0),y
03E8 85 19 [3] 00425 sta Ptr0+1
03EA 86 18 [3] 00426 stx Ptr0
00427
03EC 4C 03CD [3] 00428 jmp InitRTL3
00429
03EF 00430 InitRTL4
and the corresponding 8080 code:
0249 2A 02C1 [16] 00295 lhld Zero_List ; Get list of variables to zero
00296
024C 00297 InitRTL1
024C 7C [5] 00298 mov A,H
024D B5 [4] 00299 ora L
024E CA 025E [10] 00300 jz InitRTL2 ; No more uninitialized variables
00301
0251 3E 00 [7] 00302 mvi A,0 ; Zero out this variable
0253 5E [7] 00303 mov E,M ; Get low byte of next address
0254 23 [5] 00304 inx H
0255 56 [7] 00305 mov D,M ; Get high byte of next address
0256 23 [5] 00306 inx H ; Point to the variable
0257 77 [7] 00307 mov M,A
0258 23 [5] 00308 inx H
0259 77 [7] 00309 mov M,A
00310
025A EB [4] 00311 xchg ; Point HL to next
00312
025B C3 024C [10] 00313 jmp InitRTL1
00314
025E 00315 InitRTL2
025E 2A 02C3 [16] 00316 lhld Init_List ; Get list of variables to initialize
00317
0261 00318 InitRTL3
0261 7C [5] 00319 mov A,H
0262 B5 [4] 00320 ora L
0263 CA 0275 [10] 00321 jz InitRTL4 ; No more initialized variables
00322
0266 5E [7] 00323 mov E,M ; Get low byte of next address
0267 23 [5] 00324 inx H
0268 56 [7] 00325 mov D,M ; Get high byte of next address
0269 23 [5] 00326 inx H ; Point to the value
026A 4E [7] 00327 mov C,M ; Get low byte of the value
026B 23 [5] 00328 inx H
026C 46 [7] 00329 mov B,M ; Get high byte of value
026D 23 [5] 00330 inx H ; Point to the variable
026E 71 [7] 00331 mov M,C ; Restore the value
026F 23 [5] 00332 inx H
0270 70 [7] 00333 mov M,B
00334
0271 EB [4] 00335 xchg ; Point HL to next
00336
0272 C3 0261 [10] 00337 jmp InitRTL3
00338
0275 00339 InitRTL4
Note that a 2.5 MHz 8080 is roughly equivalent to a 1 MHz 6502.
Code for the 6800;
020A 4F [2] 00299 clra ; The zero
020B FE 025B [5] 00300 ldx Zero_List ; Get list of variables to zero
00301
020E 27 08 (0218) [4] 00302 beq InitRTL2 ; No uninitialized variables
00303
0210 00304 InitRTL1
0210 A7 02 [6] 00305 staa 2,X ; Zero out this variable
0212 A7 03 [6] 00306 staa 3,X
00307
0214 EE 00 [6] 00308 ldx ,X ; Point to the next variable
00309
0216 26 F8 (0210) [4] 00310 bne InitRTL1
00311
0218 00312 InitRTL2
0218 FE 025D [5] 00313 ldx Init_List ; Get list of variables to initialize
021B 27 0D (022A) [4] 00314 beq InitRTL4 ; No more initialized variables
00315
021D 00316 InitRTL3
021D A6 02 [5] 00317 ldaa 2,X ; Load variable value
021F A7 04 [6] 00318 staa 4,X ; Store variable value
0221 A6 03 [5] 00319 ldaa 3,X
0223 A7 05 [6] 00320 staa 5,X
00321
0225 EE 00 [6] 00322 ldx ,X ; Point to the next variable
0227 26 F4 (021D) [4] 00323 bne InitRTL3
00324
0229 00325 InitRTL4
and the 6809;
0200 CC 0000 [3] 00290 ldd #0 ; The zero
0203 BE 0266 [6] 00291 ldx Zero_List ; Get list of variables to zero
00292
0206 27 06 (020E) [3] 00293 beq InitRTL2 ; No uninitialized variables
00294
0208 00295 InitRTL1
0208 ED 02 [6] 00296 std 2,X ; Zero out this variable
00297
020A AE 84 [5] 00298 ldx ,X ; Point to the next variable
00299
020C 26 FA (0208) [3] 00300 bne InitRTL1
00301
020E 00302 InitRTL2
020E BE 0268 [6] 00303 ldx Init_List ; Get list of variables to initialize
0211 27 21 (0234) [3] 00304 beq InitRTL4 ; No more initialized variables
00305
0213 00306 InitRTL3
0213 EC 02 [6] 00307 ldd 2,X ; Load variable value
0215 ED 04 [6] 00308 std 4,X ; Store variable value
00309
0217 AE 84 [5] 00310 ldx ,X ; Point to the next variable
0219 26 F8 (0213) [3] 00311 bne InitRTL3
00312
021B 00313 InitRTL4