Skip to content

Commit

Permalink
add example A * B
Browse files Browse the repository at this point in the history
  • Loading branch information
nullxx committed Oct 16, 2023
1 parent 9392527 commit 027eac2
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 15 deletions.
3 changes: 2 additions & 1 deletion front/src/lib/traslator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ function parseAndLex(sourceCode: string, offset: number) {
});
continue;
} else if (currentSection === 'data') {
const [, name, value] = line.split(' ');
const [,, name, value] = /(dw)\s+(\w+)\s+(0[xX][0-9a-fA-F]+|\d+)/.exec(line) || [];

const exists = info.data.find(data => data.name === name);
if (exists) {
info.errors.push({
Expand Down
1 change: 0 additions & 1 deletion front/src/pages/CPUTable/components/FlagsNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export default function FlagsNode({ data, id }: any) {

function onUIUpdate() {
const fz = Boolean(execute<number>("get_register_fz"));
console.log("fz", fz);
let hasChanged = false;
setFz((prevFz) => {
if (prevFz !== fz) {
Expand Down
5 changes: 0 additions & 5 deletions front/src/pages/CPUTable/components/Info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ const Info: React.FC = () => {
placement="right"
onClose={onClose}
open={visible}
styles={{
mask: {
backdropFilter: "blur(2px)",
}
}}
>
<Space direction="vertical">
<Divider style={{margin: 0}}><I18n k="info.about.title" /></Divider>
Expand Down
5 changes: 0 additions & 5 deletions front/src/pages/CPUTable/components/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,6 @@ const Settings: React.FC = () => {
placement="right"
onClose={onClose}
open={visible}
styles={{
mask: {
backdropFilter: "blur(2px)",
}
}}
>
<Input.Group size="large">
<Row gutter={8}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ export default function StateTransition({ data }: { data: any }) {
subTitle: "S" + state.state,
}
})
}>
</Steps>
} />
</Col>
</Row>
<Row>
Expand Down
7 changes: 6 additions & 1 deletion front/src/pages/Coder/constants/examples.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
{
"title": "SUM 5 times 1",
"description": null,
"code": ".ver 1\n\n.data\ndw a 0\ndw cnst_1 1\ndw target 5\n\n.fin lblend\n\n.code\nbegin: add cnst_1, a ; a + 1\ncmp a, target\nbeq lblend\ncmp 0xf, 0xf\nbeq begin\nlblend: mov 0, 0"
"code": ".ver 1\n\n.data\ndw\t\ta 0\ndw\t\tcnst_1 1\ndw\t\ttarget 5\n\n.fin\tlblend\n\n.code\nbegin: add cnst_1, a ; a + 1\n\t\tcmp a, target\n\t\tbeq lblend\n\t\tcmp 0xf, 0xf\n\t\tbeq begin\n\nlblend:"
},
{
"title": "A * B",
"description": "Multiply two numbers",
"code": ".ver 1\n\n.data\ndw\t\ta 5\ndw\t\tb 9\ndw\t\tresultado 0\ndw\t\taux1 0\ndw\t\taux2 0xFFFF\n\n.fin\tlblend\n\n.code\nstart: add a, resultado\n\t\tadd aux2, b\n\t\tcmp b, aux1\n\t\tbeq lblend\n\t\tcmp 11, 11\n\t\tbeq start\n\t\tbeq lblend\n\nlblend:"
}
]

0 comments on commit 027eac2

Please sign in to comment.