I have to agree. 'msg' is definitely not assembler like. I got a nice little assembler engine going then hit 'msg'. The description of how it's supposed to work is lacking from some concrete examples (call them acceptance criteria if you like.) Happily I noticed another message here that illuminated the problem (no, not a spoiler). So it turns out that the assembler needs what I think is called a 'Lexer' which definitely isn't part of what an assembler engine should be doing. Going back to my youth, I/O was handled by specialized chips that you wrote/read to/from. The analogy here is that whilst the assembler engine works, I have to 'off-board' the message instruction to a specialized handler.
If that was the intent of the kata, then perhaps it's grading needs looking at.
To keep it more in keeping of what an assembler would do, perhaps authors need to consider providing the off-board components, e.g.
mov STDOUT a
flush STDOUT
which would shift content of reg a into the offboard stdout, obviously a byte/word at a time, with the flush op sending it to screen.
Failing that, how about adding to the kata sequence with something that is directed at such off-board components.
Assembler was my first language, many, many, many moons ago. If nothing else, the kata has revitalised my interest in it again!
Someone must write a translation and the translation be approved.
There is no 'end' Thus execution is
mov a, 5
inc a
div a, 2
msg '(5+1)/2 =', a
div a, 2
Undefined end: return -1
Why would you have a code point (function) without a return point? Assemblers are dumb. If you don't return, then carry on.
@WinterShiver What do you mean by that? Not sure I understand the statement.
I have to agree. 'msg' is definitely not assembler like. I got a nice little assembler engine going then hit 'msg'. The description of how it's supposed to work is lacking from some concrete examples (call them acceptance criteria if you like.) Happily I noticed another message here that illuminated the problem (no, not a spoiler). So it turns out that the assembler needs what I think is called a 'Lexer' which definitely isn't part of what an assembler engine should be doing. Going back to my youth, I/O was handled by specialized chips that you wrote/read to/from. The analogy here is that whilst the assembler engine works, I have to 'off-board' the message instruction to a specialized handler.
If that was the intent of the kata, then perhaps it's grading needs looking at.
To keep it more in keeping of what an assembler would do, perhaps authors need to consider providing the off-board components, e.g.
mov STDOUT a
flush STDOUT
which would shift content of reg a into the offboard stdout, obviously a byte/word at a time, with the flush op sending it to screen.
Failing that, how about adding to the kata sequence with something that is directed at such off-board components.
Assembler was my first language, many, many, many moons ago. If nothing else, the kata has revitalised my interest in it again!
I've written one in Go, as the first part allowed for Go. But this second part doesn't . :-( How do we get Go supported?