Skip to navigation

Elite on the BBC Micro

Market: TT152 [Elite-A, Docked]

Name: TT152 [Show more] Type: Subroutine Category: Market Summary: Print the unit ("t", "kg" or "g") for a market item
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * TT151 calls TT152 * TT210 calls TT152 * TT219 calls TT152

Print the unit ("t", "kg" or "g") for the market item whose byte #1 from the market prices table is in QQ19+1, right-padded with spaces to a width of two characters (so that's "t ", "kg" or "g ").
.TT152 LDA QQ19+1 \ Fetch the economic_factor from QQ19+1 AND #96 \ If bits 5 and 6 are both clear, jump to TT160 to BEQ TT160 \ print "t" for tonne, followed by a space, and return \ from the subroutine using a tail call CMP #32 \ If bit 5 is set, jump to TT161 to print "kg" for BEQ TT161 \ kilograms, and return from the subroutine using a tail \ call JSR TT16a \ Otherwise call TT16a to print "g" for grams, and fall \ through into TT162 to print a space and return from \ the subroutine