Skip to navigation


Market: TT167

[NES version, Bank 0]

Name: TT167 [Show more] Type: Subroutine Category: Market Summary: Show the Market Price screen
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * RedrawCurrentView calls TT167 * TT102 calls TT167
JMP TT213 ; Jump to TT213 to show the Inventory screen instead of ; the Market Price screen .TT167 LDA #$BA ; If we are already showing the Market Price screen CMP QQ11 ; (i.e. QQ11 is $BA), then jump to TT213 to show the BEQ TT167-3 ; Inventory screen, so the icon bar button toggles ; between the two JSR SetNewViewType ; We are not already showing the Market Price screen, ; so that's what we do now, by clearing the screen and ; setting the view type in QQ11 to $BA (Market Price) LDA #5 ; Move the text cursor to column 5 STA XC LDA #167 ; Print recursive token 7 ("{current system name} MARKET JSR NLIN3 ; PRICES") on the top row LDA #2 ; Move the text cursor to row 2 STA YC JSR TT163 ; Print the column headers for the prices table LDX languageIndex ; Move the text cursor to the correct row for the Market LDA yMarketPrice,X ; Prices title in the chosen language STA YC LDA #0 ; We're going to loop through all the available market STA QQ29 ; items, so we set up a counter in QQ29 to denote the ; current item and start it at 0 .TT168 JSR SetupPPUForIconBar ; If the PPU has started drawing the icon bar, configure ; the PPU to use nametable 0 and pattern table 0 JSR TT151 ; Call TT151 to print the item name, market price and ; availability of the current item, and set QQ24 to the ; item's price / 4, QQ25 to the quantity available and ; QQ19+1 to byte #1 from the market prices table for ; this item INC YC ; Move the text cursor down one row INC QQ29 ; Increment QQ29 to point to the next item LDA QQ29 ; If QQ29 >= 17 then jump to TT168 as we have done the CMP #17 ; last item BCC TT168 ; Fall through into BuyAndSellCargo to process the ; buying and selling of cargo on the Market Price ; screen