📄 xram.bas
字号:
'--------------------------------------------------------
' Copyright 1998-2000 MCS Electronics
' demonstration of XRAM support
'THIS ONLY WORKS FOR microcontrollers which can address
'external RAM memory such as the 8031,8032 etc
'--------------------------------------------------------
$romstart = &H8000 'ROM enable address located at 0
$ramstart = &H8000 'RAM enable address located at 0
$ramsize = &H1000 '4KB RAM chip
'$large 'use this option when error 148 occurs
Dim Bx As Xram Byte , B1 As Xram Byte , A As Xram Byte'specify XRAM so it will be located in external RAM space
'when using $ramstart , you don't have to specify XRAM
'XRAM is used automatic
'when you need an internal variable, you must specify IRAM
'Dim z as IRAM byte
Dim Cx As Integer
Dim Wx As Word
Dim S As String * 10
Dim Zz As Iram Byte
Declare Sub Test(a As Xram Byte , B1 As Xram Byte)'declare the subs
'The external variables can be used as "normal" variables
S = "123"
Bx = 5 + Val(s) : Print Bx
'It is ok to use a function for one of the parameters but it has
'to be the first parameter. So 5 + val() will work and val() + 5 will NOT work.
Bx = 50 : Cx = 1000
Wx = Bx * Cx
Print Wx
Call Test(1 , B1) 'call sub with parameters
Print B1
Test 1 , B1 'call without CALL statement
Print B1
End
'end your code with the subprograms
'note that the same variables must be used as the declared ones
'also note that variables are global
Sub Test(a As Xram Byte , B1 As Xram Byte)'start sub
Print A ; " " ; B1 'print passed variables
B1 = 3
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -