From 18ed36d09010b80d627dc595374f00a58833ee9e Mon Sep 17 00:00:00 2001 From: Ryan Schmidt Date: Tue, 24 Oct 2023 19:50:02 -0500 Subject: [PATCH] Update get_last_read_value source documentation --- Machines/Apple/AppleII/Video.hpp | 56 ++++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 7 deletions(-) diff --git a/Machines/Apple/AppleII/Video.hpp b/Machines/Apple/AppleII/Video.hpp index c2e947a3a..1af8620ad 100644 --- a/Machines/Apple/AppleII/Video.hpp +++ b/Machines/Apple/AppleII/Video.hpp @@ -129,14 +129,56 @@ template class Video: public VideoBase { */ uint8_t get_last_read_value(Cycles offset) { // Rules of generation: - // (1) a complete sixty-five-cycle scan line consists of sixty-five consecutive bytes of - // display buffer memory that starts twenty-five bytes prior to the actual data to be displayed. - // (2) During VBL the data acts just as if it were starting a whole new frame from the beginning, but - // it never finishes this pseudo-frame. After getting one third of the way through the frame (to - // scan line $3F), it suddenly repeats the previous six scan lines ($3A through $3F) before aborting - // to begin the next true frame. + + // FOR ALL MODELS IN ALL MODES: // - // Source: Have an Apple Split by Bob Bishop; http://rich12345.tripod.com/aiivideo/softalk.html + // - "Screen memory is divided into 128-byte segments. Each segment is divided into the FIRST 40, the + // SECOND 40, the THIRD 40, and eight bytes of no man's memory (UNUSED 8)." (5-8*) + // + // - "The VBL base addresses are equal to the FIRST 40 base addresses minus eight bytes using 128-byte + // wraparound subtraction. Example: $400 minus $8 gives $478; not $3F8." (5-11*) + // + // - "The memory locations scanned during HBL prior to a displayed line are the 24 bytes just below the + // displayed area, using 128-byte wraparound addressing." (5-13*) + // + // - "The first address of HBL is always addressed twice consecutively" (5-11*) + // + // - "Memory scanned by lines 256 through 261 is identical to memory scanned by lines 250 through 255, + // so those six 64-byte sections are scanned twice" (5-13*) + + // FOR II AND II+ ONLY (NOT IIE OR LATER) IN TEXT/LORES MODE ONLY (NOT HIRES): + // + // - "HBL scanned memory begins $18 bytes before display scanned memory plus $1000." (5-11*) + // + // - "Horizontal scanning wraps around at the 128-byte segment boundaries. Example: the address scanned + // before address $400 is $47F during VBL. The address scanned before $400 when VBL is false is + // $147F." (5-11*) + // + // - "the memory scanned during HBL is completely separate from the memory scanned during HBL´." (5-11*) + // + // - "HBL scanned memory is in an area normally taken up by Applesoft programs or Integer BASIC + // variables" (5-37*) + // + // - Figure 5.17 Screen Memory Scanning (5-37*) + + // FOR IIE AND LATER IN ALL MODES AND II AND II+ IN HIRES MODE: + // + // - "HBL scanned memory begins $18 bytes before display scanned memory." (5-10**) + // + // - "Horizontal scanning wraps around at the 128-byte segment boundaries. Example: the address scanned + // before address $400 is $47F." (5-11**) + // + // - "during HBL, the memory locations that are scanned are in the displayed memory area." (5-13*) + // + // - "Programs written for the Apple II may well not perform correctly on the Apple IIe because of + // differences in scanning during HBL. In the Apple II, HBL scanned memory was separate from other + // display memory in TEXT/LORES scanning. In the Apple IIe, HBL scanned memory overlaps other scanned + // memory in TEXT/LORES scanning in similar fashion to HIRES scanning." (5-43**) + // + // - Figure 5.17 Display Memory Scanning (5-41**) + + // Source: * Understanding the Apple II by Jim Sather + // Source: ** Understanding the Apple IIe by Jim Sather // Determine column at offset. int mapped_column = column_ + int(offset.as_integral());