16-bit

TASM 1.4 - Changing background color without clearing the screen?

南楼画角 提交于 2019-12-19 11:43:09
问题 I'm using Tasm 1.4. I'm trying to change the color of the background and text without clearing the previous text, but it always ends up on clearing the previous text although the colors are changed. For example: mov ah,09h lea dx,text1 int 21h ;displays text1 mov ah,01h int 21h ;I input a character mov ah,06h mov bh,42h mov cx,0000h mov dx,184fh int 10h ;I use this to change the text and background color mov ah,02h mov bh,00h mov dh,0ch mov dl,20h int 10h ;along with this mov ah,09h lea dx

Write graphics pixels in 16-bit assembly

萝らか妹 提交于 2019-12-19 10:17:48
问题 I'm trying to develop my own very basic operating system for educational purposes. While coding the kernel, I tried to set color to some pixels on screen to make it look better, but I failed. I used INT 10h with AH = 0CH with video mode 13h (320x200 graphics, 256 colors, 1 page) and tried several other modes like 01h and 03h but they don't work. This is my complete code: ;set video mode mov ah, 00h mov al, 13h int 10h ;write pixels on screen mov ah, 0ch mov bh, 0 mov dx, 5 mov cx, 5 mov al,

Operand size prefix in 16-bit mode

笑着哭i 提交于 2019-12-18 04:52:52
问题 I'm trying to understand GAS's behavior of .code16. From the manual, it seems in 16-bit section, for 32-bit operands or instructions, a 66H operand override prefix will be produced for the instruction encoding. Does that mean .code16 movw %eax, %ebx is legal in such mode? Then the code cannot run on 16-bit processor? 回答1: These are legal instructions for 80386+. Starting with the 80386 we can use operandsize- and addresssize- override prefixes. Those prefixes can be used in combination with

swapping 2 registers in 8086 assembly language(16 bits)

元气小坏坏 提交于 2019-12-17 17:15:18
问题 Does someone know how to swap the values of 2 registers without using another variable, register, stack, or any other storage location? thanks! Like swapping AX, BX. 回答1: You can do it using some mathematical operation. I can give you an idea. Hope it helps! I have followed this C code: int i=10; j=20 i=i+j; j=i-j; i=i-j; mov ax,10 mov bx,20 add ax,bx //mov command to copy data from accumulator to ax, I forgot the statement, now ax=30 sub bx,ax //accumulator vil b 10 //mov command to copy

Print integer to console in x86 assembly

流过昼夜 提交于 2019-12-17 07:38:04
问题 When I add two values in 16 bit assembly, what is the best way to print the result to console? At the moment I have this code: ;;---CODE START---;; mov ax, 1 ;put 1 into ax add ax, 2 ; add 2 to ax current value mov ah,2 ; 2 is the function number of output char in the DOS Services. mov dl, ax ; DL takes the value. int 21h ; calls DOS Services mov ah,4Ch ; 4Ch is the function number for exit program in DOS Services. int 21h ; function 4Ch doesn't care about anything in the registers. ;;---CODE

How to print text in color with interrupts?

纵然是瞬间 提交于 2019-12-14 03:22:09
问题 This is my code it print in white color which is the default one. I know how to print in color without interrupts, but I don't want to do that. I want to print it in any other color using interrupts.How can I do that?? Any Idea? Thanks in advance I am using emu8086 as an assembler data segment wellcome db 'Wellcome User !',13, 10 ,'$' how db 'how are you',13,10,'$' ends stack segment dw 64 dup(0) ends code segment start: push ax mov ax,data mov ds,ax mov es,ax pop ax lea si, wellcome call

GCC baremetal inline-assembly SI register not playing nicely with pointers

醉酒当歌 提交于 2019-12-13 16:10:03
问题 Well, this is obviously a beginner's question, but this is my first attempt at making an operating system in C (Actually, I'm almost entirely new to C .. I'm used to asm ) so, why exactly is this not valid? As far as I know, a pointer in C is just a uint16_t used to point to a certain area in memory, right (or a uint32_t and that's why it's not working)? I've made the following kernel ("I've already made a bootloader and all in assembly to load the resulting KERNEL.BIN file): kernel.c void

OpenCV imwrite saving black png

自作多情 提交于 2019-12-12 19:18:40
问题 I'm trying to write a C++ program that applies a flatfield to an image. It's supposed to load an image and divide it by another loaded image, then export it as a PNG. My program compiles correctly, but only produces an all-black image. #include <climits> #include <stdio.h> #include <string> #include <opencv/cv.h> #include <opencv/highgui.h> using namespace cv; using namespace std; int main( int argc, char *argv[] ) { const char *flat_file = argv[1]; const char *img_file = argv[2]; const char

Converting 32-Bit Real to 2x 16-Bit Bytes

不打扰是莪最后的温柔 提交于 2019-12-11 19:33:09
问题 I'm trying to send a 32-Bit Real across a CAN communications (IFM) but the CAN comms only accepts a 16-Bit value. If the value I'm trying to send goes above 255, it resets back to 0 and continues in that pattern. I therefore need to split the 32-Bit Real value in to two 16-Bit values and then reassemble on the other side of the comms. I just can't seem to get my head around how to do it in structured text. Any help would be appreciated 回答1: I know I am a little late to the party but wanted to

How to implement floating point using 16 bit words

僤鯓⒐⒋嵵緔 提交于 2019-12-11 15:32:50
问题 How would I implement floating point operations if I only have memory locations that are 16 bits wide? I am trying to implement IEEE-754 32-bit single precision floating point. Thank you 回答1: There is a 16bit version of IEEE754 回答2: I ended up figuring out that there is no easy way to to this. I had to create my own software library for all of the functions in assembly. If anybody has questions regarding how to do this, I implemented add,subtract,multiply,square root, divide, cosine, and sine