debugger

[b][red]This message was edited by IDK at 2005-11-3 10:22:34[/red][/b][hr]
Wich debugger do you use?

I need a 16-bit debugger that can debug com files I have tried TD, TD32 and OLLYDBG but I none of them can debug com files. I have heard of codeview and debug16, wich sounds prommesing but I don't know where to get them, I can't find them on the web.

I need it to debug fpu code...

this is the code I'm trying to debug...

movXY.inc:
[code]movXY:
rept 8 counter
{
fld dword [fx+counter*4-4] ;load x
fld dword [fy+counter*4-4] ;load y
fild word [playerdegree+counter*2-2] ;load degree's
fmul st,st4 ;playerdegree * pi/180 = playerRadians
fsincos ;sin and cos of st
;places sin in st and pushes cos in st
fwait
faddp st4,st ;st4=x, st4 = st + st4, pop st
faddp st2,st ;st2=y, st2 = st + st2, pop st
fld1
fadd st2,st
faddp st3,st

fist word [y+counter*2-2] ;store integer y
fstp dword [fy+counter*4-4] ;store float y
fist word [x+counter*2-2]
fstp dword [fx+counter*4-4]

fwait
}

fwait
ret


fpuInit:
finit ;clear all

xor bx,bx

rept 8 counter
{
fild word [x+counter*2-2]
fild word [y+counter*2-2]
fstp dword [fy+counter*4-4]
fstp dword [fx+counter*4-4]
}
;load pi/180 ;180 degrees = pi radians
fldpi ;load pi
fild word [f180] ;load 180
fdivp st1,st ;div pi/180 and place result in st1 and pop st
;wich gives, st=pi/180 and all else is empty
fwait

ret

f180: dw 180[/code]

movXY is called in the main loop of the program
fpuinit is called before the loops starts

I don't know what's wrong...
the program says that all x values is 128,000 wich I don't know why it is so...

this is actually the main program

nactil.asm:
[code]org 100h

main:
call fpuInit ;init the fpu, located in moveXY

mov ax, 0012h ;int 10h(0), video mode 12h, 640x480,
int 10h ;and at least 16 colors I hope...

;call randomizeXYAng

mainloop:
call movXY

call checkKeys
call checkAng

mov cx, word [playerdegree]

mov ah,02h
xor dx,dx ;set cursor position
xor bh,bh
int 10h


xor bx,bx
call printPlayerDegree


mov ch, byte [right] ;print right
call printANuminCH
call PrintSpace
mov ch, byte [left] ;left
call printANuminCH
call PrintSpace
call printNewline ;newline
call printXY

call drawXY

jmp mainloop

drawXY:
mov ax, 0C00h

rept 8 counter
{
mov cx,word [x+ counter*2-2]
mov dx,word [y+ counter*2-2]
inc al

;put smallSS
int 10h
inc cx
int 10h
inc dx
int 10h
dec cx
int 10h
}
ret

include 'checkKeys.inc'
include 'checkAng.inc'
include 'moveXY.inc'
include '..incprintANuminCH.inc'
include '..incprintNewline.inc'
include '..incPrintSpace.inc'

;1,q m,, +,- sh/ct 0,, /,* +, F1,F2
leftcodes: db 02h, 32h, 74, 42, 83, 12, 53, 59
rightcodes: db 10h, 33h, 78, 29, 82, 13, 55, 60
endofcodes:
right: db 0
left: db 0

playerdegree: dw 8 dup(?)
x: dw 8 dup(0)
y: dw 8 dup(0)
fx: dd 8 dup(?) ;dword=32 bits
fy: dd 8 dup(?)
[/code]
I excluded some debugging funcs, like printPlayerDegree and printXY...

The other func's are included in the inc files, and are pretty self-explainable

EDIT: I forgot, the funcs in checkKeys, and checkAng. checkKeys checks for keyboard input and checkAng increses playerdegree for the right player, with help from the input it got in checkKeys...

Please help me, or give link to where I can download a good 16-bit debugger...

Thanks for reading all this...

[grey]The one and only [b]Niklas Ulvinge[/b][/grey] [white]aka [b]IDK[/b][/white]


Comments

  • : [b][red]This message was edited by IDK at 2005-11-3 10:22:34[/red][/b][hr]
    : Wich debugger do you use?
    :
    : I need a 16-bit debugger that can debug com files I have tried TD, TD32 and OLLYDBG but I none of them can debug com files. I have heard of codeview and debug16, wich sounds prommesing but I don't know where to get them, I can't find them on the web.
    :
    : I need it to debug fpu code...
    :
    : this is the code I'm trying to debug...
    :
    : movXY.inc:
    : [code]movXY:
    : rept 8 counter
    : {
    : fld dword [fx+counter*4-4] ;load x
    : fld dword [fy+counter*4-4] ;load y
    : fild word [playerdegree+counter*2-2] ;load degree's
    : fmul st,st4 ;playerdegree * pi/180 = playerRadians
    : fsincos ;sin and cos of st
    : ;places sin in st and pushes cos in st
    : fwait
    : faddp st4,st ;st4=x, st4 = st + st4, pop st
    : faddp st2,st ;st2=y, st2 = st + st2, pop st
    : fld1
    : fadd st2,st
    : faddp st3,st
    :
    : fist word [y+counter*2-2] ;store integer y
    : fstp dword [fy+counter*4-4] ;store float y
    : fist word [x+counter*2-2]
    : fstp dword [fx+counter*4-4]
    :
    : fwait
    : }
    :
    : fwait
    : ret
    :
    :
    : fpuInit:
    : finit ;clear all
    :
    : xor bx,bx
    :
    : rept 8 counter
    : {
    : fild word [x+counter*2-2]
    : fild word [y+counter*2-2]
    : fstp dword [fy+counter*4-4]
    : fstp dword [fx+counter*4-4]
    : }
    : ;load pi/180 ;180 degrees = pi radians
    : fldpi ;load pi
    : fild word [f180] ;load 180
    : fdivp st1,st ;div pi/180 and place result in st1 and pop st
    : ;wich gives, st=pi/180 and all else is empty
    : fwait
    :
    : ret
    :
    : f180: dw 180[/code]
    :
    : movXY is called in the main loop of the program
    : fpuinit is called before the loops starts
    :
    : I don't know what's wrong...
    : the program says that all x values is 128,000 wich I don't know why it is so...
    :
    : this is actually the main program
    :
    : nactil.asm:
    : [code]org 100h
    :
    : main:
    : call fpuInit ;init the fpu, located in moveXY
    :
    : mov ax, 0012h ;int 10h(0), video mode 12h, 640x480,
    : int 10h ;and at least 16 colors I hope...
    :
    : ;call randomizeXYAng
    :
    : mainloop:
    : call movXY
    :
    : call checkKeys
    : call checkAng
    :
    : mov cx, word [playerdegree]
    :
    : mov ah,02h
    : xor dx,dx ;set cursor position
    : xor bh,bh
    : int 10h
    :
    :
    : xor bx,bx
    : call printPlayerDegree
    :
    :
    : mov ch, byte [right] ;print right
    : call printANuminCH
    : call PrintSpace
    : mov ch, byte [left] ;left
    : call printANuminCH
    : call PrintSpace
    : call printNewline ;newline
    : call printXY
    :
    : call drawXY
    :
    : jmp mainloop
    :
    : drawXY:
    : mov ax, 0C00h
    :
    : rept 8 counter
    : {
    : mov cx,word [x+ counter*2-2]
    : mov dx,word [y+ counter*2-2]
    : inc al
    :
    : ;put smallSS
    : int 10h
    : inc cx
    : int 10h
    : inc dx
    : int 10h
    : dec cx
    : int 10h
    : }
    : ret
    :
    : include 'checkKeys.inc'
    : include 'checkAng.inc'
    : include 'moveXY.inc'
    : include '..incprintANuminCH.inc'
    : include '..incprintNewline.inc'
    : include '..incPrintSpace.inc'
    :
    : ;1,q m,, +,- sh/ct 0,, /,* +, F1,F2
    : leftcodes: db 02h, 32h, 74, 42, 83, 12, 53, 59
    : rightcodes: db 10h, 33h, 78, 29, 82, 13, 55, 60
    : endofcodes:
    : right: db 0
    : left: db 0
    :
    : playerdegree: dw 8 dup(?)
    : x: dw 8 dup(0)
    : y: dw 8 dup(0)
    : fx: dd 8 dup(?) ;dword=32 bits
    : fy: dd 8 dup(?)
    : [/code]
    : I excluded some debugging funcs, like printPlayerDegree and printXY...
    :
    : The other func's are included in the inc files, and are pretty self-explainable
    :
    : EDIT: I forgot, the funcs in checkKeys, and checkAng. checkKeys checks for keyboard input and checkAng increses playerdegree for the right player, with help from the input it got in checkKeys...
    :
    : Please help me, or give link to where I can download a good 16-bit debugger...
    :
    : Thanks for reading all this...
    :
    : [grey]The one and only [b]Niklas Ulvinge[/b][/grey] [white]aka [b]IDK[/b][/white]
    :
    :
    :
    [blue]I did some testing and found that good old Debug.exe can handle all the instructions in this program, except fsincos. This could be avoided if fsin and fcos were used separately instead of fsincos. I hope this helps.[/blue]


  • : : [b][red]This message was edited by IDK at 2005-11-3 10:22:34[/red][/b][hr]
    : : Wich debugger do you use?
    : :
    : : I need a 16-bit debugger that can debug com files I have tried TD, TD32 and OLLYDBG but I none of them can debug com files. I have heard of codeview and debug16, wich sounds prommesing but I don't know where to get them, I can't find them on the web.
    : :
    : : I need it to debug fpu code...
    : :
    : : this is the code I'm trying to debug...
    : :
    : : movXY.inc:
    : : [code]movXY:
    : : rept 8 counter
    : : {
    : : fld dword [fx+counter*4-4] ;load x
    : : fld dword [fy+counter*4-4] ;load y
    : : fild word [playerdegree+counter*2-2] ;load degree's
    : : fmul st,st4 ;playerdegree * pi/180 = playerRadians
    : : fsincos ;sin and cos of st
    : : ;places sin in st and pushes cos in st
    : : fwait
    : : faddp st4,st ;st4=x, st4 = st + st4, pop st
    : : faddp st2,st ;st2=y, st2 = st + st2, pop st
    : : fld1
    : : fadd st2,st
    : : faddp st3,st
    : :
    : : fist word [y+counter*2-2] ;store integer y
    : : fstp dword [fy+counter*4-4] ;store float y
    : : fist word [x+counter*2-2]
    : : fstp dword [fx+counter*4-4]
    : :
    : : fwait
    : : }
    : :
    : : fwait
    : : ret
    : :
    : :
    : : fpuInit:
    : : finit ;clear all
    : :
    : : xor bx,bx
    : :
    : : rept 8 counter
    : : {
    : : fild word [x+counter*2-2]
    : : fild word [y+counter*2-2]
    : : fstp dword [fy+counter*4-4]
    : : fstp dword [fx+counter*4-4]
    : : }
    : : ;load pi/180 ;180 degrees = pi radians
    : : fldpi ;load pi
    : : fild word [f180] ;load 180
    : : fdivp st1,st ;div pi/180 and place result in st1 and pop st
    : : ;wich gives, st=pi/180 and all else is empty
    : : fwait
    : :
    : : ret
    : :
    : : f180: dw 180[/code]
    : :
    : : movXY is called in the main loop of the program
    : : fpuinit is called before the loops starts
    : :
    : : I don't know what's wrong...
    : : the program says that all x values is 128,000 wich I don't know why it is so...
    : :
    : : this is actually the main program
    : :
    : : nactil.asm:
    : : [code]org 100h
    : :
    : : main:
    : : call fpuInit ;init the fpu, located in moveXY
    : :
    : : mov ax, 0012h ;int 10h(0), video mode 12h, 640x480,
    : : int 10h ;and at least 16 colors I hope...
    : :
    : : ;call randomizeXYAng
    : :
    : : mainloop:
    : : call movXY
    : :
    : : call checkKeys
    : : call checkAng
    : :
    : : mov cx, word [playerdegree]
    : :
    : : mov ah,02h
    : : xor dx,dx ;set cursor position
    : : xor bh,bh
    : : int 10h
    : :
    : :
    : : xor bx,bx
    : : call printPlayerDegree
    : :
    : :
    : : mov ch, byte [right] ;print right
    : : call printANuminCH
    : : call PrintSpace
    : : mov ch, byte [left] ;left
    : : call printANuminCH
    : : call PrintSpace
    : : call printNewline ;newline
    : : call printXY
    : :
    : : call drawXY
    : :
    : : jmp mainloop
    : :
    : : drawXY:
    : : mov ax, 0C00h
    : :
    : : rept 8 counter
    : : {
    : : mov cx,word [x+ counter*2-2]
    : : mov dx,word [y+ counter*2-2]
    : : inc al
    : :
    : : ;put smallSS
    : : int 10h
    : : inc cx
    : : int 10h
    : : inc dx
    : : int 10h
    : : dec cx
    : : int 10h
    : : }
    : : ret
    : :
    : : include 'checkKeys.inc'
    : : include 'checkAng.inc'
    : : include 'moveXY.inc'
    : : include '..incprintANuminCH.inc'
    : : include '..incprintNewline.inc'
    : : include '..incPrintSpace.inc'
    : :
    : : ;1,q m,, +,- sh/ct 0,, /,* +, F1,F2
    : : leftcodes: db 02h, 32h, 74, 42, 83, 12, 53, 59
    : : rightcodes: db 10h, 33h, 78, 29, 82, 13, 55, 60
    : : endofcodes:
    : : right: db 0
    : : left: db 0
    : :
    : : playerdegree: dw 8 dup(?)
    : : x: dw 8 dup(0)
    : : y: dw 8 dup(0)
    : : fx: dd 8 dup(?) ;dword=32 bits
    : : fy: dd 8 dup(?)
    : : [/code]
    : : I excluded some debugging funcs, like printPlayerDegree and printXY...
    : :
    : : The other func's are included in the inc files, and are pretty self-explainable
    : :
    : : EDIT: I forgot, the funcs in checkKeys, and checkAng. checkKeys checks for keyboard input and checkAng increses playerdegree for the right player, with help from the input it got in checkKeys...
    : :
    : : Please help me, or give link to where I can download a good 16-bit debugger...
    : :
    : : Thanks for reading all this...
    : :
    : : [grey]The one and only [b]Niklas Ulvinge[/b][/grey] [white]aka [b]IDK[/b][/white]
    : :
    : :
    : :
    : [blue]I did some testing and found that good old Debug.exe can handle all the instructions in this program, except fsincos. This could be avoided if fsin and fcos were used separately instead of fsincos. I hope this helps.[/blue]
    :
    :
    :
    Yes, but what about the fpu registers?
    Can it view them?
    Afd can also view those instructions, but only as esc but it performs them correct...
  • Try this:

    http://www.waste.org/~winkles/debug32.zip


    It's a 3rd party debugger from the early 90s, which is very similar to plain ole debug.exe but has updated instruction sets and (obviously) handles 32 bit instructions too.

    Dunno how robust the floating point stuff is, but it's certainly an improvement over the one bundled with DOS/XP.

    -jeff!
  • : : : [b][red]This message was edited by IDK at 2005-11-3 10:22:34[/red][/b][hr]
    : : : Wich debugger do you use?
    : : :
    : : : I need a 16-bit debugger that can debug com files I have tried TD, TD32 and OLLYDBG but I none of them can debug com files. I have heard of codeview and debug16, wich sounds prommesing but I don't know where to get them, I can't find them on the web.
    : : :
    : : : I need it to debug fpu code...
    : : :
    : : : this is the code I'm trying to debug...
    : : :
    : : : movXY.inc:
    : : : [code]movXY:
    : : : rept 8 counter
    : : : {
    : : : fld dword [fx+counter*4-4] ;load x
    : : : fld dword [fy+counter*4-4] ;load y
    : : : fild word [playerdegree+counter*2-2] ;load degree's
    : : : fmul st,st4 ;playerdegree * pi/180 = playerRadians
    : : : fsincos ;sin and cos of st
    : : : ;places sin in st and pushes cos in st
    : : : fwait
    : : : faddp st4,st ;st4=x, st4 = st + st4, pop st
    : : : faddp st2,st ;st2=y, st2 = st + st2, pop st
    : : : fld1
    : : : fadd st2,st
    : : : faddp st3,st
    : : :
    : : : fist word [y+counter*2-2] ;store integer y
    : : : fstp dword [fy+counter*4-4] ;store float y
    : : : fist word [x+counter*2-2]
    : : : fstp dword [fx+counter*4-4]
    : : :
    : : : fwait
    : : : }
    : : :
    : : : fwait
    : : : ret
    : : :
    : : :
    : : : fpuInit:
    : : : finit ;clear all
    : : :
    : : : xor bx,bx
    : : :
    : : : rept 8 counter
    : : : {
    : : : fild word [x+counter*2-2]
    : : : fild word [y+counter*2-2]
    : : : fstp dword [fy+counter*4-4]
    : : : fstp dword [fx+counter*4-4]
    : : : }
    : : : ;load pi/180 ;180 degrees = pi radians
    : : : fldpi ;load pi
    : : : fild word [f180] ;load 180
    : : : fdivp st1,st ;div pi/180 and place result in st1 and pop st
    : : : ;wich gives, st=pi/180 and all else is empty
    : : : fwait
    : : :
    : : : ret
    : : :
    : : : f180: dw 180[/code]
    : : :
    : : : movXY is called in the main loop of the program
    : : : fpuinit is called before the loops starts
    : : :
    : : : I don't know what's wrong...
    : : : the program says that all x values is 128,000 wich I don't know why it is so...
    : : :
    : : : this is actually the main program
    : : :
    : : : nactil.asm:
    : : : [code]org 100h
    : : :
    : : : main:
    : : : call fpuInit ;init the fpu, located in moveXY
    : : :
    : : : mov ax, 0012h ;int 10h(0), video mode 12h, 640x480,
    : : : int 10h ;and at least 16 colors I hope...
    : : :
    : : : ;call randomizeXYAng
    : : :
    : : : mainloop:
    : : : call movXY
    : : :
    : : : call checkKeys
    : : : call checkAng
    : : :
    : : : mov cx, word [playerdegree]
    : : :
    : : : mov ah,02h
    : : : xor dx,dx ;set cursor position
    : : : xor bh,bh
    : : : int 10h
    : : :
    : : :
    : : : xor bx,bx
    : : : call printPlayerDegree
    : : :
    : : :
    : : : mov ch, byte [right] ;print right
    : : : call printANuminCH
    : : : call PrintSpace
    : : : mov ch, byte [left] ;left
    : : : call printANuminCH
    : : : call PrintSpace
    : : : call printNewline ;newline
    : : : call printXY
    : : :
    : : : call drawXY
    : : :
    : : : jmp mainloop
    : : :
    : : : drawXY:
    : : : mov ax, 0C00h
    : : :
    : : : rept 8 counter
    : : : {
    : : : mov cx,word [x+ counter*2-2]
    : : : mov dx,word [y+ counter*2-2]
    : : : inc al
    : : :
    : : : ;put smallSS
    : : : int 10h
    : : : inc cx
    : : : int 10h
    : : : inc dx
    : : : int 10h
    : : : dec cx
    : : : int 10h
    : : : }
    : : : ret
    : : :
    : : : include 'checkKeys.inc'
    : : : include 'checkAng.inc'
    : : : include 'moveXY.inc'
    : : : include '..incprintANuminCH.inc'
    : : : include '..incprintNewline.inc'
    : : : include '..incPrintSpace.inc'
    : : :
    : : : ;1,q m,, +,- sh/ct 0,, /,* +, F1,F2
    : : : leftcodes: db 02h, 32h, 74, 42, 83, 12, 53, 59
    : : : rightcodes: db 10h, 33h, 78, 29, 82, 13, 55, 60
    : : : endofcodes:
    : : : right: db 0
    : : : left: db 0
    : : :
    : : : playerdegree: dw 8 dup(?)
    : : : x: dw 8 dup(0)
    : : : y: dw 8 dup(0)
    : : : fx: dd 8 dup(?) ;dword=32 bits
    : : : fy: dd 8 dup(?)
    : : : [/code]
    : : : I excluded some debugging funcs, like printPlayerDegree and printXY...
    : : :
    : : : The other func's are included in the inc files, and are pretty self-explainable
    : : :
    : : : EDIT: I forgot, the funcs in checkKeys, and checkAng. checkKeys checks for keyboard input and checkAng increses playerdegree for the right player, with help from the input it got in checkKeys...
    : : :
    : : : Please help me, or give link to where I can download a good 16-bit debugger...
    : : :
    : : : Thanks for reading all this...
    : : :
    : : : [grey]The one and only [b]Niklas Ulvinge[/b][/grey] [white]aka [b]IDK[/b][/white]
    : : :
    : : :
    : : :
    : : [blue]I did some testing and found that good old Debug.exe can handle all the instructions in this program, except fsincos. This could be avoided if fsin and fcos were used separately instead of fsincos. I hope this helps.[/blue]
    : :
    : :
    : :
    : Yes, but what about the fpu registers?
    : Can it view them?
    : Afd can also view those instructions, but only as esc but it performs them correct...
    :

    [blue]Most debuggers usually run everything correctly, debug.exe should even run the fsincos instruction, but just doesnt know how to view it. The processor still takes care of executing stuff, it seems the debugger doesnt control that.

    About viewing the FPU stack, it cant be done directly, but its not impossible. You could run a few instructions from the beginning of the program(assuming the code there isnt used more than once). Then, when you need to view an fpu stack element, just write some code to 100h to pop it.
    Try this:
    [code]
    -a100
    149D:0100 fist dword[104]
    149D:0104
    -r ip
    IP 0117
    :0100
    -p
    [/code]
    Now you have the integer value at [104] and you can jump back to the next instruction of your program. If you want to view floating point values, then it gets more difficult, but integers can be viewed nicely.
    This is a little complicated, but I dont know any alternative.

    Btw I looked it up, ESC means Emulate System Crash(Interesting, eh?). I wonder what the two operands are for.

    I just discovered that when I popped the 4-byte floating point number to a memory location and viewed it with debug, it showed:
    [code]149D:0104 DB0F ESC 19,[BX] BYTE PTR[BX]
    (149D:0106 0001 ADD [BX+DI],AL)[/code]
    Maybe that is why there were ESC commands everywhere.
    That should be so because of the structure of the floating point number. Good luck![/blue]


  • : Btw I looked it up, ESC means Emulate System Crash(Interesting, eh?). I wonder what the two operands are for.
    :
    I looked it up in the intel manuals, and it said that it meant, as it the ascii char, escape. An escape char then, to tell the cpu to send the instruction to the fpu...

    I'll try what you said tommorow, I need some sleep now...
  • : Try this:
    :
    : http://www.waste.org/~winkles/debug32.zip
    :
    :
    : It's a 3rd party debugger from the early 90s, which is very similar to plain ole debug.exe but has updated instruction sets and (obviously) handles 32 bit instructions too.
    :
    : Dunno how robust the floating point stuff is, but it's certainly an improvement over the one bundled with DOS/XP.
    :
    : -jeff!
    :
    I downloaded it and tried it, but it gave me an error, not enough memmory...

    I like those grafik debugers. They make me feel like I know what i'm doing...
  • : : Try this:
    : :
    : : http://www.waste.org/~winkles/debug32.zip
    : :
    : :
    : : It's a 3rd party debugger from the early 90s, which is very similar to plain ole debug.exe but has updated instruction sets and (obviously) handles 32 bit instructions too.
    : :
    : : Dunno how robust the floating point stuff is, but it's certainly an improvement over the one bundled with DOS/XP.
    : :
    : : -jeff!
    : :
    : I downloaded it and tried it, but it gave me an error, not enough memmory...
    :
    : I like those grafik debugers. They make me feel like I know what i'm doing...
    :

    I tried it too. It can handle the fsincos function, but still, fpu registers cant be viewed directly. But this seems better than debug.exe, I think Ill start using it:)
  • :
    : : Btw I looked it up, ESC means Emulate System Crash(Interesting, eh?). I wonder what the two operands are for.
    : :
    : I looked it up in the intel manuals, and it said that it meant, as it the ascii char, escape. An escape char then, to tell the cpu to send the instruction to the fpu...
    :
    : I'll try what you said tommorow, I need some sleep now...
    :
    I realised that if I use afd, I could do the same, but simply look at the memmory...
    But I need to check for float values...

    I thought of a good way of doing it
    In the main loop I'll call a func that prints the values in the memmory that's float...

    But then I'll need to construct such a func, wich is a little hard...
    The funcs that C/C++ or even QBASIC uses, do that, but I don't know how they look like, I will have try to dissassemble one of those...
  • : :
    : : : Btw I looked it up, ESC means Emulate System Crash(Interesting, eh?). I wonder what the two operands are for.
    : : :
    : : I looked it up in the intel manuals, and it said that it meant, as it the ascii char, escape. An escape char then, to tell the cpu to send the instruction to the fpu...
    : :
    : : I'll try what you said tommorow, I need some sleep now...
    : :
    : I realised that if I use afd, I could do the same, but simply look at the memmory...
    : But I need to check for float values...
    :
    : I thought of a good way of doing it
    : In the main loop I'll call a func that prints the values in the memmory that's float...
    :
    : But then I'll need to construct such a func, wich is a little hard...
    : The funcs that C/C++ or even QBASIC uses, do that, but I don't know how they look like, I will have try to dissassemble one of those...
    :
    They are 23KB!!
    And it's a lot of loops that I can't understand...

    Is there any func to print it?
    Or do I have to write my own?
  • : : :
    : : : : Btw I looked it up, ESC means Emulate System Crash(Interesting, eh?). I wonder what the two operands are for.
    : : : :
    : : : I looked it up in the intel manuals, and it said that it meant, as it the ascii char, escape. An escape char then, to tell the cpu to send the instruction to the fpu...
    : : :
    : : : I'll try what you said tommorow, I need some sleep now...
    : : :
    : : I realised that if I use afd, I could do the same, but simply look at the memmory...
    : : But I need to check for float values...
    : :
    : : I thought of a good way of doing it
    : : In the main loop I'll call a func that prints the values in the memmory that's float...
    : :
    : : But then I'll need to construct such a func, wich is a little hard...
    : : The funcs that C/C++ or even QBASIC uses, do that, but I don't know how they look like, I will have try to dissassemble one of those...
    : :
    : They are 23KB!!
    : And it's a lot of loops that I can't understand...
    :
    : Is there any func to print it?
    : Or do I have to write my own?
    :

    I'm trying to make one myself right now. And its difficult. So far I have managed to extract the sign and the exponent number from the floating point number, but I still have a lot more to do(thank god its friday night:-)). Wow, I thought I was making this too big to be normal(120 bytes for now), but 23K? That's huge! I think I can manage to make it smaller than that. Using this page as a reference: http://www.ibilce.unesp.br/courseware/datas/data1.htm
    I havent seen any other funcs to do this, but let's have fun writing them:)
    This is what I have so far(sorry, I'm still using tasm):
    [code]
    .286
    float_to_asc segment
    assume cs:float_to_asc,ds:float_to_asc
    org 0100h ;.com file

    start:
    mov si,offset fvalue

    ; ---------------------Get sign-----------------------------------------
    xor cx,cx
    nextval:
    mov al,byte ptr[si+3]
    test al,10000000b
    jz positive
    mov al,"-"
    int 29h
    jmp negative
    positive:
    mov al,"+"
    int 29h
    negative:

    ; ---------------------Get exponent-------------------------------------
    xor cx,cx
    mov al,byte ptr[si+3]
    shl al,1
    mov dl,byte ptr[si+2]
    and dl,10000000b
    jz nolowbit
    or al,1
    nolowbit:
    sub al,127

    ; ---------------------Print the exponent-------------------------------
    mov dl,al
    nextcnvval: ;Using cryptic labels is my style:)
    mov al,dl
    shr al,4
    and al,0fh
    cmp al,10
    jb nothex
    add al,7
    nothex:
    add al,30h
    int 29h
    shl dl,4
    inc cx
    cmp cx,2
    jne nextcnvval

    mov ah,9
    mov dx,offset nextln
    int 21h

    add si,4
    inc counter
    cmp counter,6
    jne nextval
    ret

    counter db ?

    ; ---------------Some FP numbers for testing----------------------------
    fvalue dd 11000001110010000000000000000000b ;-25.0
    fvalue2 dd 12.236 ;A8C64341
    fvalue3 dd -54.345345 ;A26159C2
    fvalue4 dd -12.5 ;000048C1
    fvalue5 dd 2.0 ;00000040
    fvalue6 dd -2.0 ;000000C0

    nextln db 13,10,"$"

    float_to_asc ends
    end start[/code]
  • [b][red]This message was edited by IDK at 2005-11-4 13:17:42[/red][/b][hr]
    : I'm trying to make one myself right now. And its difficult. So far I have managed to extract the sign and the exponent number from the floating point number, but I still have a lot more to do(thank god its friday night:-)). Wow, I thought I was making this too big to be normal(120 bytes for now), but 23K? That's huge! I think I can manage to make it smaller than that. Using this page as a reference: http://www.ibilce.unesp.br/courseware/datas/data1.htm
    : I havent seen any other funcs to do this, but let's have fun writing them:)
    : This is what I have so far(sorry, I'm still using tasm):

    I'm also writting my own now...
    I also got the sign, but got a little trouble with the exp, I need to debug...

    I generated the 23K program by writing: PRINT .1
    in my basic interpreter, then I compiled...

    That's why asm code is the best avilable

    I use this site: http://www.psc.edu/general/software/packages/ieee/ieee.html

  • [b][red]This message was edited by IDK at 2005-11-4 15:43:47[/red][/b][hr]
    I'm finnished with the program...

    It prints the float values binary. And only the most important values of it...

    Here it is:
    [code]
    org 100h

    finit
    fld1
    fadd st,st
    fadd st,st
    fld1
    fadd st,st
    faddp st1,st ;st=6
    fld1
    fld1
    fadd st,st
    fdivp st1,st
    faddp st1,st ;st=6.5
    fchs ;change sign
    fstp dword [val]
    mov bx,val
    mov ch,[bx]

    call printFloatAtBX

    mov ah,01
    int 21h

    mov ax,4C00h
    int 21h

    val: dd 0


    printFloatAtBX:
    ;float IEEE
    ;S EEEEEEEE FFFFFFFFFFFFFFFFFFFFFFF
    ;0 1 8 9 31
    mov ah,[bx+3] ;get sign
    mov dh,ah
    and dh,128
    mov al,' ' ;print S
    jz printFloatAtBXpositive
    mov al,'-'
    printFloatAtBXpositive:
    mov dh,ah
    int 29h

    shl dh,1 ;get E
    mov ah,[bx+2]
    and ah,128
    shr ah,7
    add dh,ah ;dh is now E
    mov al,'0'
    jz printFloatAtBXzero
    mov al,'1'
    printFloatAtBXzero:
    cmp dh,255
    je printFloatAtBXwierdnumber

    int 29h
    mov al,'.'
    int 29h

    mov bx,[bx+1] ;print F binary

    mov ax,04000h ;highest bit is part of E
    printFloatAtBXbinLoop:
    push ax
    and ax,bx
    mov al,'0'
    jz printFloatAtBXprintZero
    mov al,'1'

    printFloatAtBXprintZero:
    int 29h

    pop ax
    shr ax,1
    cmp ax,0
    jne printFloatAtBXbinLoop


    mov al,'E' ;print E
    int 29h

    sub dh,127
    mov ch,dh
    call printANuminCH
    ret

    printFloatAtBXwierdnumber:
    mov ax,[bx+2]
    mov bx,[bx]
    and bx,08FFFh
    jz printFloatAtBXinfinity
    ;else it's nan

    mov ah, 9
    mov dx, printFloatAtBXnan
    int 21h
    ret

    printFloatAtBXinfinity:
    mov ah, 9
    mov dx, printFloatAtBXinf
    int 21h
    ret

    printFloatAtBXnan: db "#NAN$"
    printFloatAtBXinf: db "#INF$"

    include 'incprintANuminCH.inc'
    [/code]


  • : I'm finnished with the program...
    :
    : It prints the float values binary. And only the most important values of it...
    :

    By the most important values, do you mean everything before the comma?
    Anyway, I'm doing it the hard way, without using any fpu instructions. I'm hoping to make it print the whole number. It's already 500 bytes and growing. I guess I'm probably doing it all wrong, but we'll see. Now I need some sleep..
  • [green]max thread limit...[/green]

    : : I'm finnished with the program...
    : :
    : : It prints the float values binary. And only the most important values of it...
    : :
    :
    : By the most important values, do you mean everything before the comma?

    [green]No, I mean the all the values after the comma except the last byte[/green]

    : Anyway, I'm doing it the hard way, without using any fpu instructions.

    [green]I don't use any fpu instructions in my function, the fpu instructions I used was to store a real float value.[/green]

    : I'm hoping to make it print the whole number. It's already 500 bytes
    : and growing. I guess I'm probably doing it all wrong, but we'll see.
    [green]Mine is 815 byte...
    Since I will only use it to debug I'll won't make it really good, only good enough for me to know what it is...
    [/green]
    : Now I need some sleep..

    [green]Me to[/green]
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories