MOS 6502
는
MOS 테크놀로지
社의 8비트
MPU
이다.
모토로라
의 6809系列의
CPU
로 分類되며 名稱 또한
인텔
系列이 CPU(中央 處理 裝置)라는 單語를 使用한 데 反해, 모토로라 系列은 MPU(Main Processing Unit)라는 用語를 使用한다.
프로세서 레지스터
個數가
인텔
系列의 CPU에 비해 적으나,
제로 페이지
라는
메모리
에리어 中 특수한 領域을 臨時 記憶空間으로 活用하여 프로세서 레지스터 不足分을 메운다.
入出力
을 위한 住所 空間이 別途로 準備되어 있지 않기 때문에 메인 메모리의 一定 部分을 入出力으로 使用하는
메모리 맵 入出力
方式으로 動作한다.
예제 코드
[
編輯
]
; TOLOWER:
;
; Convert a null-terminated character string to all lower case.
; Maximum string length is 255 characters, plus the null term-
; inator.
;
; Parameters:
;
; SRC - Source string address
; DST - Destination string address
;
ORG
$0080
;
0080
00
04
SRC
.WORD
$0400
;source string pointer ($40)
0082
00
05
DST
.WORD
$0500
;destination string pointer ($42)
;
0600
ORG
$0600
;execution start address
;
0600
A0
00
TOLOWER
LDY
#
$00
;starting index
;
0602
B1
80
LOOP
LDA
(
SRC
),
Y
;get from source string
0604
F0
11
BEQ
DONE
;end of string
;
0606
C9
41
CMP
#
'A'
;if lower than UC alphabet...
0608
90
06
BCC
SKIP
;copy unchanged
;
060
A
C9
5
B
CMP
#
'Z'
+
1
;if greater than UC alphabet...
060
C
B0
02
BCS
SKIP
;copy unchanged
;
060
E
09
20
ORA
#
%00100000
;convert to lower case
;
0610
91
82
SKIP
STA
(
DST
),
Y
;store to destination string
0612
C8
INY
;bump index
0613
D0
ED
BNE
LOOP
;next character
;
; NOTE: If .Y wraps the destination string will be left in an undefined
; state. We set carry to indicate this to the calling function.
;
0615
38
SEC
;report string too long error &...
0616
60
RTS
;return to caller
;
0617
91
82
DONE
STA
(
DST
),
Y
;terminate destination string
0618
18
CLC
;report conversion completed &...
0619
60
RTS
;return to caller
;
.END
같이 보기
[
編輯
]
|
---|
基本
| |
---|
아키텍처
| |
---|
系列
| |
---|
인터페이스
| |
---|
시뮬레이터
| |
---|
目錄
| |
---|
關聯 項目
| |
---|