📄 main.asm
字号:
;==================================================================================
; The information contained herein is the exclusive property of
; Sunplus Technology Co. And shall not be distributed, reproduced,
; or disclosed in whole in part without prior written permission.
; (C) COPYRIGHT 2004 SUNPLUS TECHNOLOGY CO.
; ALL RIGHTS RESERVED
; The entire notice above must be reproduced on all authorized copies.
;==================================================================================
;==================================================================================
; Project Name :
; Applied Body : SPMC65P2404A
; Firmware version:
; Programer :
; Date : 2004-9-9
; Description : This program presents an example that init block,transfer datas
; from one block to another,compare one block with another.
;
; Hardware Connect:
; Link File :
; IDE Version : V1.6.5
; BODY Version : V1.0.0A
;==================================================================================
.SYNTAX 6502 ;process standard 6502 addressing syntax
.LINKLIST ;generate linklist information
.SYMBOLS ;generate symbolic debug information
;************************************************************************************
;* *
;* System Register Define *
;* *
;************************************************************************************
.INCLUDE SPMC65P2404A.inc ;Define all hardware,Registers and ports.
.INCLUDE LIB_VAR.inc ;Lib resource file
.INCLUDE AN_O0100.inc ;Lib inc file
;************************************************************************************
;************************************************************************************
;************************************************************************************
;* *
;* Data memory Define *
;* *
;************************************************************************************
.PAGE0 ;define values in the range from 00h to FFh
GB_Block1 DS 8 ;Define block1
GB_Block2 DS 8 ;Define block2
;************************************************************************************
.DATA ;define data storage section
;************************************************************************************
;* *
;* Program Area *
;* *
;************************************************************************************
.CODE
;************************************************************************************
;* *
;* Power on Reset Process *
;* *
;************************************************************************************
V_Reset:
sei ;Disable interrupt
ldx #C_STACK_BOTTOM ;Initial stack pointer at $00ff
txs ;Transfer to stack point
?L_Main_Loop: ;the example for test
;========================================================
; init block1 and block2
;========================================================
lda #.low.GB_Block1
sta GB_Address ;the low starting address of block1
lda #.high.GB_Block1
sta GB_Address+1 ;the high starting address of block1
ldx #8
lda #$44
jsr F_Block_Init ;init block1
lda #.low.GB_Block2
sta GB_Address ;the low starting address of block2
lda #.high.GB_Block2
sta GB_Address+1 ;the high starting address of block2
ldx #8
lda #$44
jsr F_Block_Init ;init block2
;========================================================
; compare block1 and block2
;========================================================
lda #.low.GB_Block1
sta GB_SourceAddr ;the low starting address of block1
lda #.high.GB_Block1
sta GB_SourceAddr+1 ;the high starting address of block1
lda #.low.GB_Block2
sta GB_TargetAddr ;the low starting address of block2
lda #.high.GB_Block2
sta GB_TargetAddr+1 ;the high starting address of block2
ldx #8
jsr F_BlockCmp ;are two blocks equal?
beq ?L_BlocksEqu ;yes
;========================================================
; transfer datas from block1 to block2
;========================================================
lda #.low.GB_Block2
sta GB_SourceAddr ;the low starting address of block1
lda #.high.GB_Block2
sta GB_SourceAddr+1 ;the high starting address of block1
lda #.low.GB_Block1
sta GB_TargetAddr ;the low starting address of block2
lda #.high.GB_Block1
sta GB_TargetAddr+1 ;the high starting address of block2
ldx #5
jsr F_Block2Block ;transfer data from block1 to block2
jmp ?L_Main_Loop
?L_BlocksEqu:
nop
jmp ?L_BlocksEqu
;************************************************************************************
;* *
;* Interrupt service process *
;* *
;************************************************************************************
V_IRQ:
rti
V_NMI:
rti
VECTOR: .SECTION
;************************************************************************************
;* *
;* Interrupt Vector Table *
;* *
;************************************************************************************
DW V_NMI ;Non-mask interrupt vector(no use)
DW V_Reset ;Reset vector
DW V_IRQ ;IRQ interrupt vector
;************************************************************************************
;* *
;* End of Interrupt Vector Table *
;* *
;************************************************************************************
.END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -