nasm

How to install a specific version of NASM on MacOS

杀马特。学长 韩版系。学妹 提交于 2019-12-24 10:40:43
问题 I got NASM for MacOS from http://www.nasm.us/pub/nasm/releasebuilds/2.11.06/macosx/ How to do I install this specific version of NASM? I know that I can do a brew install nasm . But I dont want the latest version. I want to install NASM 2.11.06 for MacOS. How should I install the nasm-2.11.06-macosx.zip that I have downloaded? Environment: I am running MacOS Sierra . 回答1: All you would need to do is: Unpack the zip file Update your PATH statement to include the location you unzipped 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

Message while debugging using gdb: Single stepping until exit from function _start

人走茶凉 提交于 2019-12-24 07:58:29
问题 I am writing assembly language program using nasm on linux. The problem is during debugging using gdb it does not step inside the _start function and gives the message "Single stepping until exit from function _start," Also, when I set break points after line 1 it says: (gdb) break 2 Note: breakpoints 1 and 2 also set at pc 0x4000b0. Breakpoint 3 at 0x4000b0: file new3.asm, line 2. (gdb) break 3 Note: breakpoints 1, 2 and 3 also set at pc 0x4000b0. Breakpoint 4 at 0x4000b0: file new3.asm,

x86 ASM: DD Being Used as an “Instruction”?

非 Y 不嫁゛ 提交于 2019-12-24 07:49:43
问题 In the following x86 assembly code: dd 0x1BADB002 dd 0x00 dd - (0x1BADB002+0x00) The values don't seem to be assigned to any variables. So what does this snippet of code do? I've heard something about it being stored in memory, but where exactly? 回答1: dd is a "pseudo-instruction" that assembles 4-byte constants into the output, the same way that add eax,eax assembles 0x01 0xc0 into the output. The NASM manual section 3.2 Pseudo-Instructions describes db / dw / dd and so on. In this case, as

Parity of a number (Assembly) [duplicate]

天大地大妈咪最大 提交于 2019-12-24 07:49:10
问题 This question already has answers here : Parity of a number (Assembly 8086) (5 answers) Closed 2 years ago . So I'm trying to separate an octet by parity and I don't quite understand how the conditional jumps work(I tried it separately and I don't understand how it works it) Here is what I came up with: bits 32 global start extern exit,printf import exit msvcrt.dll import printf msvcrt.dll segment data use32 class=data s db '1', '2', '3', '4','5','7','8','9' ; declararea sirului initial s l

(nasm x86 real mode) How to write/read strings in boot-loaded sector?

旧街凉风 提交于 2019-12-24 05:38:12
问题 I'm using NASM to write a minimal OS for x86 real mode for educational purposes. I want to use the 512-byte boot sector to load a larger sector that contains the rest of the OS. I've successfully created a boot sector that loads another sector, but I cannot seem to write/read strings within the loaded sector. Here is my code: bits 16 mov ax, 0x7c0 mov ds, ax jmp code ;; Write bootStr to boot sector. bootStr db "AAA" code: ;; for int 0x10 mov ah, 0x0e ;; Print first char of bootStr. mov di,

Efficient Assembly multiplication

╄→гoц情女王★ 提交于 2019-12-24 05:20:32
问题 Started to practice assembly, not too long ago. I want to implement an efficient multiplying through assembly commands lea and shift. I want to write a c program that will call an assembly procedure that fits an constant argument recieved by the user and will multiply another argument recieved by the user by that constant. How can I make this code effective? What numbers can I group (if any) to fit the same procedure? for example I think that I can group 2,4,8,... to the same procedure as

What does this Descriptor's init do?

a 夏天 提交于 2019-12-24 04:53:10
问题 %macro Descriptor 3 dw %2 & 0FFFFh dw %1 & 0FFFFh db (%1 >> 16) & 0FFh dw ((%2 >> 8) & 0F00h) | (%3 & 0F0FFh) db (%1 >> 24) & 0FFh %endmacro ; LABEL_DESC_DATA: Descriptor 0, DataLen-1, 92h the things above are the definition. here are the questions about its init: xor eax, eax mov ax, ds shl eax, 4 add eax, LABEL_DATA mov word [LABEL_DESC_DATA + 2], ax ;what happens in this instruction? shr eax, 16 mov byte [LABEL_DESC_DATA + 4], al mov byte [LABEL_DESC_DATA + 7], ah 回答1: This macro

Assembly (NASM) How to do Numerical operations

谁说我不能喝 提交于 2019-12-24 04:09:15
问题 I programmed a lot in java and know the basics of python and sometimes I play with c++... And those are all High Level Programming Languages and they're great and all but I was curious about how things worked at a deeper level in this case assembly language... I started to learn assembly for the x86 processor and chose NASM as my assembler. I spent some time learning how registers and the stack work, how the information is stored and how the information can be changed , not just reading but

I/O in NASM programs in Windows 7

倾然丶 夕夏残阳落幕 提交于 2019-12-24 04:05:09
问题 I want to program in NASM assembly language. I have NASM 2.07 and Borland C++ compiler 5.0 (bcc32). My OS is Windows 7. I do not know how to do input and output with NASM in Windows platform. Please can you help me? 回答1: If you are this new to NASM, I would suggest not using Borland C++ 5.0. I have a toolkit on my website here that is a complete tool-chain for win32 programming. You modify main.asm, and run make.bat to compile and link it. It doesn't get any easier than this. The package