Re: Strange piece of ASM

From: Michael Huth (
Date: 2003-10-15 17:41:42


Yes it's quite strange to do an AND %11000000 and then twice SHL ah,1.

But thinking of shl might be a shr:
then the routine would do
port[$62] and %11000000 -> ah = %xx000000
2x shr ah,1             -> ah = %00xx0000
test ah,%00110000       -> ZF = (0 == (ah & %00110000))

this would make way more sense and would relate to Bit 7,6 of port $62.


At 15:15 15.10.2003 +0200, you wrote:

>hallo allemaal,
>At this moment I'm commenting the BIOS of the PC20-III and I run into a 
>strange piece of code. The first routine is run on several places in the 
>ROM. The first time after initialising the DRAM:
>                 call    sub_FA39
>                 jnz     loc_E2D2                ; error, ->
>E2D2 is the start of an error routine. This means that to continue, the 
>Zeroflag must be set. The routine itself:
>;                              SUBROUTINE
>sub_FA39        proc    near
>                 push    dx
>                 mov     dx,62h
>                 in      al,dx                   ; port 62h, 8255 C - 
> dipswitch, etc.
>                 xchg    ah,al
>                 call    ResetParityFF
>                 and     ah,0C0h
>                 shl     ah,1
>                 shl     ah,1
>                 or      al,ah
>                 out     dx,al
>                 test    ah,30h
>                 pop     dx
>                 retn
>sub_FA39        endp
>;                              SUBROUTINE
>;**  Resets the two flipflops that hold the onboard and external party error
>ResetParityFF   proc    near
>                 mov     dx,61h
>                 in      al,dx                   ; 8255 port B, read
>                 xor     al,30h
>                 out     dx,al                   ; 8255 B - spkr, etc
>                 xor     al,30h
>                 out     dx,al                   ; 8255 B - spkr, etc
>                 retn
>ResetParityFF   endp
>I removed my own comment so you won't be influenced by it. The main 
>question is: what is the content of AH at the end of the first subroutine? 
>IMHO it is always zero. But that would mean that the routine makes no 
>sense or that I'm stupid.
>Thanks for any comment, even if you have to tell me I'm stupid :)
>     ___
>    / __|__
>   / /  |_/     Groetjes, Ruud
>   \ \__|_\
>    \___|       <>
>De informatie in dit e-mailbericht is vertrouwelijk en uitsluitend bestemd 
>voor de geadresseerde. Wanneer u dit bericht per abuis ontvangt, verzoeken 
>wij u contact op te nemen met de afzender per kerende e-mail. Verder 
>verzoeken wij u in dat geval dit e-mailbericht te vernietigen en de inhoud 
>ervan aan niemand openbaar te maken. Wij aanvaarden geen aansprakelijkheid 
>voor onjuiste, onvolledige dan wel ontijdige overbrenging van de inhoud 
>van een verzonden e-mailbericht, noch voor daarbij overgebrachte virussen.
>The information contained in this e-mail is confidential and may be 
>privileged. It may be read, copied and used only by the intended 
>recipient. If you have received it in error, please contact the sender 
>immediately by return e-mail; please delete in this case the e-mail and do 
>not disclose its contents to any person. We don't accept liability for any 
>errors, omissions, delays of receipt or viruses in the contents of this 
>message which arise as a result of e-mail transmission.

       Message was sent through the cbm-hackers mailing list

Archive generated by hypermail pre-2.1.8.