Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

malformed for lw #4

Closed
purpl3F0x opened this issue Oct 26, 2019 · 1 comment
Closed

malformed for lw #4

purpl3F0x opened this issue Oct 26, 2019 · 1 comment

Comments

@purpl3F0x
Copy link

purpl3F0x commented Oct 26, 2019

I'm just learning mips, but I'm pretty sure this code should be correct.

.data
	ans: .word	42

.text
main:
	lw 	$a0, ans
	li 	$v0, 1
	syscall 

    li      $a0, 0   
    li      $v0, 10        
    syscall

Instead I get:

lw $a0, ans`:6 malformed for `lw` on

(platform is windows with python 3.7 x86_64)

@nbbeeken
Copy link
Owner

nbbeeken commented Nov 2, 2019

Hi! Thanks for giving my project a try, its still in progress so thank you for your patience with it 😅.

I've only permitted the non psuedo form of load word which would be lw $a0, 0($t0) where $t0 for example could hold an address. So quick fix would be to expand lw $a0, ans to:

la    $t0, ans
lw    $a0, 0($t0)

No need to read further if a solution is all you needed, but my thoughts on why this is is below:

So this still needs working out but psuedo instructions are not real in that they never make it to a mips cpu, they are expanded by the assembler to actual instructions. It was my thinking that I wanted to create something that only understood pure mips and that psuedo instructions would be some additional layer of preprocessing to be added later.
That being said there are a few that I added since it it really annoying to not have an easy way of loading addresses for an example. Still it felt strange to overload lw. Plus there may be a limitation in how I've implemented things but I would have to investigate.

@nbbeeken nbbeeken closed this as completed Nov 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants