x86-16

DosBox how to fix character attribute?

安稳与你 提交于 2020-01-02 09:43:10
问题 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 回答1: 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

Real mode BIOS routine and Protected Mode

大城市里の小女人 提交于 2019-12-31 22:41:54
问题 I am doing some OS experiment. Until now, all my code utilized the real mode BIOS interrupt to manipulate hard disk and floppy. But once my code enabled the Protect Mode of the CPU, all the real mode BIOS interrupt service routine won't be available. How could I R/W the hard disk and floppy? Do I need to do some hardware drivers now? How could I start? Is this one of the reasons that an OS is so difficult to develop? I know that hardwares are all controlled by reading from and writing to

Intel 8086 Assembly procedure calling from C

巧了我就是萌 提交于 2019-12-31 03:59:09
问题 I need to develop a procedure for Assembly language and call that procedure from C language (pass a string and return an integer value). My assembly procedure works fine "stand-alone". I need help with connecting them together. Program is supposed to run on Intel 8086. I need to use MASM or emu8086 as assembler/simulator. Kindly recommend a C compiler and also a way to make the simple C program that is able to call the assembly procedure and get the returned value. How can I pass a string to

What does SEG directive do in 8086?

落爺英雄遲暮 提交于 2019-12-31 03:47:53
问题 SEG A : Assigns the content held in segment register corresponding to the segment in which A resides to the operand. I guess that means that if A lies in Data Segment, SEG A is the same as DS . Since DS holds the base address of the Data Segment, does MOV AX, LEA A MOV DX, SEG A MOV AX, [AX + DX] copy the physical address of A to AX ? 回答1: I guess that means that if A lies in Data Segment, SEG A is the same as DS. Correct, if DS points to Data Segment. does MOV AX, LEA A MOV DX, SEG A MOV AX,

Why won't the program print the sum of the array?

大城市里の小女人 提交于 2019-12-31 03:21:08
问题 So I'm building a simple 8086 Assembly program that allows the user to input 4 digits, store them in an array and print out the sum of those digits (The sum must be a one digit number): data segment i db ? array db 20 dup(?) sum db ? ends stack segment dw 128 dup(0) ends code segment mov ax, data mov ds, ax mov es, ax mov i, 0 Enter: mov ah, 1 int 21h mov bl, i mov bh, 0 mov array[bx], al inc i cmp i, 4 jne Enter mov sum, 0 mov i, 0 Calc: mov bl, i mov bh, 0 mov al, array[bx] add sum, al inc

Unable to keep a square a full square while moving it

寵の児 提交于 2019-12-31 02:55:19
问题 I have been trying to draw a box in assembly and move it horizontally across the screen. The code of printing the square itself works for me but when I try to make it move it is not working very well. I can see it moving but not as a full square, if you get my point. My code: in Assembly Tasm STA SEGMENT STACK DB 0FFFeH DUP(?) STA ENDS DATA SEGMENT ;----------- ;VARIABLES HERE xpos dw 50h ypos dw 50h color db 9h constat equ 0ffffh siNum dw ? diNum dw ? numOFtime dw 0h ;------------- DATA ENDS

Playing .wav files on DOSBox's Sound Blaster device

别等时光非礼了梦想. 提交于 2019-12-28 19:25:49
问题 I want to make a program in assembly/8086/masm/dosbox that turns the keyboard into various musical instruments so i need to be able to play some .wav files to produce the required sounds.I am aware of beep char and producing sound via sending frequencies to pc speaker (ports 41h,42h and 61h) but both ways are clearly not going to get me there. I searched around and found that I need to use int 21h for opening files, knowledge of .wav format and knowledge of sound programming using Sound

While, Do While, For loops in Assembly Language (emu8086)

自作多情 提交于 2019-12-28 04:03:44
问题 I want to convert simple loops in high-level languages into assembly language (for emu8086) say, I have this code: for(int x = 0; x<=3; x++) { //Do something! } or int x=1; do{ //Do something! } while(x==1) or while(x==1){ //Do something } How do I do this in emu8086? 回答1: For-loops: For-loop in C: for(int x = 0; x<=3; x++) { //Do something! } The same loop in 8086 assembler: xor cx,cx ; cx-register is the counter, set to 0 loop1 nop ; Whatever you wanna do goes here, should not change cx inc

How to set 1 second time delay at assembly language 8086

主宰稳场 提交于 2019-12-28 03:03:25
问题 My problem is that I have written a code that is supposed to output a result into a set of LEDs connected to the parallel port. When I ran the code it pretty much did nothing. My instructor told me that the code ran too fast that my eyes did not see what happened. I have found that there are a couple of ways to do a time delay, I have tried to loop the NOP but I think I cannot really determine what is going on. Is there any better way? I have here a part of the code where I have to add a time

Jumping back 1000 lines

痞子三分冷 提交于 2019-12-27 04:48:43
问题 I was trying to make a code, that when you're at the very end, it will ask you if you want to try again. If you press 'y', then it will jump back a 1000 lines, right at the beginning of the program. Well obviously, it didn't work out, as I got the error "jump relative out of range". So I made jumps every 50 lines, having a total of 20 jumps, like start: . s20: jmp start . . . s2: jmp s3 . s1: jmp s2 . jmp s1 Now after doing that, I ran the program, and when I pressed 'y', TASM kind of froze.