program have bug.....please help...thanks.!

Started by guesehsaio, May 09, 2005, 06:47:26 AM

Previous topic - Next topic

guesehsaio

i have some problem....i wrote a DIMM test program,but first time returned "System Fail Address" is
right! my sample is "single bit" fail IC.and second times and another times returned "System Fail Address" is wrong..i have verify @ debug32! that's  inaccuracy about 80h...please help me! thanks.



check_board_55 proc near
    mov edi,MEMBASE
    mov eax,055555555h
    mov ecx,MEMSIZE / 4
loop3: 
    mov es:[edi],eax
    add edi,4
    loopd loop3
    mov edi,MEMBASE
    mov ecx,MEMSIZE / 4
loop4:
    mov eax,055555555H
    cmp eax,es:[edi]
    jz check_55
    print_pattern  string2
    ;call pattern_name
    call badcmp
check_55:   
    add edi,04h
    loopd loop4


   Ret
string2 db "Check_Board_55 ",10,13,'$'
check_board_55 EndP
;****************************************
badcmp proc near
    ;call save_to_disk
   
    push eax          ;eax:expect value
     
    mov ebx,es:[edi]  ;ebx:Fail DQ (Value)
    mov eax,edi       ;eax:System Fail ADDR. 
    CALL Swap_eax   ;print system fail addr.
    mov eax,ebx
   
    CALL Swap_eax ;print Fail DQ (Value)
    pop eax
    CALL Swap_eax ; print  expect value

   
    mov dx,offset badmsg
pmsg::
    push ax   
    mov ah,9
    int 21h
    pop ax   
    sti
    ;jmp loop_limit
    ret       ;
badcmp endp   ;
msg     db      "Failure attempting to init a20 line",10,13,'$'
goodmsg db      "Memory Test Pass",10,13,'$'
badmsg  db      "Memory Test Failed",10,13,'$'
chang_row db    " ",10,13,'$'
;**********************************************************
PRINT_AX        PROC    NEAR
      PUSH    AX
      ADD     DL,30H
      CMP     DL,'9'
      JBE     OK
      ADD     DL,7
OK:             MOV     AH,2
      INT     21H
      POP     AX
      RET
PRINT_AX        ENDP
;***********************************************************
print_ax_1      proc near
        
      MOV     CL,4
      MOV     DL,AL
      SHR     DL,CL
      CALL    PRINT_AX
      MOV     DL,AL
      ;SHR     DL,CL
      AND     DL,0FH
      CALL    PRINT_AX
      MOV     DL,AH
      SHR     DL,CL
      CALL    PRINT_AX
      MOV     DL,AH
      ;SHR     DL,CL
      AND     DL,0FH
      CALL    PRINT_AX
      ret
print_ax_1      endp
;***************************************************************
print_ax_2     proc near
      MOV     CL,4
      MOV     DL,AH
      SHR     DL,CL
      CALL    PRINT_AX
      MOV     DL,AH
      AND     DL,0FH
      CALL    PRINT_AX
      MOV     DL,AL
      SHR     DL,CL
      CALL    PRINT_AX
      MOV     DL,AL
      AND     DL,0FH
      CALL    PRINT_AX
      ret
print_ax_2      endp

;**************************************************************
Swap_Eax proc near   
    ;push eax
    BSWAP eax             
    call print_ax_1   
    BSWAP eax
    ;pop eax                   
    call print_ax_2   
    mov dx,offset chang_row
    mov ah,9
    int 21h
    ret
Swap_Eax endp

MichaelW

When badcmp is called from loop4, the loop counter (ECX) is being changed by print_ax_1 and print_ax_2.

Your code is hard to understand. Code like that is more likely to contain hard-to-find errors. If I were doing this I would try to organize and simplify the code, and use procedure names that describe what the procedure does. For example, PRINT_AX, print_ax_1, print_ax_2, and Swap_Eax could be replaced by a single smaller procedure named printhex, or printvalue, or printhexvalue, or something similar. And I would code all of the procedures to preserve any register that the procedure changes, except registers that are used to return a value to the caller.
eschew obfuscation

guesehsaio

Michael...thank your suggestion! i went to great pains for this program,because no plan before programing ..actually my program is very hard to understand,and thank you again... :thumbu
i try to preserve (ECX),but the same.second time=returned wrong system address
i think,effect edi?? because my system address is  preserve  @ edi ...but i can't find errors to prove
edi issue...................thank you very much!

Swap_Eax proc near   
    push eax
    push edx
    push ecx
    BSWAP eax             
    call print_ax_1   
    BSWAP eax
         
    call print_ax_2   
    mov dx,offset chang_row
    mov ah,9
    int 21h
    pop ecx
    pop edx
    pop eax
    ret
Swap_Eax endp



pbrennick

Using print_ax_1 and print_ax_2 is inefficient.  Consider using just one and calling it something like splitprint_eax or similar.  I can see why you did it that way, though.

Paul

guesehsaio

Quote from: pbrennick on May 11, 2005, 02:42:40 PM
Using print_ax_1 and print_ax_2 is inefficient.  Consider using just one and calling it something like splitprint_eax or similar.  I can see why you did it that way, though.

Paul

thanks...i'm a beginner.i want to print "eax" register...but i have no idea except this...
Pual Thank you.my program so confusion.. thanks...!!!

guesehsaio

Quote from: pbrennick on May 11, 2005, 02:42:40 PM
Using print_ax_1 and print_ax_2 is inefficient.  Consider using just one and calling it something like splitprint_eax or similar.  I can see why you did it that way, though.

Paul

Thanks Pual and Michael ...
i try to found fixed ES=0000,it's ok.....! Thanks...you are my helpful friends....