6502 6502 Programming tips and code fragments
 MDFS::Info.Comp.6502.ProgTips Search  
Bit and flag manipulation
BitManip Copying, clearing, setting and rotating bits
SwapVals Swapping data without temporary variable
FlagManip Setting and clearing flags
Arithmetic
Decrement  16-bit, 24-bit, 32-bit, etc. decrement
Counting Unusual counting
Conversion and calculations
BCD  Converting 8-bit Binary Coded Decimal
SqRoot  Calculate integer Square Root
60to100  Multiply by 1.66 to convert 1/60ths to 1/100ths
Times60  Routines to multiply by 60 and 100
Divide60  Routines to divide by multiples of 60 and 100
Denormal Denormalising floating point numbers
6502Divide  Routines to divide by various constants
Stack manipulation
StackWS  Using stack for workspace
StackWS.src  (LDemo of using stack for workspace
StackMem  Subroutines to stack memory
Dates and Time
DayOfWeek 
DofWeek (L)
Calculating day of week for 1900-2155
DayOfWk16a 
DofWeek16a (L)
Calculating day of week for any 16-bit year
DayOfWk16b 
DofWeek16b (L)
DateUpdate Incrementing a date to the next month
Printing
MCode  Printing inline strings
Displaying numbers
PrNumber Printing 8-bit numbers in hex and decimal
PrtDecimal
PrDecDemo (L
Compact arbitary size decimal printout
Compact decimal printout BASIC source and test code
PrDecimal 
PrDecDemo (L
Traditional table-driven 16/24/32-bit decimal number printout
Decimal printout BASIC source and test code
Scanning (reading in) numbers
ScanNumber  Scanning 8-bit hex and decimal numbers
ScanDecNum  Scanning 16/24/32-bit decimal numbers
CRC calculation
CRC-8 Calculating 8-bit CRCs
CRC16  Calculating 16-bit CRCs for XMODEM and Acorn CFS/RFS
CRC32  Calculating 32-bit CRCs for ZIP files
Hardware I/O
ps2kbd1.asm Update of Daryl Rictor's polled PS/2 keyboard driver
Testing  RAM tester
Programs and tools
BBCBasic  BBC BASIC for the 6502
DisAssem  BBC BASIC 6502 disassembler
6502  6502 assembler for ARM BBC BASIC
BeebAsm  BeebAsm 6502 assembler
BBC 6502 programming
BBC/ProgTips  BBC 6502 programming tips
CatchingErrors  Catching errors

Best viewed with Any Browser Valid HTML 4.0! Authored by J.G.Harston
Last update: 12-Mar-2023