Changes

Jump to: navigation, search

6502 Assembly Language String Lab

41 bytes added, 16:02, 3 February 2020
Techniques
== Techniques ==
* To convert a digit into a character, add the value of the ASCII character "0" ($30, 41). For example, $05 + $30 = $35, which is the ASCII code for the digit "5".
* Decimal ([[BCD]]) mode may be useful for some of these problems.
** To get the upper digit from a BCD byte, perform LSR four times to shift the upper four bits to the lower four bit locations and zero the upper four bits.
** To get the lower difit from a BCD byte, AND the byte with $0f.
** Remember to turn decimal mode on for operations on BCD bytes, and turn it off for other operationsso that it does not affect binary math (use the SED and CLD instructions).** Decimal mode does not affect all operations -- for example, it only affects add and subtract operations (ADC) but not increment (INCand SBC).
* To indicate the cursor position, you may want to use reverse video, which is available in the [[6502 Emulator|emulator]] by ORing a printable ASCII code with $80 to turn on the high bit.
* It is recommended that you run the emulator at its highest speed (move the Speed slider to the right).

Navigation menu