assembly

How to print a number in ARM assembly?

天涯浪子 提交于 2020-12-26 06:56:45
问题 I am trying to print a number that I have stored. I'm not sure if I am close or way off. Any help would be appreciated though. Here is my code: .data .balign 4 a: .word 4 .text .global main main: ldr r0, addr_of_a mov r1, #8 str r1, [r0] write: mov r0, #1 ldr r1, addr_of_a mov r2, #4 mov r7, #4 swi #0 bx lr addr_of_a: .word a It compiles and runs, but I don't see anything printed. From what I understand, I need the address of where to start printing in r1, how many bytes in r2, the file

The code after conversion does not execute a given action [duplicate]

让人想犯罪 __ 提交于 2020-12-26 05:14:37
问题 This question already has answers here : How to access C variable for inline assembly manipulation? (2 answers) How to declare and initialize local variables in gcc inline assembly without extended inline asm? (1 answer) How to access C struct/variables from inline asm? (1 answer) manipulating c variable via inline assembly [duplicate] (1 answer) Why can't local variable be used in GNU C basic inline asm statements? (4 answers) Closed 7 days ago . I was given a task to convert a certain code

Bomb Lab phase 5: 6 char string substitution lookup table, strings_not_equal [duplicate]

三世轮回 提交于 2020-12-26 04:39:13
问题 This question already has an answer here : Binary Bomb Phase 5 - lookup table translation -> string compare (1 answer) Closed 20 days ago . Can somebody please explain to me what exactly these functions do? I have a breakpoint set at<+35> as indicated by the arrow, and this is where I get lost. So far, all I've figured out was that this phase takes a string with a length of 6. But I don't exactly know what is going on in the movsbl and movzbl functions. I'm not expecting an answer, but some

MIPS Input floating point number

大憨熊 提交于 2020-12-26 04:34:10
问题 How do you take in an input of a floating number in MIPS? I have tried using: li.s $f0, 6 syscall But I just keep getting that there is an error with the line. 回答1: li $v0, 6 syscall //the float value that is read will be in $f0 register 回答2: you cannot load-immediate a number into float registers li $t0, 6 # load-immediate 6 into an int register mtc1 $t0, $f0 # copies the bit pattern "...110". It is NOT 6.0!! cvt.s.w. $f12, $f0 # convert word to (single) float. $f12 now contains 6.0 回答3: You

MIPS Input floating point number

ぐ巨炮叔叔 提交于 2020-12-26 04:33:25
问题 How do you take in an input of a floating number in MIPS? I have tried using: li.s $f0, 6 syscall But I just keep getting that there is an error with the line. 回答1: li $v0, 6 syscall //the float value that is read will be in $f0 register 回答2: you cannot load-immediate a number into float registers li $t0, 6 # load-immediate 6 into an int register mtc1 $t0, $f0 # copies the bit pattern "...110". It is NOT 6.0!! cvt.s.w. $f12, $f0 # convert word to (single) float. $f12 now contains 6.0 回答3: You

ASM EXE program 16bit: Error changing size of memory

匆匆过客 提交于 2020-12-26 04:27:59
问题 I write EXE program with SMALL model. I want to load other programs with the help of my program. I read that first of all I must free some memory. I use DOS 4Ah INT 21h interrupt. But I have error 7 (control units memory is destroyed) in AX when use it. What I made incorrect? ;-------------------MACRO----------------- println MACRO info push ax push dx mov ah, 09h mov dx, offset info int 21h ;print new line mov dl, 10 mov ah, 02h int 21h mov dl, 13 mov ah, 02h int 21h pop dx pop ax ENDM ;----

ASM EXE program 16bit: Error changing size of memory

给你一囗甜甜゛ 提交于 2020-12-26 04:25:32
问题 I write EXE program with SMALL model. I want to load other programs with the help of my program. I read that first of all I must free some memory. I use DOS 4Ah INT 21h interrupt. But I have error 7 (control units memory is destroyed) in AX when use it. What I made incorrect? ;-------------------MACRO----------------- println MACRO info push ax push dx mov ah, 09h mov dx, offset info int 21h ;print new line mov dl, 10 mov ah, 02h int 21h mov dl, 13 mov ah, 02h int 21h pop dx pop ax ENDM ;----

MIPS Assembly Labels

末鹿安然 提交于 2020-12-25 04:32:47
问题 Does assembly for MIPS read every label? ignore the task and syntax, I just put something together quick. add reg3, reg1, $zero add reg1, reg1, reg2 beq reg1, reg3, BRANCH1 #reg2 contents are zero bne reg1, $zero, BRANCH2 #reg1 doesn't equal zero BRANCH1: add returnReg, reg1, $zero BRANCH2: add returnReg, reg2, $zero jr returnAddress would this read line-by-line, including the labels, unless they were jumped over? For instance, would BRANCH1 be executed every single time, unless the contents

manipulating 32 bit numbers with 16 bit registers in 8086

五迷三道 提交于 2020-12-25 04:00:57
问题 Im trying to write a program which get two 6-digit decimal numbers and show the addition of them, but in 16 bit 8086 i defined numbers as double word and put LO in WORD 1 and HO in word 2. similar to below code but i dont have any idea to do next, can any body suggest me algorithm for next operations? Thnx x dd(?) next_no: mov cl,2 mov ch,4 two_bit: getch sub al,30h mov bl,10 mul bl mov di,ax add word ptr x+2,di dec cl jnz two_bit fourbit: getch sub al,30h mov bl,10 mul bl mov di,ax add word

Can i use binary to write integer constants in assembly?

我怕爱的太早我们不能终老 提交于 2020-12-25 01:23:04
问题 i have an assignment that asks to define 4 integers, each of a different byte length (1, 2, 4, 8) would this code work? segment .data one db 1 two dw 01 four dd 1011 eight dq 01101110 global _start _start: mov rax, [one] ; mov rbx, [two] ; im also curious if i can safely store these values into registers to be used for addition in the future. I'm supposed to use sign extension for the shorter values, but could use some direction 回答1: You're writing constants in decimal. If you want the digits