mirror of
https://github.com/dbalsom/x86_microcode.git
synced 2026-06-16 13:07:07 +03:00
Initial 80386 microcode commit.
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
#include "alfe/main.h"
|
||||
|
||||
#ifndef INCLUDED_STRING_FUNCTIONS_H
|
||||
#define INCLUDED_STRING_FUNCTIONS_H
|
||||
|
||||
#include "alfe/function.h"
|
||||
|
||||
class AddStringString : public Nullary<Function, AddStringString>
|
||||
{
|
||||
public:
|
||||
class Body : public Nullary::Body
|
||||
{
|
||||
public:
|
||||
Value evaluate(List<Value> arguments, Span span) const
|
||||
{
|
||||
auto i = arguments.begin();
|
||||
String l = i->value<String>();
|
||||
++i;
|
||||
return Value(l + i->value<String>());
|
||||
}
|
||||
Identifier identifier() const { return OperatorPlus(); }
|
||||
FunctionType type() const
|
||||
{
|
||||
return FunctionType(StringType(), StringType(), StringType());
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
class MultiplyIntegerString : public Nullary<Function, MultiplyIntegerString>
|
||||
{
|
||||
public:
|
||||
class Body : public Nullary::Body
|
||||
{
|
||||
public:
|
||||
Value evaluate(List<Value> arguments, Span span) const
|
||||
{
|
||||
auto i = arguments.begin();
|
||||
int l = i->value<int>();
|
||||
++i;
|
||||
return Value(l*i->value<String>());
|
||||
}
|
||||
Identifier identifier() const { return OperatorStar(); }
|
||||
FunctionType type() const
|
||||
{
|
||||
return FunctionType(StringType(), IntegerType(), StringType());
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
class MultiplyStringInteger : public Nullary<Function, MultiplyStringInteger>
|
||||
{
|
||||
public:
|
||||
class Body : public Nullary::Body
|
||||
{
|
||||
public:
|
||||
Value evaluate(List<Value> arguments, Span span) const
|
||||
{
|
||||
auto i = arguments.begin();
|
||||
String l = i->value<String>();
|
||||
++i;
|
||||
return Value(l*i->value<int>());
|
||||
}
|
||||
Identifier identifier() const { return OperatorStar(); }
|
||||
FunctionType type() const
|
||||
{
|
||||
return FunctionType(StringType(), StringType(), IntegerType());
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
#endif // INCLUDED_STRING_FUNCTIONS_H
|
||||
Reference in New Issue
Block a user