x86-16

How to print a string in reverse order in a .COM executable?

穿精又带淫゛_ 提交于 2019-12-11 02:29:35
问题 I have just started to learn assembly language and i am trying to print "hello world" in reverse order that means "dlrow olleh".the problem is i am getting only 1st letter as output and the order is still same no change at all!As a newbie many thing is unknown to me and i am doing lots of mistakes and i am unable to identify them due to lack of knowledge.So any answer with proper explanation will be appreciated!Here is my code: name "hi" ; can anybody explain what is the use of this? org 100h

How to convert a 16 bit number entered by user to decimal

穿精又带淫゛_ 提交于 2019-12-10 21:52:54
问题 I got the user to enter a 16 bit number. I want to display the number entered by the user. This is what I've come up with so far. As you can see, I have subtracted 30H from the input to convert it to decimal. Where should I add 30H back to get it back to its original ASCII value? MOV AH,1H ;user input for first number part 1 INT 21H SUB AL,30H MOV NUM1,AL MOV AH,1H ;1st number part 2 INT 21H SUB AL,30H MOV NUM2,AL MOV AH,1H ;1st number part 3 INT 21H SUB AL,30H MOV NUM3,AL MOV AH,1H ;1st

2D array in assembly

不想你离开。 提交于 2019-12-10 18:56:21
问题 I defined in the data section an 2d array and two 1d arrays (one for column sum and one for row sum) and i wrote a function that sum the 2d array into the 1d array. I'm using both eax and ebx as indexes to the 2d array but my program fail when eax or ebx becase 1 and trying to access to unknown address in the memory. how can i fix the access to the memory in this line: mov edx,[ebp+columnsSumArray+type dword*ebx] this is my program: .386 .MODEL flat,stdcall .STACK 4096 extern ExitProcess@4

Instruction sequence that does the same thing as push

ⅰ亾dé卋堺 提交于 2019-12-10 17:16:35
问题 I would like to know if it is possible (and if so, how) to write a sequence of instructions that would have the same effect as push . For example, if the contents of ax is 1200 , and I do a push ax , what other instructions can I use to accomplish what push ax does? 回答1: Some other answers use [sp] for stack addressing, but it is not possible in 16-bit mode, nor in 32-bit or 64-bit modes either. However, in 32-bit mode you can use [esp] and in x86-64 you can use [rsp] for memory addressing,

Memory-Mapped Graphics Output

旧街凉风 提交于 2019-12-10 16:54:09
问题 I'm exploring into drawing pixels and lines, using Memory-Mapped Graphics. I'm using TASM in Textpad, in Windows. When I click run the whole screen turns blue and that's it, no pixels drawn. .model small .stack .data saveMode db ? xVal dw ? yVal dw ? .code main proc mov ax, @data mov ds, ax call SetVideoMode call SetScreenBackground call Draw_Some_Pixels call RestoreVideoMode mov ax, 4c00h int 21h main endp SetScreenBackground proc mov dx, 3c8h mov al, 0 out dx, al mov dx, 3c9h mov al, 0 out

Why does this assembly language program print hex digits in reverse order?

≯℡__Kan透↙ 提交于 2019-12-10 16:42:57
问题 I've been following lecture notes on how to write an operating system and have been getting to grips with assembly language, specifically NASM. (Lecture notes here, for interest: https://www.cs.bham.ac.uk/~exr/lectures/opsys/10_11/lectures/os-dev.pdf) One of the first tasks is to write a program that will print to the screen an ASCII representation of a 16-bit hexadecimal number. In the program below, the test number is '0x6bf1'. The program prints the number, but with the hex digits reversed

How do I properly hook Interrupt 28h in assembly for DOS, and restore it?

ぐ巨炮叔叔 提交于 2019-12-10 13:46:32
问题 I'm trying to set the handler of Interrupt 28h to my own routine, restore all the registers and flags involved, and restore the original Interrupt handler. I'm using NASM Assembler, under DOSBox and MS-DOS 6.22 in VirtualBox. I've thought about debugging, but doing so on a TSR program sounds impossible. I've tried pushing the Data Segment onto the Code Segment, and saving the original Data Segment for restoring later, but it seems to hang the machine even after restoring the Data Segment.

Drawing a circle using 8086 Assembly Language [closed]

佐手、 提交于 2019-12-10 10:57:55
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 10 months ago . I was trying to draw a circle using 8086 assembler. I tried utilizing the midpoint circle algorithm which sadly resulted in drawing a tilted square for some reason (screenshots below). For reference, I rewrote the algorithm in python and managed to draw a circle without a problem. I have a feeling that there

Why does 8085 start from 00000 while 8086 from FFFF0?

夙愿已清 提交于 2019-12-10 10:49:55
问题 I am unable to understand the different starting addresses of Physical Address generated by CS:IP in 8085-86. Is this because of Stack? I think the concept of Stack was present before 8085. Please help out. Thanks. 回答1: There are 3 reasons I can think of that a particular value could be used for the powerup IP: convention - other processors in the same family/brand use the same location, and they want to give their customers a sense of familiarity compatibility certain areas are restricted or

How to draw a square (int 10h) using loops?

不想你离开。 提交于 2019-12-10 10:48:54
问题 Can you use new line that has 21h on a setting of 10h? if not then how would it be possible to set a new line for 10h via 8086? What im trying to do is to use loops that would resemble a square. org 100h mov ah, 0 ; set display mode function. mov al, 13h ; mode 13h = 320x200 pixels, 256 colors. int 10h ; set it! mov cx, 10 mov dx, 10 mov ah, 0ch ; put pixel int 10h colcount: inc cx int 10h cmp cx, 20 JNE colcount rowcount: inc cx int 10h cmp cx, 20 JNE rowcount 回答1: mov ah, 0 ; set display