News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

who do i assemble the file?

Started by xandaz, March 11, 2012, 11:37:52 PM

Previous topic - Next topic

xandaz

    How the heck does it work? There's always some minor error that prevents the assemble. WinMainCRTStartUp or start needs a leading _ or whatever. Can someone help?

mineiro

You need do minor changes in your source:
Move ".586" below ".model tiny"
Move "start:" below "org 100h"
Change "end" to "end start"

to assemble it and link:
ml /c /AT compare.asm
link16 /tiny compare.obj;

you can link this way too:
link16 /tiny compare.obj,compare.com,,,,

dedndave

i don't seem to need the /AT switch - not sure what that does - lol
i just used this...
ml /c compare.asm
link16 /tiny compare.obj

one important thing you are missing is a reference to the label at 100h in the END directive
in the past, when i have written tiny model programs, i have always placed the data at the end of the program

rules for tiny model
1) all program and data must be in a single segment (64 kb, less 256 bytes for the PSP)
2) the program must begin execution at 100h for .COM files, or 0 for .SYS or .BIN files
3) there must be no stack segment

i did notice that you use .586, and have no instructions requiring it
that means that 32-bit register use is enabled and the program is loaded with size overrides   :P
by commenting that line out, the default processor is 8086
not only is the program 17 bytes smaller, but the old debuggers handle the code   :U

        .586
        .MODEL  Tiny
        OPTION  CaseMap:None

;#######################################################################

        .CODE

;***********************************************************************

        ORG     100h

_main   PROC    NEAR

        call    Cmpr
        int     20h

_main   ENDP

;***********************************************************************

Cmpr    PROC    NEAR

        lea     si,strg
        mov     cx,sizeof strg
        mov     ax,'sw'
        mov     dx,'ws'

loop_1: cmp     ax,word ptr [si]
        jnz     next_1

        inc     ct1
        jmp short skip_1

next_1: cmp     dx,word ptr [si]
        jnz     skip_1

        inc     ct2

skip_1: inc     si
        loop    loop_1

        ret

Cmpr    ENDP

;#######################################################################

strg    db 'abswtwstswegjnwshsw'
ct1     db 0
ct2     db 0

;#######################################################################

        END     _main

dedndave

C:\DOCUME~1\Dave\Desktop\compare>symdeb compare.com
Microsoft (R) Symbolic Debug Utility  Version 4.00
Copyright (C) Microsoft Corp 1984, 1985.  All rights reserved.

Processor is [80286]
-u 100 127
0EAF:0100 E80200         CALL   0105
0EAF:0103 CD20           INT    20
0EAF:0105 8D362801       LEA    SI,[0128]
0EAF:0109 B91300         MOV    CX,0013
0EAF:010C B87773         MOV    AX,7377
0EAF:010F BA7377         MOV    DX,7773
0EAF:0112 3B04           CMP    AX,[SI]
0EAF:0114 7506           JNZ    011C
0EAF:0116 FE063B01       INC    Byte Ptr [013B]
0EAF:011A EB08           JMP    0124
0EAF:011C 3B14           CMP    DX,[SI]
0EAF:011E 7504           JNZ    0124
0EAF:0120 FE063C01       INC    Byte Ptr [013C]
0EAF:0124 46             INC    SI
0EAF:0125 E2EB           LOOP   0112
0EAF:0127 C3             RET
-d 128 13c
0EAF:0120                         -61 62 73 77 74 77 73 74          abswtwst
0EAF:0130  73 77 65 67 6A 6E 77 73-68 73 77 00 00           swegjnwshsw..
-g

Program terminated normally (0)
-d 128 13c
0EAF:0120                         -61 62 73 77 74 77 73 74          abswtwst
0EAF:0130  73 77 65 67 6A 6E 77 73-68 73 77 02 03           swegjnwshsw..
-q

xandaz

   Late thanks. I've been away for a while. No internet here.
   Later