[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 16-Bit Math on 8-Bit Numbers (HPLOT in Machine Language, Part II)
In article <jonINTERNETrelayCHAT-1303002116420001@nn-157-22-181-90.napanet.net>,
Jon Bettencourt <jonINTERNETrelayCHAT@napaVALLEYnet.CLARInet> wrote:
}OK, remember my question about what variables to set up for Applesoft's
}HPLOT routine in machine language? Forget it! It's solved, and now I'm
}changing my question.
}
}I need a machine language routine that will:
}
}* take a number from 0 to 34 at zero page address $EB, multiply it by 8,
}and put the 16-bit result in $FA/$FB, low byte first
LDA #00
STA $FB
CLC
LDX #2
LDA $EB
loop: ASL $FB
ASL
ADC #0, $FB
DEX
BNE loop
STA $FA
Hopefully I haven't used any illegal addressing modes there.
}* take a number from 0 to 23 at zero page address $EC, multiply it by 8,
}and put the 8-bit result in $FC
LDA $EC
ASL
ASL
ASL
STA $FC
}* take a number from 0 to 511 at zero page addresses $ED/$EE (low byte
}first), multiply it by 8, add 20480 to the product, and put the 16-bit
}result in $FD/$FE, low byte first
The multiply part is the same as above, only pre-load $FE with the
contents of $EE. Then just ADC #$50 to $FE.
--
Matthew T. Russotto russotto@pond.com
"Extremism in defense of liberty is no vice, and moderation in pursuit
of justice is no virtue."