Pentium question 
Author Message
 Pentium question

Hi,

I am currently trying to understand the idiosyncrocies of the Pentium,
after having previously worked only  on the Motorola chips.

What I am not sure of is why the test program below will run if only
one of the strings is present, whereas with two strings it crashes,
halting the machine.

I am assembling using a86 and running on a PII with Win 98 in a dos
shell, (and after that failed, in dos.)

Any comments would be helpful, I am guessing that I am not quite
correct in syntax. I would also be curious to see if it compiles on
other machines?

Thanks in advance

David

; Listing 1: 1STPROG.ASM

; This is a simple program which displays "Hello World!"
; on the screen.

        .model small

        .stack

        .data

Mess1 db 'Hello World!$'        ; message to be display
Mess2  db 'Bye World$'          ; if this line is added and the
                                ; program reassembled, when run
                                ; the system will halt.

        .code
        .startup

        mov dx,OFFSET Mess1     ; offset of Message is in DX
        mov ax,SEG Mess1        ; segment of Message is in AX
        mov ds,ax                       ; DS:DX points to string
        mov ah,9                        ; function 9 - display string
        int 21h                                 ; call dos service
        mov ax,4c00h                    ; return to dos DOS
        int 21h
        END start                            ;end here



Wed, 26 Sep 2001 03:00:00 GMT  
 Pentium question

Quote:
>        .model small
>        .stack

You might try adding a number after .stack so that you actually have a stack.
Try ".stack 100h" to give it a size.

Quote:
>        .data

>Mess1 db 'Hello World!$'            ; message to be display
>Mess2  db 'Bye World$'              ; if this line is added and the
>                            ; program reassembled, when run
>                            ; the system will halt.

>        .code
>        .startup

>        mov dx,OFFSET Mess1         ; offset of Message is in DX
>        mov ax,SEG Mess1            ; segment of Message is in AX
>        mov ds,ax                           ; DS:DX points to string
>        mov ah,9                            ; function 9 - display string
>        int 21h                             ; call dos service
>        mov ax,4c00h                ; return to dos DOS
>        int 21h
>        END start                        ;end here

I don't really approve of ".startup" ... but it looks fine other than that
.stack thing.

  - vulture a.k.a. Sean Stanek



Wed, 26 Sep 2001 03:00:00 GMT  
 Pentium question
I'm not a fan of A86, but I have a copy of the shareware so...

I looked, then assembled.

If assembled like this:

a86 ?.asm ?.obj
tlink ?

it works fine...it is an EXE

if like this:

a86 ?.asm ?.com

it does weird stuff (hundreds of NOPS with data at the end, causing an
invalid opcode...
crashing the computer in DOS and closing in windows.

to solve this problem, I have modified the program...so it works if
"commed"...
mods are marked with a *

Quote:
>         .model tiny           *-small to tiny...
>         .code

>         mov dx,OFFSET Mess1  ; offset of Message is in DX
>         mov ah,9               ; function 9 - display string
>         int 21h                 ; call dos service
>         mov ax,4c00h            ; return to dos DOS
>         int 21h
>         .data    *data moved to end

> Mess1 db 'Hello World!$'      ; message to be display
> Mess2  db 'Bye World$' ; if this line is added and the
> ; program reassembled, when run
> ; the system will halt.

>         END

stack is gone, so is entry point, as .coms don't need this...
segments all point at the right place already...

----------
Ian Scott...

www.geocities.com/SiliconValley/Hills/5938/
Nerf be with you!



Thu, 27 Sep 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. pentium question

2. Pentium question - prefix decoding

3. Comparative perf of Pentium/Pentium II under J?

4. Pentium 3 vs Pentium 4 benchmarks

5. Pentium/Pentium II asm ?

6. Pentium & Pentium II specs

7. Pentium & Pentium II spec

8. RDTSC on Pentium and Pentium Pro for Timing Accuracy

9. Pentium/Pentium Pro simulator

10. Pentium/Pentium Pro simulator

11. Pentium Pro & Pentium II instruction decomposition (uops)

12. Optimized Pentium code on a Pentium Pro

 

 
Powered by phpBB® Forum Software