assembly

MIPS Basic For Loop

笑着哭i 提交于 2020-05-17 07:04:07
问题 im trying to implement this java code into MIPS assembly language and i am quite confused. this is what i have so far: java code: for (int c = 1; c <= rows; c++) { number = highestValue; // reset number to the highest value from previous line for (i = 0; i < c; i++) { System.out.print(++number + " "); } highestValue = number; // setting the highest value in line assembly code: .text # tells the program where the code begins move $t0, $zero # t0=0 move $t1, $zero # this will be similar to "int

What is the best way to translate Z3's AST into ASM code? [closed]

怎甘沉沦 提交于 2020-05-17 06:05:21
问题 Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 days ago . There is an example: mov edi, dword ptr [0x7fc70000] add edi, 0x11 sub edi, 0x33F0B753 After Z3 simplification I have got (memory 0x7FC70000 is symbolized): bvadd (_ bv3423553726 32) MEM_0x7FC70000 Now I need to convert Z3 into ASM to get result like this: mov edi, 0xCC0F48BE add edi,

Don't understand what's wrong with my PCX code

风流意气都作罢 提交于 2020-05-16 06:33:18
问题 I have a code that shows a PCX using assembly By its width Example image 320x200 x=0, y=0 But if X ( StartPictX ) and Y ( StartPictY ) are unequal to 0, it ruins the picture. And I need to fix that... The original code: ;-------------------------------------- ; Load and show file *.PCX 320x200x256 ; ;-------------------------------------- IDEAL MODEL large P386 MACRO SHOWPCX StartX, StartY, fName mov ax, [StartX] mov [Point_X], ax mov ax, [StartY] mov [Point_Y], ax mov dx, offset fName call

andi vs. addi instruction in MIPS with negative immediate constant

荒凉一梦 提交于 2020-05-16 06:05:28
问题 Assume $t2= 0x55555550 , then executing the following instruction: andi $t2, $t2, -1 $t2 becomes 0x0005550 This is confirmed by the MIPS emulator 1 However, it is not what I expected. I think the answer should be 0x55555550 & 0xFFFFFFFF = 0x55555550. I think the constant -1 was sign extended to 0xFFFFFFFF before the and logic. But it appears that the answer was 0x55555550 & 0x0000FFFF Why -1 is sign extended to 0x0000FFFF instead of 0xFFFFFFFF Footnote 1: Editor's note: MARS with "extended

What is the function of parentheses in MIPS?

旧城冷巷雨未停 提交于 2020-05-16 04:35:32
问题 I've been working through a project book as an introduction to MIPS and I've come across a problem. One of the lines of code in the book is lb $t3, ($t2) . I have no clue what the parentheses do because prior to this, I haven't seen them used, and the book just doesn't mention them to begin with. Why wouldn't the code just be lb $t3, $t2 ? 回答1: MIPS addressing-mode syntax is constant($reg) . ($t2) is allowed as a special case short-hand for 0($t2) . The same instruction could do lb $t3, 13(

Include assembly file in another assembly file

可紊 提交于 2020-05-16 01:11:05
问题 I have two files, main.s and test.s where test.s looks like this: test: add a1,a2,a2 ...and main.s looks like this: main: call test (very senseless examples). How can I include test in main? I am using gcc like this: gcc -o main main.c But I have no idea how I can use test in there...any help? 回答1: You can include the file just as you would with anything else in GCC: #include"test.S" Were you using NASM you would use: %include "test.s" 来源: https://stackoverflow.com/questions/39457263/include

Include assembly file in another assembly file

╄→гoц情女王★ 提交于 2020-05-16 01:09:54
问题 I have two files, main.s and test.s where test.s looks like this: test: add a1,a2,a2 ...and main.s looks like this: main: call test (very senseless examples). How can I include test in main? I am using gcc like this: gcc -o main main.c But I have no idea how I can use test in there...any help? 回答1: You can include the file just as you would with anything else in GCC: #include"test.S" Were you using NASM you would use: %include "test.s" 来源: https://stackoverflow.com/questions/39457263/include

Include assembly file in another assembly file

蹲街弑〆低调 提交于 2020-05-16 01:09:50
问题 I have two files, main.s and test.s where test.s looks like this: test: add a1,a2,a2 ...and main.s looks like this: main: call test (very senseless examples). How can I include test in main? I am using gcc like this: gcc -o main main.c But I have no idea how I can use test in there...any help? 回答1: You can include the file just as you would with anything else in GCC: #include"test.S" Were you using NASM you would use: %include "test.s" 来源: https://stackoverflow.com/questions/39457263/include

Include assembly file in another assembly file

本小妞迷上赌 提交于 2020-05-16 01:09:03
问题 I have two files, main.s and test.s where test.s looks like this: test: add a1,a2,a2 ...and main.s looks like this: main: call test (very senseless examples). How can I include test in main? I am using gcc like this: gcc -o main main.c But I have no idea how I can use test in there...any help? 回答1: You can include the file just as you would with anything else in GCC: #include"test.S" Were you using NASM you would use: %include "test.s" 来源: https://stackoverflow.com/questions/39457263/include

what is Interruptible-restartable instructions in ARM cortex m0/m0+

怎甘沉沦 提交于 2020-05-15 10:25:48
问题 I am currently reading ARM Cortex M0+ User Guide on ARM website shown below http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0662b/CHDBIBGJ.html In User Manual, following paragraph is mentioned: Interruptible-restartable instructions The interruptible-restartable instructions are LDM, STM, PUSH, POP and, in 32-cycle multiplier implementations, MULS. When an interrupt occurs during the execution of one of these instructions, the processor abandons execution of the instruction.