|   BCD  |   Programming/Assembly  
 
  BCD (Binary Coded Decimal) is a way to store numeric values and do arithmetic operations with them.
  In BCD mode the numbers are stored in decimal system with every digit stored on 4 bits. In this way one half byte can take the values 0-9 and a full byte can have the value range 0-99.
  Add (ADC) and substract (SBC) operations with BCD mode turned on use the decimal system to calculate the results.
  The difference between the results of the operations in BCD and binary mode are shown in the following table:
 
 | Operation | Result in binary mode | Result in BCD mode |  | $01+$01 | $02 | $02 |  | $05+$05 | $0a | $10 |  | $05-$04 | $01 | $01 |  | $05-$06 | $ff | $99 |  
 
 
 
 
 
 
  BCD, Binary Coded Decimal 
 
  6502 registers, CLD, SED  |  
  |   |   
  
 Copyright © Plus/4 World Team, 2001-2025. Support Plus/4 World on Patreon |