Skip to navigation

Scanner/energy row: GetIconRowAddress

Name: GetIconRowAddress [Show more] Type: Subroutine Category: Scanner/energy row Summary: Calculate the address in screen memory of the icon and scanner row at the top of the screen
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * ResetScreenAddress calls GetIconRowAddress * ScrollPlayerView calls GetIconRowAddress

Returns: A The high byte of the address in iconRowAddr(1 0)
.GetIconRowAddress LDA viewScreenAddr \ Set iconRowAddr(1 0) = viewScreenAddr(1 0) - &0140 SEC \ = viewScreenAddr(1 0) - 320 SBC #&40 \ STA iconRowAddr \ starting with the low bytes LDA viewScreenAddr+1 \ And then the high bytes SBC #&01 CMP #&60 \ If the result of the subtraction is less than &6000, BCS gicn1 \ add &2000 to wrap it around so the result is within ADC #&20 \ screen memory from &6000 and up .gicn1 STA iconRowAddr+1 \ Store the high byte of the result in iconRowAddr(1 0), \ so we have the following: \ \ iconRowAddr(1 0) = viewScreenAddr(1 0) - 320 \ \ Each character row in screen mode 5 takes up 320 bytes \ (40 character blocks of eight bytes each), so this \ sets iconRowAddr(1 0) to the address of the character \ row just above the player's scrolling landscape view, \ which is in screen memory at viewScreenAddr(1 0) RTS \ Return from the subroutine