...What the hell is wrong with this code? Anybody... 
Author Message
 ...What the hell is wrong with this code? Anybody...

;Can anyone tell my why this won't compile? I'm using TASM 3.1...
;It's a procedure to reboot (cold boot) the system -- it works when I use
;MS_DEBUG, but I have no clue why TASM won't accept it...
;Thanks again!

.model small
.stack
.data
.code
.startup

        mov ax, 40
        mov ds, ax
        mov ax, 0000
        mov [72], ax
        jmp ffff:0
        end

;Nao



Sun, 20 Dec 1998 03:00:00 GMT  
 ...What the hell is wrong with this code? Anybody...

Quote:


>Subject: ...What the hell is wrong with this code? Anybody...
>Date: 3 Jul 1996 05:38:10 GMT
>;Can anyone tell my why this won't compile? I'm using TASM 3.1...
>;It's a procedure to reboot (cold boot) the system -- it works when I use
>;MS_DEBUG, but I have no clue why TASM won't accept it...

Instead of crying 'hell' you could have RTFM. Trying a 'tasm /?' gives you:
----
Syntax:  TASM [options] source [,object] [,listing] [,xref]
/z            Display source line with error message
----

And when you run TASM with your newly obtained knowledge, TASM tells you
exactly what is the problem:
----
Assembling file:   test.asm
        mov [72], ax
**Error** test.asm(10) Illegal immediate
        jmp ffff:0
**Error** test.asm(11) Undefined symbol: FFFF
----

So perhaps you should change the first line to 'mov word ptr [072h], ax' and
the second line to 'jmp far 0ffffh:0'.

By the way, I am not sure whether jmp will work. If not, you could change it
to its hexadecimal representation. Something with 0eah, <address> in this
case.

Quote:
>;Thanks again!

Hope this helps.

Regards,

Wimjan

--
+---------------------------+--------------------------------------------+
| Wimjan Jansen van de Laak |  If you hate a person, you hate something  |
| Flanorpad 2c              |     in him that is part of yourself.       |
| 2333 AN Leiden, Holland   |       What is not part of ourselves        |
| tel. +31-(0)71-5172177    |           doesn't disturb us.              |
+---------------------------+--------------------------------------------+



Sun, 20 Dec 1998 03:00:00 GMT  
 ...What the hell is wrong with this code? Anybody...

Quote:

> ;Can anyone tell my why this won't compile? I'm using TASM 3.1...
> ;It's a procedure to reboot (cold boot) the system -- it works when I use
> ;MS_DEBUG, but I have no clue why TASM won't accept it...
> ;Thanks again!

> .model small
> .stack
> .data
> .code
> .startup

>         mov ax, 40
>         mov ds, ax
>         mov ax, 0000
>         mov [72], ax
>         jmp ffff:0
>         end

I do not use TASM but in MASM you have to specify hexidecimal by adding
an 'h' at the end of the constant and if the hexidecimal constant begins
with a alpha digit, the constant must be preceded with a zero.  So try:

        mov     0ffffh:0

Hope that this helps.

Ray

=====================================================================
Ray Moon

http://www2.dgsys.com/~raymoon/moonware.html
Home of MoonWare Shareware and the x86 Assembly Language FAQ
Come steal my pages...   Well, not steal but come and see!



Sun, 20 Dec 1998 03:00:00 GMT  
 ...What the hell is wrong with this code? Anybody...

Quote:

>;Can anyone tell my why this won't compile? I'm using TASM 3.1...
>;It's a procedure to reboot (cold boot) the system -- it works when I use
>;MS_DEBUG, but I have no clue why TASM won't accept it...
>;Thanks again!

>.model small
>.stack
>.data
>.code
>.startup

>        mov ax, 40
>        mov ds, ax
>        mov ax, 0000
>        mov [72], ax
>        jmp ffff:0
>        end

Not at all sure about this - but try it without the ".startup"

--
Best wishes,
Mervyn Baldwin.



Sun, 20 Dec 1998 03:00:00 GMT  
 ...What the hell is wrong with this code? Anybody...

Quote:

> ;Can anyone tell my why this won't compile? I'm using TASM 3.1...
> ;It's a procedure to reboot (cold boot) the system -- it works when I use
> ;MS_DEBUG, but I have no clue why TASM won't accept it...
> ;Thanks again!

> .model small
> .stack
> .data
> .code
> .startup

>    mov ax, 40
>    mov ds, ax
>    mov ax, 0000
>    mov [72], ax
>    jmp ffff:0
>    end

TASM (and MASM, for that matter) won't accept an immediate constant as a
jump target, so "jmp ffff:0" won't work.  (Even if it did, you'd need to
change that to "jmp 0FFFFh:0" and add an "h" to all your other numbers -
the "0" prefix lets the assembler know it's a number, not a name, and the
"h" sufffix tells it it's hexadecimal.  Debug doesn't need these because
it doesn't use symbolic names, and it only understands hex.)

The proper way to specify a jump to an absolute address is to define the
target location as an address in an absolute segment:

BIOS_SEG        segment at 0FFFFh
        org     0
Reboot          label far
BIOS_SEG        ends

...and then, in your code segment, jump to that named target:

        jmp     Reboot

This not only satisfies the assembler, but is good practice generally -
always avoid using "magic number" constants whenever possible.

Two further notes:  You'd be better off using 0F000h:0FFF0h as the target
address.  This is the same physical address, but it assures compatibility
with 286 and later BIOSes that perform near jumps (which don't reload CS)
and expect CS to have the value 0F000h (since that's what a 286+ processor
reset loads).  Such BIOSes are rare, but they do exist.

Also, you should be aware that the above technique may cause disk
corruption if the user is running a write-behind disk cache, and may not
work in some protected-mode environments, including Windows DOS boxes,
OS/2 DOS boxes, some V86-mode EMS emulator/UMB providers, and some
shadowed BIOS setups.

For further details, see both the FAQ for this newsgroup and for
comp.os.msdos.programmer.

---
Glen Blankenship




Tue, 22 Dec 1998 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Where am I wrong?(this has to be wrong, it can't be so simple)

2. I am in quoting hell

3. what the hell is wrong here??

4. what the hell i'm doing wrong?

5. Anybody know why I am timing out

6. Anybody see what's wrong here?

7. can anybody help me wht's wrong in my program

8. What am I doing wrong!

9. What am I doing wrong?

10. Stupid newb question: What am I doing wrong?

11. What am I doing Wrong

12. what am i doing wrong

 

 
Powered by phpBB® Forum Software