3,083 questions
2
votes
2
answers
119
views
Printing to VGA in protected mode crashes system
As you can see down at bottom on my stage 2 boot loader, I have a VGA write thing (Prints out "Starting kernel...", but when I use it, the system starts to boot loop, I have no idea why this ...
4
votes
1
answer
111
views
nasm bios int 13h read sector issue [duplicate]
im trying to make a simple bootloader that loads a simple kernel and the problem is that the kernel code doesnt run i do see prints from the bootloader but not from the kernel here is my code:
boot....
4
votes
1
answer
109
views
Did MS-DOS software rely on memory offset wrapping, in practice?
With the Intel 8088's segment:offset model, code and data reads will stay in the active segment unless the segment is changed. For example, take this instruction:
ABCD:FFFF ADD AL,12
This ADD ...
4
votes
1
answer
151
views
Qemu Bios; Configuring VGA
I'm trying to write a simple hello world bios for Qemu as an academic exercise, and I've gotten Qemu to believe the display is initialized. I see a black screen upon boot, but writing to character ...
0
votes
0
answers
30
views
warning: word data exceeds bounds [-w+number-overflow] [duplicate]
I'm trying to start building an operating system from scratch but I don't know why I'm getting this warning on this code:
[BITS 16]
[ORG 0x7c00]
start:
mov ax, 0
mov ds, ax
mov es, ax
...
4
votes
1
answer
191
views
Is 0x0000:0x7000 a unsafe address to load your kernel? Or is it just qemu annoying me
So I thought I'd try to make a DOS copy but it runs on a floppy and its just a simple plug and play with fat12 partition for user applications and drivers.
I first attempted to load my kernel using ...
2
votes
2
answers
150
views
16-bit x86 Assembly Kernel getting stuck when calling input function
Well, I'm writing my own OS just for fun, and I thought it would have been cool to add a bytecode "language" interpreted by the kernel itself. I took inspiration mainly from Java, which is ...
4
votes
2
answers
191
views
MBR works in QEMU/BOCHS but not on real hardware
I threw together a makeshift MBR for a chainloader project I have been working on for sometime now. I tested on QEMU and BOCHS and no issues, besides throwing earlier 386 BIOS images into the mix (...
1
vote
1
answer
115
views
I'm writing an Assembly x86 bootloader, but the printing function doesn't print the given string correctly
I'm writing a bootloader in x86 Assembly for my operating system. Note that I have already wrote a few bootloaders and I never faced this problem. This is the code that I compile with NASM (precisely ...
3
votes
2
answers
112
views
How to detect the slave PIC in an old PC using assembly?
I am modifying the source code of a driver for an ISA card that uses IRQ2. The case, as we all know, IBM added a second PIC and chained it using IRQ2, and the IRQ2 present in the ISA bus was replaced ...
7
votes
1
answer
199
views
Replacing int 21h vector in DOS
I'm trying to replace the int 21h vector with a custom routine in MS-DOS. This method works for the timer tick interrupt (1Ch), but for some reason hangs after around 20 calls to 21h.
My code is ...
2
votes
1
answer
104
views
Stuck on Second Stage Bootloader – Turbo C + TASM + DOSBox + QEMU Setup
I'm working on a retro programming project and running into trouble with my bootloader setup. I'm using:
Turbo Assembler 4.01 for the first-stage bootloader (x86 Assembly)
Turbo C 2.0 for the second-...
2
votes
0
answers
114
views
Mouse Cursor in 16-bit Assembly (NASM) Overwrites Screen Content in VGA Mode 0x12
I'm developing a PS/2 mouse driver in 16-bit assembly (NASM) for a custom operating system running in VGA mode 0x12 (640x480, 16 colors). The driver initializes the mouse, handles mouse events, and ...
-5
votes
2
answers
94
views
Why does my 32bit kernel randomly flicker?
For some reason every time I try entering 32bit protected mode.. it always FLICKERS AND FLICKERS FOR NO REASON..
I am using QEMU and my kernel is being assembled into a raw binary and then written ...
0
votes
1
answer
81
views
How can I prevent an infinite loop in my 8086 assembly program that displays even numbers from 00 to 98 on a 7-segment display? (smz32v50)
Exercise: Displays even numbers
Example: 00, 02, 04, …., 98
This is based on an assembly 8086. The program uses seven display segment (port 02) to display even numbers where MSB is Most Significant ...
3
votes
1
answer
88
views
Why does working Assembly code not work when loaded into different memory by disk read?
Problem
I have assembly code that switches to 32bit mode and prints a character successfully when I have it inside the boot sector -
But when I use a disk read to load the code to the next sector the ...
2
votes
1
answer
57
views
Register corruption when iterating in a nested loop
It's my first time writing x86-16 assembly. I'm writing a bootloader game, but I'm struggling with iterating through level data.
I'm attempting to iterate through a 2d array - each byte of this array ...
3
votes
2
answers
99
views
How do I use the int 16h interrupt to store a number of more than one digit typed from the keyboard?
I am implementing a fractional number calculator (numerators and denominators must be entered separately) for an assembly language course. I had already finished the logic of my program, but I ...
1
vote
1
answer
58
views
Why is the result in this NASM 16-bit program always the same, no matter the array elements?
I'm trying to write a .COM program in NASM assembler for DOS to compare the odd-indexed elements of the first array with the even-indexed elements of the second array. But it prints that the elements ...
0
votes
1
answer
101
views
I need help for making a dice game with assembly language
I'm trying to make a simple dice game using assembly language (MASM).
The program generates two random numbers (1~6) and compares them.
If the player's number is higher, it prints "You Win!",...
0
votes
1
answer
123
views
DOS TSR program using int 27h [closed]
I need to write a program in Assembly for DOSBOX using MASM.
Task:
Write a resident (TSR) program for DOS that changes the keyboard repeat rate every second in a cyclic manner, from the slowest to the ...
1
vote
1
answer
38
views
Where can I assemble my assembly file aside from TASM that supports .STACK
I am just following the book from my university to run this simple code I found as an example for my coding practice. I am new to assembly language.
The problem is that I only know how to assemble in ...
1
vote
1
answer
82
views
How to change addresses of opcodes in executable binary files x86 16bit assembly?
I have a basic bootloader that reads my kernel at 0x0500. The kernel do some setup then reads and calls a binary.
Executable Binary:
BITS 16
ORG 0x0000
START_ADDR dw init ;The address to be called ...
1
vote
3
answers
122
views
How to force/specify a long jump in fasm?
I am doing some basic tests in fasm
I try to emulate a jump instruction in the reset location of 16 bit 8086 real mode:
$ cat bios.asm
; BIOS ROM START (64 KB ROM)
org 0xF0000
start:
mov ah, 0x0E
...
-1
votes
2
answers
105
views
Switch text mode to video mode in assembly
I have a project I am doing in assembly. I am making a kahoot style quiz game in x86 assembly, running it in DOSBox.
I made the entire thing with no graphics but I need to make it with graphics so I ...
2
votes
1
answer
90
views
Performing multiplication of 32-bit numbers in 16-bit real mode in order to traverse FAT table
I am writing a simple bootloader (and, hopefully soon, an operating system). I have been making progress, but this part is stumping me a bit.
I am writing this operating system and bootloader into a ...
0
votes
0
answers
76
views
what I do wrong when trying to switch in protected mode?
[ORG 0x7C00]
[BITS 16]
CODE_OFFSET equ 0x8
DATA_OFFSET equ 0x10
KERNEL_POS equ 0x1000 ; 4096 bits dec, 512 bytes
; loader - 512 size bytes,
; then kernel will placed to ...
2
votes
1
answer
135
views
Issue when running Makefile on boot.asm, "init :: non dos media"
I've been trying to build a custom OS following the steps in this guide. However, I continue to get the following error from my Makefile,
init :: non DOS media
Cannot initialize '::' ::kernel.bin: ...
0
votes
0
answers
29
views
how do I make the string blinking using TASM? [duplicate]
image link: https://drive.google.com/file/d/1P695nlkTDUlbEpG1NfEgJjKCTTs34SKd/view?usp=sharing
1.) I have this code that has a name at the center when you run it, how can I make this name(or string) ...
1
vote
1
answer
96
views
Hello World in real mode
I am trying to write a sample “Hello World” in real mode that will run in QEMU. The host is a 64 bits intel running FreeBSD 14.
I have tried the following:
This is boot.asm file:
format binary
org ...
0
votes
1
answer
59
views
Assembler delete word
I need help with assembler(TASM), and I need to change one problem.
When filling a buffer of 200 elements, I need to make a transition to entering a word for deletion, but it does not work, help
....
2
votes
1
answer
73
views
Can't print out 8-bit values of registers
I'm trying to print out current year (CX), month (DH), day (DL) and day of the week (AL) from system timer.
Year stored in CX is printed out correctly.
I tried to printout DH, DL and AL with ...
0
votes
0
answers
24
views
How to display integer array on console in assembly 8086 in my given problem? [duplicate]
I am solving this question:
Push the first 10 even numbers onto a stack. Then, pop each number, check if it is divisible by 4, and if so, push it into a new stack. Finally, display the contents of the ...
2
votes
1
answer
135
views
Why CX register already has a non-zero value on startup of a DOS program, unlike AX and BX?
I noticed that, whenever I started my AFD (Avance Fullscreen Debugger), even before the execution of the first command, the CX register has already some value. What can be the reason for this?
As you ...
1
vote
0
answers
44
views
jwasm -bin align BSS to 4
If I do:
.model tiny
.code
_start:
mov [var1], ax
.data?
ALIGN 4
var1 dw ?
var2 dw ?
buf db 4096 dup(?)
end
I get Warning A4130: Incompatible with segment alignment: 4
If ...
0
votes
2
answers
116
views
Available registers for assembly "function"
I am using a typical x86-16 assembly random number generator, using the BIOS timer and the current milliseconds.
random_number:
mov ah, 00h ; interrupts to get system time
int 1Ah ; CX:DX now ...
2
votes
1
answer
172
views
Is There A Way To Force NASM To Emit Opcode 0x82 In 8086 Mode
Problem
I'm using NASM as a reference assembler for an 8086 disassembler project I'm working on. To increase test coverage I'm looking for an assembly instruction and/or command line flag that will ...
1
vote
0
answers
60
views
Control Data Address Mark Detected when attempting to read sectors in Qemu
I am trying to write a custom bootloader, when I call int 13h, I keep encountering the error 0x0e - Control Data Address Mark Detected on the drive that I attempt to read to. I don't really get any ...
1
vote
1
answer
74
views
EMU8086 coding: multi-level water level sensor and rain sensor
ORG 100h ; Start address for EMU8086
; Define Ports
PORT_B EQU 12h ; LEDs (Green, Yellow, Red)
BUZZER_PORT EQU 18h ; Buzzer Control Port
; Define LED States
GREEN_LED EQU 01h ; Bit 0
...
0
votes
0
answers
53
views
How many machine cycles does the pop instruction require in i8086?
I had a test from assembly in my college, and one of the tasks was to say "what values do appear on address lines at cycle 2 and 3, for instruction: pop %BX". The problem is, from what I ...
1
vote
1
answer
81
views
OSDev - Replace cylinder address to make OS run on real hardware
I'm following a github tutorial (https://github.com/gmarino2048/64bit-os-tutorial/)
and came across these lines of code in load.asm in chapter 1.3, part of the bootloader that loads the actual kernel:
...
2
votes
0
answers
66
views
How does this code detect whether the timer is working?
; VERIFY THAT TIMER 1 FUNCTIONS OK
MOV AL,54H ;SEL TIMER 1,LSB,MODE 2
OUT TIMER+3,AL
SUB CX,CX ;
MOV BL,CL
MOV AL,CL ;SET INITIAL TIMER ...
1
vote
2
answers
111
views
Use different colors for different message string constants in a DOS program?
I'm learning how to do assembly, and I can't find any examples on how to add different colors to different lines of messages (e.g. msg1 = green background, msg2 = red background). Adding something ...
0
votes
1
answer
86
views
Drag and Drop project in assembly 8086 (move a square with the mouse)
I'm a CS student and I need to build a project for my architecture class. I have tried to build a simple drag and drop program in asm. The whole idea would be to draw a square somewhere on the screen ...
0
votes
2
answers
113
views
MASM Using ah=02h int 21h, display text, highlight with flickering + inverse display
As i understand. Program must clean background, display message1 ( dark letters on white background + highlighting by flickering). then go up for 2 strings and display message2(also dark letters on ...
0
votes
0
answers
39
views
Calculating Fibonacci Sequence to 46 times or more in 8086 Assembly [duplicate]
I'm learning 8086 assembly through college course and i ran into a problem. I'm trying to calculate Fibonacci sequence to 46 places but 16-bits registers inside this processors can't handle large ...
1
vote
1
answer
108
views
What is the proper octal representation of the encoding of the operand register in intel 8086?
The classical explanation of Intel opcodes using octal says this:
As an example to see how this works, the mov instructions
in octal are:
210 xrm mov Eb, Rb
211 xrm mov Ew, Rw
...
1
vote
1
answer
177
views
8086 memory to accumulator encoding: why do mov al, [absolute] and mov ah, [absolute] have different sizes?
mov al, [10] ; a0 0a 00
mov ah, [10] ; 8a 26 0a 00
After assembling the above 8086 assembly code using NASM, I noticed a length disparity in the resulting machine code (shown in the comments above ...
1
vote
1
answer
52
views
I'm trying to write an assembly language program that prints my name using a loop, but I can't figure out the issue or if I am doing it wrong on MASM?
INCLUDE Irvine32.inc
.model small
.stack 100h
.data
name db 'YourName', 0Dh, 0Ah, '$'
count db 5
.code
main proc
mov ax, @data
mov ds, ax
mov cx,5 count ; Set loop counter to 5
...
1
vote
1
answer
94
views
Filling color in enclosed area in MASM using recursion
I have a function vmem, which is for drawing at (CX,DX). The function vmemr is for reading (CX,DX) to see if the pixel is painted. And vmemr will return AL=1 if there is color on (CX,DX).
Now I want ...