x86

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

Can i use binary to write integer constants in assembly?

℡╲_俬逩灬. 提交于 2020-12-25 01:22:48
问题 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

Incomprehensible behavior of the CF flag

我的梦境 提交于 2020-12-23 18:10:42
问题 Let's say there is a piece of code: mov al, 12 mov bl, 4 sub al, bl In this case, the CF = 0 flag, but in my opinion it should be equal to 1, since the subtraction operation is implemented on an addition operation and the processor does not know what we are giving it as input, be it signed or unsigned numbers, it just does its job. That is, the code above is equivalent to the following: Enter the value 12 into the al register, i.e. 0000 1100 Enter the value 4 into the bl register, i.e. 0000

Incomprehensible behavior of the CF flag

我的未来我决定 提交于 2020-12-23 18:09:51
问题 Let's say there is a piece of code: mov al, 12 mov bl, 4 sub al, bl In this case, the CF = 0 flag, but in my opinion it should be equal to 1, since the subtraction operation is implemented on an addition operation and the processor does not know what we are giving it as input, be it signed or unsigned numbers, it just does its job. That is, the code above is equivalent to the following: Enter the value 12 into the al register, i.e. 0000 1100 Enter the value 4 into the bl register, i.e. 0000

Incomprehensible behavior of the CF flag

好久不见. 提交于 2020-12-23 18:01:02
问题 Let's say there is a piece of code: mov al, 12 mov bl, 4 sub al, bl In this case, the CF = 0 flag, but in my opinion it should be equal to 1, since the subtraction operation is implemented on an addition operation and the processor does not know what we are giving it as input, be it signed or unsigned numbers, it just does its job. That is, the code above is equivalent to the following: Enter the value 12 into the al register, i.e. 0000 1100 Enter the value 4 into the bl register, i.e. 0000

Incomprehensible behavior of the CF flag

你说的曾经没有我的故事 提交于 2020-12-23 17:58:51
问题 Let's say there is a piece of code: mov al, 12 mov bl, 4 sub al, bl In this case, the CF = 0 flag, but in my opinion it should be equal to 1, since the subtraction operation is implemented on an addition operation and the processor does not know what we are giving it as input, be it signed or unsigned numbers, it just does its job. That is, the code above is equivalent to the following: Enter the value 12 into the al register, i.e. 0000 1100 Enter the value 4 into the bl register, i.e. 0000

Incomprehensible behavior of the CF flag

北城余情 提交于 2020-12-23 17:58:26
问题 Let's say there is a piece of code: mov al, 12 mov bl, 4 sub al, bl In this case, the CF = 0 flag, but in my opinion it should be equal to 1, since the subtraction operation is implemented on an addition operation and the processor does not know what we are giving it as input, be it signed or unsigned numbers, it just does its job. That is, the code above is equivalent to the following: Enter the value 12 into the al register, i.e. 0000 1100 Enter the value 4 into the bl register, i.e. 0000

Incomprehensible behavior of the CF flag

半腔热情 提交于 2020-12-23 17:53:20
问题 Let's say there is a piece of code: mov al, 12 mov bl, 4 sub al, bl In this case, the CF = 0 flag, but in my opinion it should be equal to 1, since the subtraction operation is implemented on an addition operation and the processor does not know what we are giving it as input, be it signed or unsigned numbers, it just does its job. That is, the code above is equivalent to the following: Enter the value 12 into the al register, i.e. 0000 1100 Enter the value 4 into the bl register, i.e. 0000

Interrupting instruction in the middle of execution

筅森魡賤 提交于 2020-12-23 09:56:14
问题 Suppose that CPU is running an assembly instruction, say, FOO that will be executed in several clocks (e.g. 10) An interrupt request has come just in the middle of executing FOO and processor needs to interrupt. Does it wait until command is properly executed, or is FOO aborted and will be restarted? Does it behave differently considering different types of interrupts' prioritization? 回答1: The CPU has the option of deciding to do either one, i.e. deciding when the interrupt was handled

Interrupting instruction in the middle of execution

北城以北 提交于 2020-12-23 09:52:28
问题 Suppose that CPU is running an assembly instruction, say, FOO that will be executed in several clocks (e.g. 10) An interrupt request has come just in the middle of executing FOO and processor needs to interrupt. Does it wait until command is properly executed, or is FOO aborted and will be restarted? Does it behave differently considering different types of interrupts' prioritization? 回答1: The CPU has the option of deciding to do either one, i.e. deciding when the interrupt was handled