You can find the assembly code of Atari Mule here:
http://bringerp.free.fr/RE/Mule/downloads.php5Look at the subroutine starting at address 339A (bolding and italic comment by me):
339A ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
339A
339A
339A buildAndCalcPriceMule: ; ...
339A LDA goodsStoreNb+2
339D LSR A ; // construction des mules
339D ; int nbMulesBuildable = goodsStoreNb [Smithore] / 2 that is, upper limit is the amount of smithore (taking into account the store limit 3 rows below)339E BEQ calcMulePrice ; if (nbMulesBuildable != 0) {
33A0 STA byte_80
33A2 LDA #14 ; // le store contient 14 mules au max33A4 SEC
33A5 SBC goodsStoreNb+4 ; int nbMulesMissingInStore = 14 - goodsStoreNb [Mule]
33A8 BEQ calcMulePrice ; if (nbMulesMissingInStore != 0) {
33A8 ;
33AA CMP byte_80 ; int nbMulesToBuild = nbMulesMissingInStore
33AC BCC loc_33B0 ; if (nbMulesToBuild >= nbMulesBuildable ) {
33AE LDA byte_80 ; nbMulesToBuild = nbMulesBuildable
33AE ; }
33B0
33B0 loc_33B0: ; ...
33B0 ASL A ; // A contient le nb de mules qui peuvent
33B0 ; // etre construites par rapport au smithore dispo
33B0 ; // 1 MULE prend 2 SMITHORE
33B1 STA byte_88 ; nbSmithoresForBuild = nbMulesToBuild * 2
33B3 LDA goodsStoreNb+2
33B6 SEC
33B7 SBC byte_88
33B9 STA goodsStoreNb+2 ; goodsStoreNb [Smithore] -= nbSmithoresForBuild
33BC LSR byte_88
33BE LDA goodsStoreNb+4
33C1 CLC
33C2 ADC byte_88
33C4 STA goodsStoreNb+4 ; goodsStoreNb [Mule] += nbMulesToBuild
33C4 ; }
33C4 ; }
33C7
33C7 calcMulePrice: ; ...
33C7 LDA goodsPrice+4 ; // calcul du nouveau prix des mules
33CA LDY goodsPrice+5 ; Y/A = GOODS_PRICE [SMITHORE]
33CD LDX #5
33CF JSR div16Bits ; Y/A /= 5
33D2 LDX #10
33D4 JSR mul16BitsBy8Bits ; Y/A *= 10
33D4 ; // Y/A = GOODS_PRICE [SMITHORE] * 2
33D7 STA mulePriceL
33DA STY mulePriceH ; mulePrice = (goodsPrice [Smithore] - goodsPrice [Smithore] % 5) * 2
33DD RTS
33DD ; End of function buildAndCalcPriceMule