Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.main;
- public class GenerateBlaBa {
- public static void main(String[] args) {
- //the only two instructions it supports lmao
- gen("bla 0x1234567");
- gen("ba 0xAB1234");
- //same output as above
- gen("bl 0x1234567");
- gen("b 0xAB1234");
- }
- public static void gen(String instruction) {
- String spacesplit[] = instruction.split(" ");
- String l = spacesplit[0].contains("l")?"l":"";
- String firstHalf = spacesplit[1].substring(0, spacesplit[1].length() - 4);
- String secondHalf = "0x"+instruction.substring(instruction.length() - 4);
- System.out.println("__asm(\"lis %r11, "+firstHalf+"\");\r\n" +
- "__asm(\"addi %r11, %r11, "+secondHalf+"\");\r\n" +
- "__asm(\"mtctr %r11\");\r\n" +
- "__asm(\"bctr"+l+"\");");
- System.out.println();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement