base:detect_cpu_type
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | base:detect_cpu_type [2015-04-17 04:31] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | < | ||
+ | ; --------------------------------------------------------------------------- | ||
+ | ; Subroutine to detect an 816. Returns | ||
+ | ; | ||
+ | ; - carry clear and 0 in A for a NMOS 6502 CPU | ||
+ | ; - carry set and 1 in A for CMOS 6502 CPUs | ||
+ | ; - carry set and 2 in A for a 65816 | ||
+ | ; | ||
+ | ; This function uses a $1A opcode which is a INA on the 816 and C02, and | ||
+ | ; ignored (interpreted as a NOP) on a NMOS 6502. Detection of the 65816 is | ||
+ | ; done by the xba instruction which is a NOP on the 65C02s. | ||
+ | |||
+ | GetCPU: | ||
+ | inc a | ||
+ | cmp #1 | ||
+ | | ||
+ | |||
+ | ; This is at least a 65C02, check for a 65816 | ||
+ | |||
+ | xba | ||
+ | dec a | ||
+ | | ||
+ | | ||
+ | @L9: rts | ||
+ | </ | ||
+ | |||
+ | Ullrich von Bassewitz | ||
base/detect_cpu_type.txt · Last modified: 2015-04-17 04:31 by 127.0.0.1