.TT210 LDY #0 ; We're going to loop through all the available market ; items and check whether we have any in the hold (and, ; if we are in the Sell Cargo screen, whether we want ; to sell any items), so we set up a counter in Y to ; denote the current item and start it at 0 .TT211 SETUP_PPU_FOR_ICON_BAR ; If the PPU has started drawing the icon bar, configure ; the PPU to use nametable 0 and pattern table 0 STY QQ29 ; Store the current item number in QQ29 LDX QQ20,Y ; Fetch into X the amount of the current item that we BEQ TT212 ; have in our cargo hold, which is stored in QQ20+Y, ; and if there are no items of this type in the hold, ; jump down to TT212 to skip to the next item TYA ; Set Y = Y * 4, so this will act as an index into the ASL A ; market prices table at QQ23 for this item (as there ASL A ; are four bytes per item in the table) TAY LDA QQ23+1,Y ; Fetch byte #1 from the market prices table for the STA QQ19+1 ; current item and store it in QQ19+1, for use by the ; call to TT152 below TXA ; Store the amount of item in the hold (in X) on the PHA ; stack JSR TT69 ; Call TT69 to set Sentence Case and print a newline CLC ; Print recursive token 48 + QQ29, which will be in the LDA QQ29 ; range 48 ("FOOD") to 64 ("ALIEN ITEMS"), so this ADC #208 ; prints the current item's name JSR TT27_b2 LDA #14 ; Move the text cursor to column 14, for the item's STA XC ; quantity PLA ; Restore the amount of item in the hold into X TAX STA QQ25 ; Store the amount of this item in the hold in QQ25 CLC ; Print the 8-bit number in X to 3 digits, without a JSR pr2 ; decimal point JSR TT152 ; Print the unit ("t", "kg" or "g") for the market item ; whose byte #1 from the market prices table is in ; QQ19+1 (which we set up above) .TT212 LDY QQ29 ; Fetch the item number from QQ29 into Y, and increment INY ; Y to point to the next item CPY #17 ; Loop back to TT211 to print the next item in the hold BCC TT211 ; until Y = 17 (at which point we have done the last ; item) JSR TT69 ; Call TT69 to set Sentence Case and print a newline LDA TRIBBLE ; If there are any Trumbles in the hold, skip the ORA TRIBBLE+1 ; following RTS and continue on (in the Master version, BNE P%+5 ; there are never any Trumbles, so this value will ; always be zero) .zebra JMP UpdateViewWithFade ; There are no Trumbles in the hold, so update the view, ; fading the screen to black first if required, and ; return from the subroutine using a tail call ; If we get here then we have Trumbles in the hold, so ; we print out the number of Trumbles and a random ; adjective CLC ; Clear the C flag, so the call to TT11 below doesn't ; include a decimal point LDA #0 ; Set A = 0, for the call to TT11 below, so we don't pad ; out the number of Trumbles LDX TRIBBLE ; Fetch the number of Trumbles into (Y X) LDY TRIBBLE+1 JSR TT11 ; Call TT11 to print the number of Trumbles in (Y X), ; with no decimal point LDA languageNumber ; If bit 2 of languageNumber is set then the chosen AND #%00000100 ; language is French, so jump to carg1 to skip printing BNE carg1 ; the Trumble adjectives JSR DORND ; Print out a random extended token from 111 to 114, AND #3 ; (" CUDDLY", " CUTE", " FURRY" or " FRIENDLY") CLC ADC #111 JSR DETOK_b2 LDA languageNumber ; If bit 1 of languageNumber is clear then the chosen AND #%00000010 ; language is not German, so jump to carg1 to skip the BEQ carg1 ; following LDA TRIBBLE ; If the number of Trumbles in TRIBBLE(1 0) is more than AND #%11111110 ; one, jump to carg1 to skip the following ORA TRIBBLE+1 BEQ carg1 LDA #'e' ; Print an 'e' to pluralise the adjective in German JSR DASC_b2 .carg1 LDA #198 ; Print extended token 198 (" LITTLE {single JSR DETOK_b2 ; cap}SQUEAKY" LDA TRIBBLE+1 ; If we have more than 256 Trumbles, skip to DOANS BNE DOANS LDX TRIBBLE ; If we have exactly one Trumble, jump up to zebra DEX BEQ zebra .DOANS LDA #'s' ; We have more than one Trumble, so print an 's' and JSR DASC_b2 ; jump up to zebra JMP zebraName: TT210 [Show more] Type: Subroutine Category: Market Summary: Show a list of current cargo in our hold, optionally to sellContext: See this subroutine in context in the source code References: This subroutine is called as follows: * TT213 calls TT210
Show a list of current cargo in our hold, either with the ability to sell (the Sell Cargo screen) or without (the Inventory screen), depending on the current view.
Arguments: QQ11 The current view: * 4 = Sell Cargo * 8 = Inventory
[X]
Subroutine DASC_b2 (category: Text)
Call the DASC routine in ROM bank 2
[X]
Subroutine DETOK_b2 (category: Text)
Call the DETOK routine in ROM bank 2
[X]
Label DOANS is local to this routine
[X]
Subroutine DORND (category: Maths (Arithmetic))
Generate random numbers
[X]
Variable QQ23 (category: Market)
Market prices table
[X]
Macro SETUP_PPU_FOR_ICON_BAR (category: PPU)
If the PPU has started drawing the icon bar, configure the PPU to use nametable 0 and pattern table 0
[X]
Subroutine TT11 (category: Text)
Print a 16-bit number, left-padded to n digits, and optional point
[X]
Subroutine TT152 (category: Market)
Print the unit ("t", "kg" or "g") for a market item
[X]
Label TT211 is local to this routine
[X]
Label TT212 is local to this routine
[X]
Subroutine TT27_b2 (category: Text)
Call the TT27 routine in ROM bank 2
[X]
Subroutine TT69 (category: Text)
Set Sentence Case and print a newline
[X]
Subroutine UpdateViewWithFade (category: Drawing the screen)
Fade the screen to black, if required, hide all sprites and update the view
[X]
Label carg1 is local to this routine
[X]
Variable languageNumber in workspace WP
The language that was chosen on the Start screen as a number
[X]
Subroutine pr2 (category: Text)
Print an 8-bit number, left-padded to 3 digits, and optional point
[X]
Label zebra is local to this routine