x86-16

Jumping back 1000 lines

爱⌒轻易说出口 提交于 2019-12-27 04:48:05
问题 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.

emu8086 remove items more arithmetic mean

别等时光非礼了梦想. 提交于 2019-12-25 18:42:30
问题 organize keyboard input You must specify a one-dimensional array of elements from the keyboard This array is necessary to find the arithmetic mean Remove items more arithmetic mean Print the resulting array of elements (elements with no more than the arithmetic mean) ;srednee arifmiticheskoe data segment mas dw 2, 4, 6, 8, 10 n dw 0 ends stack segment dw 128 dup(0) ends code segment start: ; set segment registers: mov ax, data mov ds, ax mov es, ax xor ax, ax xor si, si mov cx, 5 @1: add ax,

Converting Lower Case to Upper case in Intel 8086 Assembly. If Already in Upper Case DO_NOTHING and continue SAVING

倖福魔咒の 提交于 2019-12-25 05:19:14
问题 ;I created this program (Intel 8086 Assembly) to read characters and store them and print ;them in reverse order after converting them to Upper Case. I know you can convert to upper ;case using (sub AL, 20h) but how do I put the conditional (IF) Loop ? org 100h mov BX, 0800h mov DS, BX ;Set segment register mov BX, 0000h ;Set offset register mov CX, 0 ;Set counter to 0 ;mov CH, 0 readwrite: ;Top of read/write loop mov AH, 01h ;Get ready to read a character int 21h ;Read character into AL ;jb

How do I use DOS interrupt 21h/AH=25h (set interrupt vector)?

回眸只為那壹抹淺笑 提交于 2019-12-24 14:43:18
问题 I prompt the user for input: mov ah, 0Ah mov dx, OFFSET buffer int 21h My assignment tells me that ctrl-c should "abort the program with an appropriate error message". I was told that int 23h is called whenever ctrl-c is called or detected. Apparently I can register my own interrupt handler via int 21h / ah=25h. But I don't know how to make an interrupt handler, nor do I know where this is supposed to go in my code. Assistance would be appreciated, thank you in advance. 回答1: As far as I know

Filesystem on Loop Device not Recognized by Linux when Bootloader is Written to it

与世无争的帅哥 提交于 2019-12-24 12:44:18
问题 I am currently writing a bootloader in x86 NASM assembly designed to load a kernel (R.BIN) from a FAT16 filesystem and jump to it. I have been writing the bootloader to a blank image that I have mounted by using sudo losetup loop21 image.img . I would write the image using sudo dd if=LOADER.BIN of=/dev/loop21 . Of course, the bootloader didn't work immediately (I was basing it off of a FAT12 bootloader and forgot to change a few things). After making dozens of edits, at some point, Linux

How to print a number in Assembly 8086?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-24 12:35:02
问题 I'm trying to write a function that receives a number (which I pushed earlier), and prints it. How can I do it? What I have so far: org 100h push 10 call print_num print_num: push bp mov bp, sp mov ax, [bp+2*2] mov bx, cs mov es, bx mov dx, string mov di, dx stosw mov ah, 09h int 21h pop bp ret string: 回答1: What you're placing at the address of string is a numerical value, not the string representation of that value. The value 12 and the string "12" are two separate things. Seen as a 16-bit

Flags on Instruction pointer overflow in 8086/8088

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-24 08:25:27
问题 Hey guys, Im new to the 8086 architecture and have not been able to find much on Google related to the following: On the i8086 or i8088 (ie 16bit, segmented addressing) what happens if an instruction fetch occurs with the instruction pointer (program counter) at 0xFFFF? I assume the CPU increments the IP and it overflows and becomes 0x0 while the CS register remains unchanged. However if this happens do any flags get set (like the overflow bit of the flags register?) Thanks, 回答1: The

How to fix “os.asm:113: error: TIMES value -138 is negative” in assembly language

可紊 提交于 2019-12-24 08:03:19
问题 I'm developing an operating system in assembly language. At a certain time i get this error from NASM: os.asm:113: error: TIMES value -138 is negative I want to take this project to the end. Only the errors like that despair me! Here is the 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 call cls MOV AH, 06h ; Scroll up

Weird Errors While Reading Disk

此生再无相见时 提交于 2019-12-24 07:31:16
问题 So, I've been working on a hobby project. Creating my own Operating System. I started a while back but dropped it until maybe a couple nights ago. I just fixed an oversight that caused nothing to be read from the sectors I want to read from. With that error out of the way, a new one has came about and I honestly don't even know where to begin debugging this one. I am coding a Master Boot Record and debugging it with GDB and QEMU, here is the code to my master boot record (It was assembled

Displaying text without interrupts

拥有回忆 提交于 2019-12-24 05:51:12
问题 I am trying to make my own boot-loader. As I will not have any interrupts when I change from 16bit to 32 bit mode, I will not be able to use int 10h . Here is the code I have so far: org 0x7c00 ; add to offsets xor ax, ax ; make it zero mov ds, ax ; ds=0 mov ss, ax ; stack starts at 0 cld mov ax, 0xb800 ; Ax = address of video memory mov es, ax xor di, di call print ; call thr print function hang: jmp hang ; constanly loop print: mov si, msg ; load msg into si mov cx, 4 mov ah, 07h printchar: