Rodnay Zaks' "Programming the 6502" is a classic, but it's also got a bug! We take a deep look at the Block Transfer Routine on pages 204-208, find the bug, and then demonstrate and (nearly, see notes below) fix it in Turbo Macro Pro on the C64.
Programming the 6502: https://archive.org/details/Programming_the_6502
UPDATE! The source in file BLKCPY8 (shown in the video) has a bug, discovered by RETRO Innovations. BLKCPY9 (included in the .d64 linked below) has the fix suggested by csbruce. Also on the .d64, viewer jjeeeekk came up with a faster-running fix which is file BLKCPY11 on the .d64, and also checkout elandje's version which is BLKCPY10.
Block Transfer .d64: https://8BitShowAndTell.com/prg/tmpzaks.d64
Become a patron: https://patreon.com/8BitShowAndTell
One-time donation: https://paypal.me/8BitShowAndTell
Ending credits is an unreleased song by Bedford Level Experiment, lyrics by Robin's son. Check out other songs here: https://bedfordlevelexperiment.bandcamp.com/
Index:
0:00 Z80, 6502, and Rodnay Zaks
1:07 Programming the 6502 editions
2:40 A Block Transfer Routine p. 204
4:50 Reading time!
7:46 Looking at the printed source code
14:46 The kind of clever bit - which is the bug!
17:07 Indexed indirect?
23:14 FINALLY THE C64!
24:19 Loading Turbo Macro Pro
27:33 Running the program
30:14 Demonstrating the bug
32:15 Some cleanup
34:35 A fix (of a fix)!
38:08 A couple tests
40:30 Thanks to my patrons