ARM9 / bass

fork of byuu's bass assembler
169 stars 50 forks source link

Verbatim injection - Feature Request #14

Closed theboy181 closed 3 years ago

theboy181 commented 6 years ago

I would like the ability to inject RAW ASM into a ROM using BASS.

Issues I have come across in the past are limits on the amount of RAW HEX you can inject into an origin, and branch offsets (example B 0x8015BB76) getting confused by the ROM.

Could you please add the ability to strait up inject RAW ASM, and HEX starting from a sing origin in a ROM?

I hop this is possible.

ARM9 commented 6 years ago

I don't quite understand what you're asking for here, an instruction like the mips branch you're referring to uses a relative operand. Can you use the jump opcode instead? j 0x8015bb74 (note that mips addresses must be a multiple of 4)

theboy181 commented 6 years ago

Yes I can and do use jump commands. It’s the bne, beq that cause me pain. If I set the origin 0x100 then use bne 0x80003456 I will get an error when I run bass assembler.

If I understand bass thinks that I want to do an offset from 0x100.

If I could set the origin for ROM and have the ability to set the RAM location that would be helpful.

Let’s say

Origin $0x100:0x8000100

Then the bnz would know that it’s writing in the ROM, but also know that the offset base is in the ram.

A command swich could be used with origin, and instead that would just write your code and not check that the branch is correct. Just a verbatim write to ROM.

theboy181 commented 6 years ago
nop
nop
j       0x807283b4
nop          
lui             s6,0x8007
lw      s6,0xb5f4(s6)           //sets lap value
slti            at,s6,0x0004            // if lap value = 4 branch
dw      $1420ff85       //bnez  at,0x807281c0
nop          
j       0x80728390
nop          
addiu           t8,r0,0x0001
origin          $00cad4cc       //80728414
dw              $5020ffe1       //beqzl at,0x8072839c
origin          $00cad584       //807284CC vs. mode LOD
nop          

This is the example where I have used dw to inject the result I want.

ARM9 commented 6 years ago

What you need is the base directive, in addition to origin. For example base 0x8072'8414. It sets which address the assembler tells the instructions they'll execute at.

theboy181 commented 6 years ago

Can you lay that out in the example above while using the ASM I commented out?

thar0x29a commented 3 years ago

We will write an smal set of tutorials soon. I'll keep on mind handling base and origin and others.