{ "artefact-metadata-hxa7241-www": {
"title": "Reliquary",
"author": "Harrison Ainsworth",
"date": "2005-06-01",
"id": "urn:uuid:CECAA070-4A30-47BB-98DE-4082E3290D7F",
"subtype": "text/html",
"type": "jottings" } }
Reliquary
some ancient obscure Z80 code
Z80 routines
These fragments are the oldest code I still have, transcribed from exercise-book paper. They come from a time long ago. A time when not only commenting was unknown, but even titling the pieces of paper was avoided. Their meaning and function is lost in antiquity ...
fragment 1
Ld HL, (x) 2A:nnnn Call 'Abs HL' CD:nnnn Rl A 17 Ex AF,AF' 08 Ex DE, HL EB Call 'Div, Mult' CD:nnnn Ex AF, AF' 08 Rr A 1F Call c '2s c HL' DC:nnnn Ld (a), HL 22:nnnn Ld HL, (y) 2A:nnnn Call 'Abs HL' CD:nnnn Rl A 17 Ex AF, AF' 08 Ex HL, DE EB Call 'Div, Mult' CD:nnnn Ex AF, AF' 08 Rr A 1F Call c '2s c HL' DC:nnnn Ld (b), HL 22:nnnn Ret C9 (52 bytes)
fragment 2
Ld BC, (x) ED4B:nnnn Call 'Div, Mult' CD:nnnn Ld (a), HL 22:nnnn Ld BC, (y) ED4B:nnnn Call 'Div, Mult' CD:nnnn Ld (b), HL 22:nnnn Ret C9 'Abs HL' Ld A, H 7C Rl A 17 Ret nc D0 '2s c HL' Ccf 3F Ex HL, DE EB Ld HL, 0000 21:0000 Sbc HL, DE ED52 Ret C9
fragment 3
(in: DE = x, y) Xor A AF 1 Ld HL, 0000 21:0000 2.5 Ld BC, (z) ED4B:nnnn 5 Ld IXH, 19h DD26:19h 2.75 -----> And A A7 1 | Sbc HL, BC ED42 3.75 | --- Jr nc 30:01 1.75 3 | | Add HL, BC 09 2.75 | --> Ccf 3F 1 | Rl A 17 1 | Rl E CB13 2 | Rl D CB12 2 | Rl L CB15 2 | Rl H CB14 2 | Dec IXH DD25 2 ------ Jr nz 20:EC 3 1.75 (average: 2.14 microsecs) (total time: 600.5 microsecs) (number of instructions: 280)
fragment 4
Ld B, A 47 Ld HL, d 21:nnnn Ld C, (HL) 4E Ld HL, 0000 21:0000 Ld A, H 7C Ld IXH, 08 DD26:08 -----> And A A7 | Rl A 17 | Rl L CB15 | Rl H CB14 | Rl C CB11 | --- Jr nc 30:03 | | Add A, B 80 | | Adc HL, DE ED5A | --> Dec IXH DD25 ------ Jr nz 20:EF Ld BC, 0000 01:0000 Rl A 17 Adc HL, BC ED4A Ret C9 (out: HL -> a, b) (36 instructions) (67 bytes)
fragment 5
x -> F030 y -> F032 z -> F034 d = F036 a <- F038 b <- F03A call F048 F030 00 00 00 00 00 00 00 00 F038 00 00 00 00 00 00 00 00 F040 00 00 00 00 00 00 00 00 F048 2A 30 F0 CD 71 F0 17 08 F050 EB CD 80 F0 08 1F DC 74 F058 F0 22 38 F0 2A 32 F0 CD F060 71 F0 17 08 EB CD 80 F0 F068 08 1F DC 74 F0 22 3A F0 F070 C9 7C 17 D0 3F EB 21 00 F078 00 ED 52 C9 00 00 00 00 F080 AF 21 00 00 DD 26 19 ED F088 4B 34 F0 A7 ED 42 30 01 F090 09 3F 17 CB 13 CB 12 CB F098 15 CB 14 D0 25 20 EC 47 F0A0 21 36 F0 4E 21 00 00 7C F0A8 DD 26 08 A7 17 CB 15 CB F0B0 14 CB 11 30 03 80 ED 5A F0B8 DD 25 20 EF 01 00 00 17 F0C0 ED 4A C9 00 00 00 00 00
... the Z80 was a great CPU. And there is something in the purity and simplicity of direct machine-code programming that is still appealing.