Posts: Z80
- Dots tunnel: a 256 × 256 screen and 400 dots
What if the CPC screen changed shape so that the address of a dot were quicker to compute? The dots tunnel moves to a square screen, then spends the time saved on more dots.
- Dots tunnel: the stack, the registers and unrolling
Where do the NOPs of a dots tunnel dot go, instruction by instruction, and how many can the Z80 stack, its registers and unrolling remove without changing a single picture?
- Dots tunnel: two screens, and clearing only the dots
The v1 of the dots tunnel clears 16 KB per picture for 256 lit bytes at most, and its picture flickers. Two versions in Z80 fix the flicker, then the clearing, and we measure what each one brings.
- Dots tunnel: from the tables to a first Z80 tunnel
How the CPC stores its pixels in memory, the dots tunnel tables computed in Locomotive BASIC then by RASM, byte for byte, and a first, slow version of the tunnel in Z80, whose time we measure picture by picture.
- Dots tunnel: the principle, explained in JavaScript
Building a dots tunnel one idea at a time, in JavaScript, on a simulated CPC screen: from the projection of a circle to the byte tables the Z80 expects.
- TDD on the CPC: sorting pointers to strings
An insertion sort in Z80 on the Amstrad CPC, one test at a time, with z80-tdd: the pointers move, the strings stay where they are, strcmp compares, stability shows at last, and the budget depends on n and on the prefixes.
- TDD on the CPC: strcmp, comparing two strings that end on bit 7
A string comparison in Z80 on the Amstrad CPC, one test at a time, with z80-tdd: strings in the firmware format, an answer in the flags like CP, the bit 7 trap, then a budget for each path.
- TDD on the CPC: radix sort, two counting passes for 16-bit keys
Radix sort in Z80 on the Amstrad CPC, one test at a time, with z80-tdd: a stable counting sort that moves the keys, two passes made into one routine by a byte swap, then its budget in NOPs.
- TDD on the CPC: counting sort, 256 counts and not one comparison
Counting sort in Z80 on the Amstrad CPC, one test at a time, with z80-tdd: a table of 256 counts, a scan that started in the wrong place, a table left clean, then the four sorts head to head.
- TDD on the CPC: bubble sort, the flag or Knuth's bound
Bubble sort in Z80 on the Amstrad CPC, one test at a time, with z80-tdd: a budget test decides between the classic flag and Knuth's bound, then a match of the three sorts.
- TDD on the CPC: insertion sort, four versions to the NOP
Insertion sort in Z80 on the Amstrad CPC, one test at a time, with z80-tdd: four ways to shift the bytes, measured to the NOP, then a match against selection sort.
- TDD on the CPC: selection sort, and what it costs
Sorting an array in Z80 on the Amstrad CPC, one test at a time, with z80-tdd: from O(n²) complexity to an exact formula in NOPs.
- TDD on the CPC: finding the smallest byte of an array
Writing the tests of a Z80 routine before the routine, on the Amstrad CPC: set the registers and the memory, call the routine, check the result, up to a NOP budget.