x86-16

“times 510-($-$$) db 0” does not work

和自甴很熟 提交于 2020-01-13 20:27:39
问题 I am learning about boot sectors. I downloaded nasm-installer-x64.exe from the NASM website. My operating system is win7-64bit. When I run the following code it does not work correctly mov ah, 0x0e; mov al, the_secret; int 0x10; mov al, [the_secret]; int 0x10; mov bx, [the_secret]; add bx, 0x7c00; mov al, [bx]; int 0x10; mov al, [0x7c1e]; int 0x10; jmp $; the_secret:; db 'X'; times 510-($-$$) db 0; dw 0xaa55; 回答1: I don't believe there is anything wrong with times 510-($-$$) db 0 . It seems

Turbo assembler language cursor position, offset

我怕爱的太早我们不能终老 提交于 2020-01-11 11:17:10
问题 We have given an instruction to make the the text CSC 112.1 to be centered. I used DB instruction and offset. This is my code .model small .stack .data c db 10,13,10,13," лллл ",10,13 db " лллллл ",10,13 db "лл лл",10,13 db "лл ",10,13 db "лл ",10,13 db "лл ",10,13 db "лл ",10,13 db "лл ",10,13 db "лл ",10,13 db "лл лл",10,13 db " лллллл ",10,13 db " лллл ",10,13,"$" .code mov ax,@data mov ds,ax call ccall ;call the procedure ccall which outputs C call scall ;call the procedure scall which

How to use local labels in procedures 8086 assembler?

╄→尐↘猪︶ㄣ 提交于 2020-01-07 07:47:17
问题 I wrote simple .MODEL small .STACK 100h .DATA liczba dw 0h licznik dw 0 potega dw 1 liczbaString dw ? buff db 26 .CODE Program: mov ax, @DATA mov ds, ax call PobierzString call PetlaIteracjiZnaku ;zwraca do ax pobraną liczbę PetlaIteracjiZnaku PROC mov si, liczbaString call ZnajdzDlugoscString mov si, liczbaString add si, 2 mov bl, 1 petla: xor ax, ax mov al, [si] cmp al, 24h; sprawdza czy nie jest koniec wprowadzanej liczby '$' je return sub al, 30h ; odejmuję 30 żeby zamienić znak na liczbę

Tracing a NCR assembly program of MASM

岁酱吖の 提交于 2020-01-06 03:55:23
问题 I missed the session when our lecturer explained it.. I know the formulae for NCR NCR = N! / (R! * (N-R)!) I am not following the NCR PROC , as no factorial is found, and some creepy recursive jobs are being done there. Help would be really appreciated. print macro str lea dx,msg mov ah,09h int 21h endm .model small .data n dw 15 r dw 6 ncr dw 1 msg db "The NCR is : ","$" .code start: mov ax,@data mov ds,ax mov bx,n mov cx,r inc bx call ncr1 print msg mov ax,ncr call display mov ah,4ch int

Drawing directly by graphics card on Intel 8086

佐手、 提交于 2020-01-06 03:26:06
问题 I am to draw some shapes under Intel 8086 without using interrupts but rather by directly accessing the graphics card. The problem is, I don't know how performing such operations is called so I can't even google anything on it. All I know is that this "mode" works on 80x25 resolution and is located on b800h in the memory. I tried googling "8086 graphics mode", "8086 text mode", "drawing without interrupts" and such but no hits whatsoever. Could you please tell me how such drawing is called so

Unable to reverse string in 8086 MASM

大憨熊 提交于 2020-01-06 02:54:10
问题 I've written some 8086 assembly code to reverse a string. I'm relatively new to assembly so please bear with me. The logic is that I define a string called 'str1'. I move this into the SI Register. Suppose string 'str1' is "Hello$" , then I load the address of 'str1'+5 into SI . Now, I load an address, say 5000 into DI . And I load each character from SI into DI and everytime I increment SI and decrement SI till 5 times. Here is the code assume cs:code,ds:data data segment str db "Hello$"

Can someone help me with segmentation and 8086 intel's microprocessor?

独自空忆成欢 提交于 2020-01-05 05:09:12
问题 I am reading about the architecture of intel's 8086 and can't figure out the following things about segmentation: I know that segment registers point to segments respectively and contain the base address of a 64kb long segment. But who calculates and in which point sets the physical address in the segment registers? Also, because one physical address can be accessed by multiple segment:offset pairs and segments can overlap, how you can be sure that you won't overwrite something? Where I can

How to switch between multiple data segments in 8086 assembly?

被刻印的时光 ゝ 提交于 2020-01-05 04:18:04
问题 I'm programming using MASM 6.11 on an old Windows 95 laptop, and I'm having a problem switching between data segments. For the sake of organization I wanted to use a different data segment to hold all of the variables that are only used by my macros. That different data segment is also placed inside the macro file. I thought I could specify a different data segment by just MOV ing the new segment into DS, but that doesn't seem to be working. I get the following error repeated many times upon

Faster keyboard scan code detection in 8086 assembly

心不动则不痛 提交于 2020-01-05 03:31:29
问题 Is it possible to detect and collect keyboard makes and brakes faster than just reading from hardware port 60h? Whenever I press a key, let's say the 'W' key, then very quickly press another key, the break code for the 'W' key is still returned by port 60h. In the game i am writing, this has the effect of locking the player sprite in place when a user tries to quickly change direction. I have tried using int 16h function 01h along with int 16h function 00, but it's very choppy and slow

Writing a string to a file 100 times in assembly

主宰稳场 提交于 2020-01-02 14:03:21
问题 I am having trouble printing "I WIN!" to a file 100 times. I can get it to print but it prints with garble can someone please point out what I am doing wrong? I need the code to print without any garble with "I WIN!" one after the other. .model small .stack 100h .data handle dw ? filename db "myfile.txt", 0 prompt1 db "ENTER FILE NAME HERE: $" mess1 db ' I WIN! $' .code main: mov ax, @data ; set up addressability of data mov ds, ax lea dx, prompt1 ; load and print the string PROMPT mov ah, 9