Walking
From Maze
(Difference between revisions)
(moved Mazes, Maze Walking, Generate and Test to Generate and Test: Confusing people by naming two different chapters "Mazes ..." helps no one.) | (Changed confusing proposed title of this chapter - we already have a chapter called Mazes) | ||
| Line 1: | Line 1: | ||
| − | Outline for Mazes, Maze Walking, Generate and Test | + | Outline for Generate and Test |
Section 1: Creating a maze that fills a screen. The original 10-print generates a constantly scrolling sequence of characters. To create a static maze, the program must be modified to just produce enough characters to fill the screen. Introduce FOR NEXT. Discuss the intricacies of PRINT. PRINT automatically scrolls near the end of line, even when using the ; modifier, so it is not possible to perfectly fill the screen with PRINT. Introduce the concept of memory mapped I/O. What PRINT is really doing is placing screen codes in memory. Part of the work it’s doing is converting between PETSCII and screen codes. Screen codes are literally indices into characters stored in memory. Even when the c64 isn’t running a user program, it’s running processes to continuously refresh the screen, looking up characters in character memory, drawing them pixel and pixel on the screen, etc. A computer performs continuous work to maintain the constructed reality. Introduce POKE and PEEK as the BASIC commands for directly manipulating memory. Discuss the program using FOR NEXT and POKE that finally succeeds in generating a static screenfull of maze. | Section 1: Creating a maze that fills a screen. The original 10-print generates a constantly scrolling sequence of characters. To create a static maze, the program must be modified to just produce enough characters to fill the screen. Introduce FOR NEXT. Discuss the intricacies of PRINT. PRINT automatically scrolls near the end of line, even when using the ; modifier, so it is not possible to perfectly fill the screen with PRINT. Introduce the concept of memory mapped I/O. What PRINT is really doing is placing screen codes in memory. Part of the work it’s doing is converting between PETSCII and screen codes. Screen codes are literally indices into characters stored in memory. Even when the c64 isn’t running a user program, it’s running processes to continuously refresh the screen, looking up characters in character memory, drawing them pixel and pixel on the screen, etc. A computer performs continuous work to maintain the constructed reality. Introduce POKE and PEEK as the BASIC commands for directly manipulating memory. Discuss the program using FOR NEXT and POKE that finally succeeds in generating a static screenfull of maze. | ||
