MASM

Cube root on x87 FPU using Newton-Raphson method

纵饮孤独 提交于 2019-12-31 02:18:25
问题 I am trying to write an assembly program using the 8086 processor that will find the cube root of a number. Obviously I am using floating points. Algorithm based upon Newton-Raphson method: root := 1.0; repeat oldRoot := root; root := (2.0*root + x/(root*root)) / 3.0 until ( |root – oldRoot| < 0.001; How do I divide (2*root + x) by (root*root)? .586 .MODEL FLAT .STACK 4096 .DATA root REAL4 1.0 oldRoot REAL4 2.0 Two REAL4 2.0 inttwo DWORD 2 itThree DWORD 3 three REAL4 3.0 x DOWRD 27 .CODE main

How can i make 10000,1000,100 from 10 the easiest way

一笑奈何 提交于 2019-12-29 09:41:11
问题 i am looking for a solution for the question abowe. I need to generate 100,1000 and 10000(decimal numbers). Because the whole exercise is to caluclate: 10000*X+1000*Y+100*Y+10*V+1*C I know i can do it by the mul command,but in that case i have to work a lot with stack. I was thinking some kind of Shifting, but don't know how to do it with decimal numbers. With binary numbers mov al,2h;mov al,10b; shl al,1 Preferebla is masm enviroment.Thank you for your help Update1: I dont want to use mul

move large register into small memory

喜夏-厌秋 提交于 2019-12-25 21:36:05
问题 I have a little problem understanding PTR Operator, I can easily move large memory into small register example below: ax = small register which is 2 byte memory = variable which is 4 byte .data variable dword 05010h .code mov ax,WORD PTR variable It will works fine. Now my problem is I don't understand why I can't move large register like eax into a small memory variable which is 2 byte? Example: .data variable word ? .code mov eax, 01050h mov variable, word ptr eax It's says: Error invalid

Does MASM assembling multiple source files and linking them together?

泪湿孤枕 提交于 2019-12-25 07:13:24
问题 I was trying to see if asm language support function based linked like "C" language. E.g. I have got "m.asm": assume cs:code code segment start: mov ax,20h call s mov ah,4ch int 21h code ends end start In which "s" is a symbol not existing in the source code, then I've got n.asm file to define a symbol (a label in fact) code segment s: mov bx,4h div bx code ends In fact m.asm fails to compile, telling me that "s" is a symbol not defined. How can I resolve this problem and meet my request? 回答1

Sort contents of array in assembly

依然范特西╮ 提交于 2019-12-25 05:03:32
问题 I am working on an assignment where the user enters the number of values they will input in to an array inputs that amount of numbers. After all of this however I need to do a bubble sort that will put the inputted numbers in the array from smallest to biggest. The confusing part is that it says "the inner loop of the bubble sort is to be in a procedure". I'm not even sure where to begin on how to do this let alone creating inner and outer loops. All of the examples that I have found online

What are the technical mechanics and operation of declaring variables in 32-bit MASM?

主宰稳场 提交于 2019-12-24 18:35:02
问题 Using 32 bit MASM assembly with the MASM version 11 SDK, I discovered an error during compiling. The error pointed to the line where I declared a variable with a double-word (dd) size. The message said the variable was too small for the string I tried to assign to it. When I defined my variable as a byte instead (db) the program was compiled with no error. This implied that declaring a variable with the db instruction could allow more storage than declaring a double-data size. Below is the

hexadecimal values in masm starting with a letter [duplicate]

空扰寡人 提交于 2019-12-24 10:48:02
问题 This question already has answers here : How to represent hex value such as FFFFFFBB in x86 assembly programming? (4 answers) Closed last year . Do hexadecimal values in masm have to start with a number? If I use .const _mmx_cons QWORD f000000000000000h I get a build error : test.asm(26): error A2006: undefined symbol : f000000000000000h But if I add a leading 0 .const _mmx_cons QWORD 0f000000000000000h The error vanish. Why is that? Am I sure that it represents the 64 bit value

MASM x86 fastcall function declaration… how?

孤街醉人 提交于 2019-12-24 10:38:59
问题 I'm trying to make a VisualStudio 2010 C program call a fastcall convention assembly routine. This is the declaration in the C code: extern boolean _fastcall InNonSuspendableCriticalRegion(DWORD); This is the declaration in the assembly code: public @InNonSuspendableCriticalRegion@4 @InNonSuspendableCriticalRegion@4 proc near ; fastcall <code> @InNonSuspendableCriticalRegion@4 endp I get the following linker error: Assembling: C:\DMS\Domains\PARLANSE\Tools\RunTimeSystem\Source\PARLANSE0.asm 1

SendMessage lParam empty

一个人想着一个人 提交于 2019-12-24 08:24:38
问题 I am trying to store a value in the lParam of a LV_ITEM: ;... mov eax, value mov lvi.lParam, eax invoke SendMessage, hList, LVM_INSERTITEM, 0 addr lvi lvi is a (LOCAL) LV_ITEM, and hList is the handle of my ListView Control. If this item is now clicked, i try to read it's value: invoke SendMessage,hList,LVM_GETNEXTITEM,-1,LVNI_FOCUSED mov lvi.iItem, eax mov lvi.iSubItem, 0 mov lvi.imask, LVIF_TEXT mov lvi.cchTextMax,256 invoke SendMessage,hList,LVM_GETITEM, 0, addr lvi Again lvi is a (LOCAL)

Printing star triangle in assembly

元气小坏坏 提交于 2019-12-24 07:28:04
问题 I'm trying to print a triangle like this: in assembly. The formula to find the number of stars in each row is: 2 * x + 1. Here is my code so far. I seem to be looping infinitely. .data prompt BYTE "Please enter the number of rows in the pyramid: ", 0 numRows DWORD ? count DWORD 0 .code main PROC mov edx, OFFSET prompt call WriteString call ReadInt mov numRows,eax mov ecx,numRows + 1 ; Let ecx = numRows + 1 L1: inc count ; Increment count mov eax,ecx L2: sub eax,count ; eax = eax - count mov