News:

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

problem with masm

Started by ninjarider, September 07, 2005, 05:25:34 PM

Previous topic - Next topic

ninjarider

y did u ask that about about subverting windows? do u agree or disagree with people of those views?

P1

Quote from: ninjarider on September 09, 2005, 07:42:09 PM
y did u ask that about about subverting windows?
I was interested in your need to get some experince in boot code.  I was hoping it was not to build a boot root kit.  Like the example I quoted.  We are having this discussion because I was sure you were not doing that, otherwise I would have locked this topic and asked you to PM me.  But for those that will read this and be alert to that we know that some new member will try this and get shot down before it gets very far.
Quote from: ninjarider on September 09, 2005, 07:42:09 PM
do u agree or disagree with people of those views?
I agree, that it is possible.  I agree, that it will in the near future become a serious security threat.  A round of boot sector viruses will be renewed.  With a new level of technology to hide from the AV's that run in the OSes that they protect.  The social engineering will be propagated on copied/shared CDs from system to system with traditional techniques as well.

Regards,  P1  :8)

ninjarider

is there any way using masm to assemble files while the computer is in dos mode, no windows overhead.

(edit)
also
im trying to access a byte in memory at address 0040h:0017:
its suppose to be the keyboard status byte.
i've tried using this

mov ds, 0040h
mov di, 0017h

mov dl, ds:di

i've also tried using
mov dl, byte ptr[ds:di]

with either or masm complains about improper use of registers

P1

Quote from: ninjarider on September 12, 2005, 03:09:30 PM
is there any way using masm to assemble files while the computer is in dos mode, no windows overhead.
The old way, we did MASM.  Did you make a set of batch files using link16 or link563, depending on who was giving you advise?  They should work in DOS mode just fine.   How familar are you with DOS bath files?   What are you using as a line Editor in DOS mode?
Quote from: ninjarider on September 12, 2005, 03:09:30 PM
im trying to access a byte in memory at address 0040h:0017:
Should be:
mov ax, 040h
mov ds, ax
mov al, ds:[017h]  ;DS override

Regards,  P1  :8)

ninjarider

Microsoft(R) Windows 98
   (C)Copyright Microsoft Corp 1981- 1999.

C:\WINDOWS>cd\masm32

C:\MASM32>bin\ml /c 16.asm
This program cannot be run in DOS mode.

C:\MASM32>bin\link16 /tiny 16.obj
This program requires DOSXNT.EXE to be in your path

thats exactly what does does.
yes i am using link16. and i am using a batch file. my dos is a little rusty.

(edit)
not sure if my code is currect

mov ax, 0040h
mov ds, ax
mov di, 0017h

mov cl, ds:[di]
cmp cl, 0 -- compare to see if register = 0
mov dl, "0"
push cx

mov ah, 06h
int 21h

pop cx
cmp cl, 1 -- check to see if bit one is set
mov dl, "1"
push cx

mov ah, 06h
int 21h

Gustav


> is there any way using masm to assemble files while the computer is in dos mode, no windows overhead.

http://www.masmforum.com/simple/index.php?topic=2269.0

ninjarider

mov cx, 080h

mov dl, "0"
and cx, 070h
jne lbl1
mov dl, "1"

lbl1:
mov ah, 06h
int 21h

int 20h

is there a problem with this code that i dont see.
for some reason my computer still seems to print 1

MichaelW

JNE = JNZ
80h AND 70h = 0
If you want the jump condition to be a result of zero, you should use JZ.

eschew obfuscation

ninjarider

when accessing memory using segment: offset. is there a way to include a multiplier. or is that c / c++ that im thinking about.
something like ds : [di*4]
maybe im trying to learn to many programming languages

P1

Quote from: ninjarider on September 14, 2005, 02:30:10 PM
when accessing memory using segment: offset. is there a way to include a multiplier. or is that c / c++ that im thinking about.
something like ds : [di*4]
maybe im trying to learn to many programming languages
MOVS - Move String (Byte or Word)
        Usage:  MOVS    dest,src
                MOVSB
                MOVSW
                MOVSD  (386+)
        Modifies flags: None
        Copies data from addressed by DS:SI (even if operands are given) to
        the location ES:DI destination and updates SI and DI based on the
        size of the operand or instruction used.  SI and DI are incremented
        when the Direction Flag is cleared and decremented when the Direction

        Flag is Set.  Use with REP prefixes.
                                 Clocks                 Size
        Operands         808x  286   386   486          Bytes
        dest,src          18    5     7     7             1   (W88=26)

        A4 MOVS m8, m8 Move byte at address DS:(E)SI to address ES:(E)DI
        A5 MOVS m16, m16 Move word at address DS:(E)SI to address ES:(E)DI

        A5 MOVS m32, m32 Move doubleword at address DS:(E)SI to address ES:(E)DI
        A4 MOVSB Move byte at address DS:(E)SI to address ES:(E)DI
        A5 MOVSW Move word at address DS:(E)SI to address ES:(E)DI
        A5 MOVSD Move doubleword at address DS:(E)SI to address ES:(E)DI


It appears to me your moving data.
Note: How SI/DI are incremented for you depending on the direction flag.

You may want to review assembly techniques from Art of Assembly by Randall Hyde.
http://webster.cs.ucr.edu/

Regards,  P1  :8)

ninjarider

#25

DOSSEG
.386
.MODEL SMALL
.STACK 200h
.code

org 07c00h
START:
jmp Begin
BD_OEMNAME DB "SMITH"
BS_BYTESPERSEC DW 512
BPB_SECPERCLUS DB 1
BPB_RSVDSECCNT DW 1
BPB_NUMFATS DB 2
BPB_ROOTENTCHT DW 224
BPB_TOTSEC16 DW 2880
BPB_MEDIAID DB 0F0H
BPB_FATSZ16 DW 9
BPB_SECPERTRK DW 18
BPB_NUMHEADS DW 2
BPB_HIDDSEC DD 0
BPB_TOTSEC32 DD 0

(the above was an atempt to keep the floppy compatable with windows but a tragic failure)
Begin:
xor ax, ax
mov ds, ax
mov es, ax

PrintStr:
mov esi, offset TEXT
mov ah, 0eh

StrLoop:
lodsb
test al, al
jz Begin
int 10h
jmp strloop

... a bunch of padding..
TEXT db "Tommy Smith", 10, 13, 0
BootSig dw 0aa55h
END START:

considering im using link16 and that for the most part everything else is 16bit code. y would ml and link16 (not sure which is to blame) would requir the esi instead of the si.
is there any explaination for this.

(edit) added all the code (/edit)

MichaelW

The code you posted is not complete so it is impossible to know exactly what you are doing. ESI would be required if the segment word size were set to USE32, in which case offset addresses would be 32-bit values instead of the 16-bit values that are normal for 16-bit code. The most likely cause of this would be that you placed a .386 or higher processor directive before the .MODEL directive instead of after it.

See "Setting Segment Word Sizes (80386/486 Only)" here:

http://webster.cs.ucr.edu/Page_TechDocs/MASMDoc/ProgrammersGuide/Chap_02.htm


eschew obfuscation

ninjarider


START:
xor ax, ax
int 16h - i might have the wrong interrupt but get keycode from keyboard

cmp al, 13
je Commandline

mov Letter, al
jmp START

Commandline
mov ah, 0eh
int 10h

mov al, 10
int 10h
jmp START

Letter db 0


the above code is suppose to get the keys pressed from the keyboard
if enter key is pressed then jump to CommandLine
and save the last key pressed

for some reason this code doesn't do what i expect it to do.

MichaelW

It's not clear to me what you are trying to do, but your calls to Interrupt 10h are not correct.

From Ralf Brown's Interrupt List:

INT 10 - VIDEO - TELETYPE OUTPUT
   AH = 0Eh
   AL = character to write
   BH = page number
   BL = foreground color (graphics modes only)
Return: nothing
Desc:   display a character on the screen, advancing the cursor and scrolling
     the screen as necessary
Notes:   characters 07h (BEL), 08h (BS), 0Ah (LF), and 0Dh (CR) are interpreted
     and do the expected things

An on-line HTML version of the Interrupt List is available here:

http://www.ctyme.com/rbrown.htm

eschew obfuscation

ninjarider

i can uderstand what your saying about the interuppt not looking right but theres a line i left out. concidering the laptop that has the code is at home and im at the office. anyways, its not the interrupts that im having a problem with its the cmp al, 13 and the je statments.

if i replace the cmp al, 13 and the je with xor al, 13 and je it will work like i expect. but the cmp statment wont. im not sure if its my hardware or what.