assembly

Different behavior calling JMP with register vs value

你。 提交于 2020-06-01 05:54:29
问题 I'm trying to perform an absolute jump to the address 0x7C00 as part of a procedure in a hobby OS. I'm using intel syntax in GAS and testing in QEMU. I tried two methods: jmp 0x00007c00 and mov eax, 0x00007C00 jmp eax The second method seems to work as I intended and jumps to 0x7C00, but the first method causes QEMU to crash stating that it's "trying to execute code outside RAM or ROM at 0x40007c00". Does anyone know why it's jumping to a different address and the upper bytes are being set to

Decimal to Binary Conversion ASM 3 digits

筅森魡賤 提交于 2020-06-01 05:22:30
问题 I was given a task to convert decimal input numbers and output its binary equivalent via an "array" using assembly. I've the code complete and working, trouble is it only accepts numbers 0-99 for conversion. Ideally, the program should be able to convert any number at least up to 255 decimal so that the code can be reusable for future practices where I might need to handle different 16 bit values within registers. I appreciate all advice given, the code is as follows: .model small .stack

x86 opcode encoding: sib byte

ε祈祈猫儿з 提交于 2020-05-29 05:21:32
问题 I'm currently trying to write a disassembler. I found the following list of opcodes and their meanings, so i decided to parse it at runtime: http://mprolab.teipir.gr/vivlio80X86/pentium.txt But i am stuck at the opcode 0x00: It is followed by a reg/modbyte. Parsing it was not much of a problem for me. But I'm having trouble with the Scale-Index-Base byte: If you actually specify esp as index register, it actually means that there is no index register. The same applies for the base register

Switch to VESA/VBE?

北城以北 提交于 2020-05-28 07:53:49
问题 So, I'm currently working on an OS, and I'm stuck in a very dumb situation : switching to VESA/VBE My current code : mov ax, 0x4F02 mov bx, 0x4118 int 0x10 It changes Qemu resolution, but now I have a problem with plotting pixels. The formula of the pixel offset is : uint32 pixel_offset = y * pitch + (x * (bpp/8)) + framebuffer; The problem is that bpp, pitch and framebuffer are supposed to be given by mov ax, 0x4F01 int 0x10 and mov ax, 0x4F00 int 0x10 First, mov ax, 0x4F00 int 0x10 softlock

Switch to VESA/VBE?

百般思念 提交于 2020-05-28 07:53:24
问题 So, I'm currently working on an OS, and I'm stuck in a very dumb situation : switching to VESA/VBE My current code : mov ax, 0x4F02 mov bx, 0x4118 int 0x10 It changes Qemu resolution, but now I have a problem with plotting pixels. The formula of the pixel offset is : uint32 pixel_offset = y * pitch + (x * (bpp/8)) + framebuffer; The problem is that bpp, pitch and framebuffer are supposed to be given by mov ax, 0x4F01 int 0x10 and mov ax, 0x4F00 int 0x10 First, mov ax, 0x4F00 int 0x10 softlock

Switch to VESA/VBE?

与世无争的帅哥 提交于 2020-05-28 07:53:17
问题 So, I'm currently working on an OS, and I'm stuck in a very dumb situation : switching to VESA/VBE My current code : mov ax, 0x4F02 mov bx, 0x4118 int 0x10 It changes Qemu resolution, but now I have a problem with plotting pixels. The formula of the pixel offset is : uint32 pixel_offset = y * pitch + (x * (bpp/8)) + framebuffer; The problem is that bpp, pitch and framebuffer are supposed to be given by mov ax, 0x4F01 int 0x10 and mov ax, 0x4F00 int 0x10 First, mov ax, 0x4F00 int 0x10 softlock

Is there anything that assembly language can't do but only machine language can?

ε祈祈猫儿з 提交于 2020-05-28 04:41:27
问题 Recently I'm going to learn some basic assembly language, I have searched wiki and what I realize is that assembly language is just a "text version" of machine language in order to let human read? So it means that anything machine language can do assembly language can also finish, right? Or it exists some limitation in assembly language just like a gap between high level programming language and assembly language(Something we can't do well in high level language so we have to use assembly),

How does assembler process “org 100h” directive?

こ雲淡風輕ζ 提交于 2020-05-27 12:14:37
问题 I know, what this directive is do. As I know program-loader doesn't see this directive, so, how assembler process it? 回答1: It sets the current address during assembly to be 100h. That's all it is. A simple assignment. Elaboration: The directive does not control where in the result image the following instructions will be placed, but rather where the instructions would be placed after being loaded into memory. 回答2: "org <100h>" instructs the compiler with the to-be runtime information to

How to tell an 8086/8088 from an 80186?

被刻印的时光 ゝ 提交于 2020-05-27 06:21:46
问题 I am trying to write a program to check what processor is used to execute my program. Since this is intended to be used on a number of historic PC-clones, I want to be able to tell an 8086 from an 80186 just in case the computer is one of the rare machines that ship with an 80186. How can I do this in assembly? 来源: https://stackoverflow.com/questions/42306299/how-to-tell-an-8086-8088-from-an-80186

How to tell an 8086/8088 from an 80186?

纵饮孤独 提交于 2020-05-27 06:21:17
问题 I am trying to write a program to check what processor is used to execute my program. Since this is intended to be used on a number of historic PC-clones, I want to be able to tell an 8086 from an 80186 just in case the computer is one of the rare machines that ship with an 80186. How can I do this in assembly? 来源: https://stackoverflow.com/questions/42306299/how-to-tell-an-8086-8088-from-an-80186