URL
https://opencores.org/ocsvn/tinycpu/tinycpu/trunk
Show entire file |
Details |
Blame |
View Log
Rev 40 |
Rev 41 |
Line 193... |
Line 193... |
mov_mreg_reg arg1[0], arg2
|
mov_mreg_reg arg1[0], arg2
|
elsif arg1.kind_of? Register8 and arg2.kind_of? Array then
|
elsif arg1.kind_of? Register8 and arg2.kind_of? Array then
|
if arg2.length>1 or arg2.length<1 or not arg2[0].kind_of? Register8 then
|
if arg2.length>1 or arg2.length<1 or not arg2[0].kind_of? Register8 then
|
raise "memory reference is not correct. Only a register is allowed";
|
raise "memory reference is not correct. Only a register is allowed";
|
end
|
end
|
mov_mreg_reg arg1,arg2[0]
|
mov_reg_mreg arg1,arg2[0]
|
elsif arg1.kind_of? Register8 and arg2.kind_of? Register8 then
|
elsif arg1.kind_of? Register8 and arg2.kind_of? Register8 then
|
mov_reg_reg arg1, arg2
|
mov_reg_reg arg1, arg2
|
else
|
else
|
raise "No suitable mov opcode found";
|
raise "No suitable mov opcode found";
|
end
|
end
|
Line 312... |
Line 312... |
@name=name;
|
@name=name;
|
@pos=pos;
|
@pos=pos;
|
end
|
end
|
end
|
end
|
$labellist={}
|
$labellist={}
|
def label(name)
|
def new_label(name)
|
$labellist[name.to_s]=$position;
|
$labellist[name.to_s]=$position;
|
end
|
end
|
def lbl(name)
|
def lbl(name)
|
$labellist[name.to_s]=$position;
|
$labellist[name.to_s];
|
end
|
end
|
|
|
|
|
def if_tr_set
|
def if_tr_set
|
$iftr = 1
|
$iftr = 1
|
Line 343... |
Line 343... |
|
|
|
|
#port0(0) is LED port0(1) is a button
|
#port0(0) is LED port0(1) is a button
|
|
|
mov r4, 1
|
mov r4, 1
|
mov r5, 0x01 #the port bitmask
|
mov r5, 0xFD
|
|
#mov r5, 0x01 #the port bitmask
|
mov [r4],r5
|
mov [r4],r5
|
mov r3, 0
|
mov r3, 0
|
|
mov [r3], 0
|
mov r2, 0x02
|
mov r2, 0x02
|
#poll for button
|
#poll for button
|
label :loop
|
new_label :loop
|
mov r0, [r3]
|
mov r0, [r3]
|
and_ r0, r2 #isolate just the button at pin 2
|
and_ r0, r2 #isolate just the button at pin 2
|
cmpneq r0, 0
|
cmpneq r0, 0
|
if_tr_set{
|
if_tr_set{
|
mov [r3], 0x01
|
mov [r3], 0x01
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.