|
From: Mel Smith on 21 Apr 2008 21:20 Dear Friends: I'm an application programmer (in an xBase language called xHarbour -- a superset of Clipper ) I have a very old assembly language file (named treal.asm) circa 1991. I need to assemble this file with MASM32 (which I have on my machine). I propose assembling this file with the command: ML /c treal.asm Then I'll link in the resulting object module (treal.obj) with the remainder of my modules. *But*, when I try to assemble this file (which is shown below), I get masses of errors (Segment, etc) Can somebody please correct the old usage below, so that it will assemble ?? TIA, -Mel Smith *************** the code is below *********** IDEAL WARN EXTRN __parc:FAR, __parnd:FAR, __retclen:FAR, __retnd:FAR SEGMENT _prog DWORD 'CODE' ASSUME cs:_prog, ds:nothing, es:nothing ;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;; ;; ;; Syntax: string-10 := l_dtot( <number> ) ;; ;; Purpose: Converts an IEEE 8 byte into an IEEE 10 byte real. ;; ;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;; PUBLIC l_dtot PROC l_dtot FAR push bp mov bp, sp xor ax, ax ; Push a 0 TREAL onto the stack. push ax push ax push ax push ax push ax inc ax ; Get the address of our double. push ax call __parnd pop bx mov bx, sp ; Base address of TREAL. mov cx, 10 ; Setup return logic for __retclen. push cx push ss push bx push ds ; Save what we mangle... push si push di mov ds, dx ; Return from __parnd is source. mov si, ax push ds ; Test for 0. pop es mov di, si xor ax, ax mov cx, 4 rep scasw je @@skip push ss ; Stack is destination. pop es mov di, bx ;; ;; This next step is kinda kludgy. The mantissa of an 8-IEEE is shifted ;; 4 bits from the 10-IEEE. But the assumed 1.0 of an 8-IEEE isn't in ;; the 10-IEEE. That means that we end up with a 3-bit shift and an ;; explicit 1 bit added (except for 0). ;; mov cl, 5 xor ax, ax ; LSB will always be 0. First 3 bits stosb ; of next nibble will also be 0. REPT 6 lodsb rol ax, 1 rol ax, 1 rol ax, 1 stosb shl ah, cl ENDM lodsb ; Special processing for last byte to rol ax, 1 ; keep the start of the mantissa out rol ax, 1 ; of it. rol ax, 1 rol ax, 1 stc rcr al, 1 stosb ;; ;; We have the LS-nibble of the exponent in AH now. Load the rest ;; (including the sign), change the bias from 1023 (QUAD) to 16383 ;; (TREAL), and store it all... ;; lodsb mov bh, al ; Save sign bit. dec cl shl ah, cl rol ax, cl and ah, 07h add ax, 16383d - 1023d and bh, 80h ; Move in sign. or ah, bh stosw @@skip: pop di ; Restore mangled registers. pop si pop ds call __retclen ; Make our call and return. mov sp, bp pop bp ret ENDP
From: Rod Pemberton on 22 Apr 2008 02:40 "Mel Smith" <medsyntel(a)aol.com> wrote in message news:674squF2mri9nU1(a)mid.individual.net... > I'm an application programmer (in an xBase language called xHarbour -- a > superset of Clipper ) > I have a very old assembly language file (named treal.asm) circa 1991. > I need to assemble this file with MASM32 (which I have on my machine). > I propose assembling this file with the command: > ML /c treal.asm > Then I'll link in the resulting object module (treal.obj) with the > remainder of my modules. > *But*, when I try to assemble this file (which is shown below), I get > masses of errors (Segment, etc) > Can somebody please correct the old usage below, so that it will > assemble ?? > <code snipped> Are you sure it's not TASM's ideal mode? It looks like it is, to me anyway: MASM vs. TASM http://www.ddj.com/184408073 If you add these two lines to the end of the posted code: ENDS END It compiles to an .obj with TASM without warning: tasm treal.asm Do you still need it to work with MASM? Rod Pemberton
From: Mel Smith on 22 Apr 2008 11:05 Rod said: > Are you sure it's not TASM's ideal mode? It looks like it is, to me > anyway: > > MASM vs. TASM > http://www.ddj.com/184408073 > > If you add these two lines to the end of the posted code: > > ENDS > END > > It compiles to an .obj with TASM without warning: > > tasm treal.asm > > Do you still need it to work with MASM? Rod: Thank you ! I looked over my machine, and I found a tasm.zip file which contained tasm32.exe. I used the following command to compile the treal.asm as follows: TASM32 treal.asm It worked perfectly, and I now have an object file with no warnings and no errors ! So, I guess I don't need MASM at all. (btw, the missing statements (ENDS and END) were my own Clipboard cut/paste fault) So, I'm 'good-to-go' :)) Thanks again for the great help you provided ! -Mel Smith (freezing in Edmonton, Canada)
|
Pages: 1 Prev: OT: Has anyone seen Miss Liberty? Next: Code performance, rdtsc and code alignment |