📄 prog16.asm
字号:
; PROG16 - Creating Variable Arrays
;
; This Application Creates a Variable Array in the Scratchpad RAM and then
; accesses it with reading and writing.
;
; This program will run in the UMPS simulator for a DS80C320.
;
; Myke Predko
; 98.02.17
;
; Hardware Notes:
; This program is only meant to run on the Simulator
; Variable Declarations
; R0 is used as an Index Pointer to Array
; R1 is used as for temporary storage of Values when moving String Values
Array EQU 070h ; Define Array in Scratchpad RAM
; Mainline
org 0 ; Execution Starts Here
mov Array,#'H' ; Initialize the Array to the
mov Array+1,#'E' ; ASCIIZ string "HEllo"
mov Array+2,#'l'
mov Array+3,#'l'
mov Array+4,#'o'
mov Array+5,#0 ; Terminate the String
; Array[ 0 ] = Array[ 0 ] - 'A' + 'a' // Convert 'A' to Lower Case
mov R0,#Array ; Reset R0 to Point to the Start of the Array
mov A,@R0 ; Get the Character
clr C
subb A,#'A' ; Convert to Lower Case
add A,#'a'
mov @R0,A
; Array[ 1 ] = Array[ 1 ] - 'A' + 'a' // Convert 'E' to Lower Case
mov R0,#Array ; Reset R0 to Point to the Start of the Array
mov A,R0 ; Change Index to point to Second Character
add A,#1
mov R0,A
mov A,@R0 ; Convert 'E' to Lower Case
add A,#('a'-'A') ; Calculate the Value Here
mov @R0,A
; Array[ 1 ] = Array[ 5 ] // Convert the String to Just "h"
mov R0,#(Array+5) ; Reset R0 to Point to the Start of the Array
mov A,@R0 ; Get the character pointed to by the Index
mov R1,A ; And Save it for later
mov R0,#Array ; Reset R0 to Point to the Start of the Array
inc R0 ; Jump to Index 1
mov A,R1 ; Move the Contents of Array[ 5 ] to
mov @R0,A ; Array[ 1 ]
Loop: ; Loop Here Forever when Finished
ajmp Loop
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -