Name: Anonymous 2007-10-08 23:29
print"LMC"
print
[start]
i=0
dim prog$(99,2)
dim mem(10)
while lower$(in$)<>"hlt"
print i;
input "]";in$
prog$(i,0)=lower$(left$(in$,3))
prog$(i,1)=right$(in$,3)
i=i+1
wend
i=0
do
op$=prog$(i,0)
opend=val(prog$(i,1))
select case op$
case "set"
ax=opend
case "str"
mem(opend)=ax
case "lod"
ax=mem(opend)
case "add"
ax=ax+mem(opend)
case "neg"
ax=ax*-1
case "hlt"
exit do
case "jmp"
i=ax
case "jnz"
if ax<>0 then i=ax
case "inp"
input"Enter a Number:";in
ax=in
case "out"
print"Output:";ax
case "nop"
i=i
'noop!
case else
exit do
end select
i=i+1
a=a+1
if a>500 then exit do
loop while 1
goto [start]
'This is my operating system so far.
'Please fix it because it wont work.
'Make in JustBasic.
[start]
i=0
dim prog$(99,2)
dim mem(10)
while lower$(in$)<>"hlt"
print i;
input "]";in$
prog$(i,0)=lower$(left$(in$,3))
prog$(i,1)=right$(in$,3)
i=i+1
wend
i=0
do
op$=prog$(i,0)
opend=val(prog$(i,1))
select case op$
case "set"
ax=opend
case "str"
mem(opend)=ax
case "lod"
ax=mem(opend)
case "add"
ax=ax+mem(opend)
case "neg"
ax=ax*-1
case "hlt"
exit do
case "jmp"
i=ax
case "jnz"
if ax<>0 then i=ax
case "inp"
input"Enter a Number:";in
ax=in
case "out"
print"Output:";ax
case "nop"
i=i
'noop!
case else
exit do
end select
i=i+1
a=a+1
if a>500 then exit do
loop while 1
goto [start]
'This is my operating system so far.
'Please fix it because it wont work.
'Make in JustBasic.