.ResetScreenAddress SEI \ Disable interrupts so we can update the 6845 registers LDA #&C0 \ Set viewScreenAddr(1 0) = &60C0 STA viewScreenAddr LDA #&60 STA viewScreenAddr+1 JSR GetIconRowAddress \ Set iconRowAddr(1 0) to the address in screen memory \ of the icon and scanner row at the top of the screen \ We now set the address of screen memory to &7F80 LDA #&0F \ Store &0F on the stack to use as the value of R12 in PHA \ the following LDA #&F0 \ Set 6845 register R13 = &F0, for the low byte LDX #13 \ STX SHEILA+&00 \ We do this by writing the register number (13) to STA SHEILA+&01 \ SHEILA &00, and then the value (&F0) to SHEILA &01 DEX \ Set 6845 register R12 = &0F, for the high byte STX SHEILA+&00 \ PLA \ We do this by writing the register number (12) to STA SHEILA+&01 \ SHEILA &00, and then the value (&0F) to SHEILA &01 \ This sets 6845 registers (R12 R13) = &0FF0 to point \ to the start of screen memory in terms of character \ rows. There are 8 pixel lines in each character row, \ so to get the actual address of the start of screen \ memory, we multiply by 8: \ \ &0FF0 * 8 = &7F80 \ \ So this sets the start of screen memory to &7F80 CLI \ Re-enable interrupts RTS \ Return from the subroutineName: ResetScreenAddress [Show more] Type: Subroutine Category: Graphics Summary: Reset the address of the start of screen memoryContext: See this subroutine in context in the source code References: This subroutine is called as follows: * ClearScreen calls ResetScreenAddress
This routine sets the screen addresses as follows: * Address of the start of screen memory in the 6845 CRTC registers = &7F80 * Address of the icon and scanner row at the top of the screen in iconRowAddr(1 0) = &7F80 * Address of the player's scrolling landscape view in viewScreenAddr(1 0) = &60C0 Note that &7F80 + 320 = &60C0, when the wrapping of screen memory is taken into consideration, so the player's scrolling landscape view in memory is one character line after the icon and scanner row at the top of the screen.
[X]
Subroutine GetIconRowAddress (category: Scanner/energy row)
Calculate the address in screen memory of the icon and scanner row at the top of the screen
[X]
Configuration variable SHEILA = &FE00
Memory-mapped space for accessing internal hardware, such as the video ULA, 6845 CRTC and 6522 VIAs (also known as SHEILA)
[X]
Variable viewScreenAddr in workspace Main variable workspace
The screen address of the player's scrolling landscape view, which is just below the icon and scanner row at the top of the screen