x86-16

Drawing a circle using 8086 Assembly Language [closed]

我们两清 提交于 2019-12-06 16:04:20
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 is something wrong with my negative numbers manipulation but can't for the life of me figure it out

Printing 3 digits in assembly

陌路散爱 提交于 2019-12-06 14:13:59
问题 This is my printing function, it should output a 3digit result. I store my result in RES which is a dw. The push and pop fixed my problems with printing before now I don't know where it goes wrong. XOR AX, AX XOR BX, BX ;this divides my 3digit number by 100 giving me my, hundredth digit MOV AX, RES MOV BX, 100 DIV BX ;prints the hundredth digit ADD AL, '0' MOV DL, AL PUSH AX ; save AX on the stack MOV AH, 02h INT 21h POP AX ; restore ax ;divides the remainder by 10 giving me my tens digit MOV

DosBox how to fix character attribute?

纵饮孤独 提交于 2019-12-06 09:42:55
I wrote my assembly code just to write a character with a blue background and white foreground. It works in emu8086's emulator but when I open it on DosBox it does not show the background color. With Emu8086: With DosBox: mov ax,0012h int 10h mov ah,9 mov al,31h mov bl,1fh int 10h In the graphics video modes, the BL parameter for BIOS function 09h only defines the foreground color. It is always applied to a black background. Below is my implementation of an extension of the functionality of this function. Now BL holds an attribute (foreground color and background color) just like in the text

Assembly Basics: Output register value

核能气质少年 提交于 2019-12-06 08:06:06
I just started learning assembly language and I am already stuck on the part to "display the decimal values stored in a register on the screen". Im using the emu8086, any help would be appreciated! :) .model small ;Specifies the memory model used for program to identify the size of code and data segments org 100h ;allocate 100H memory locations for stack .data ;the segment of the memory to declare/initialze the variables var1 db 0006 var2 db 0002 var3 db 0001 .code ;start of the code segment main proc ;start of the first procedure mov bl, var1 add bl, var2 add bl, var3 mov ah, 00h ; display

Understanding of boot loader assembly code and memory locations

ⅰ亾dé卋堺 提交于 2019-12-06 07:37:45
I want to check my understanding of the following bootloader code: BITS 16 start: mov ax, 07C0h ; Set up 4K stack space after this bootloader add ax, 288 ; (4096 + 512) / 16 bytes per paragraph mov ss, ax mov sp, 4096 mov ax, 07C0h ; Set data segment to where we're loaded mov ds, ax mov si, text_string ; Put string position into SI call print_string ; Call our string-printing routine jmp $ ; Jump here - infinite loop! text_string db 'This is my cool new OS!', 0 print_string: ; Routine: output string in SI to screen mov ah, 0Eh ; int 10h 'print char' function .repeat: lodsb ; Get character from

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

青春壹個敷衍的年華 提交于 2019-12-06 07:32:44
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 mov ah, 0 ; set display mode function. mov al, 13h ; mode 13h = 320x200 pixels, 256 colors. int 10h ; set it! mov cx, 10 ;col mov dx,

Linking a file using ld to output a binary file gives error in OS development

蓝咒 提交于 2019-12-06 06:36:56
问题 I am learning Operating system tutorials. I created 2 files. boot.asm kernel.c The kernel.c is as follows : int main() { char *src = (char *)0xB8000000L; *src = 'M'; src += 2; *src = 'D'; return 0; } The kernel is used to write a character to the text mode video display area. The kernel was compiled using Windows version of GCC with: gcc -ffreestanding -c -m16 kernel.c -o kernel.o I link the kernel object to a binary file using LD : ld -Ttext 0x10000 --oformat binary -o kernel.bin kernel.o

Register addressing mode vs Direct addressing mode

╄→尐↘猪︶ㄣ 提交于 2019-12-06 06:04:54
问题 I encountered this question in a test paper. It stated, Which of the given addressing modes is faster? Why? Register addressing mode Direct addressing mode Now according to me register addressing mode should be faster as register is the fastest memory location in the computer. Is this the correct answer to it? Please help out. Thanks 回答1: Register accesses are the fastest. However, memory accesses can be as fast if the memory data that you're accessing is already in the CPU's data cache. 回答2:

How to copy from one file to another?

时光毁灭记忆、已成空白 提交于 2019-12-06 05:42:08
I am trying to copy from one file to another. So if the user is prompted to enter a file name...FILE1 a saved string will be copied to a file then the user is prompted to enter a second file name...File2, the contents of file 1 is copied to file 2. I can find information on the read part but I'm not sure how to copy from 1 to the other??? .model small .stack 100h .data handle dw ? filename db 26 ;MAX NUMBER OF CHARACTERS ALLOWED (25). db ? ;LENGTH (NUMBER OF CHARACTERS ENTERED BY USER). db 26 dup(0) ;CHARACTERS ENTERED BY USER. END WITH CHR(13). prompt1 db "ENTER FILE NAME HERE: $" mess1 db '

Why does 8085 start from 00000 while 8086 from FFFF0?

妖精的绣舞 提交于 2019-12-06 04:21:39
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. 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 enhanced for certain purposes. The 6502 for example has special faster instructions for accessing the first