Howdy, Stranger!

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

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Problems with inline assembly in turbo pascal

johnnym30johnnym30 Posts: 7Member
I have got turbo pascal7.0, but why cant i run programs with inline assembler???

i am recieving the commands : begin expected and unknown identifier.

i was told yesterday that version 6.0 and newer, would have the inline assembler build in.

can anybody help me??

reggards

johnny

Comments

  • zibadianzibadian Posts: 6,349Member
    : I have got turbo pascal7.0, but why cant i run programs with inline assembler???
    :
    : i am recieving the commands : begin expected and unknown identifier.
    :
    : i was told yesterday that version 6.0 and newer, would have the inline assembler build in.
    :
    : can anybody help me??
    :
    : reggards
    :
    : johnny
    :
    Without a code example, we are very hard-pressed to help you. It might be a typo in the word assembler, or the programmer has written something other than asm to start the assembler part. Perhaps an unknown variable type, or something like that.
  • johnnym30johnnym30 Posts: 7Member
    : : I have got turbo pascal7.0, but why cant i run programs with inline assembler???
    : :
    : : i am recieving the commands : begin expected and unknown identifier.
    : :
    : : i was told yesterday that version 6.0 and newer, would have the inline assembler build in.
    : :
    : : can anybody help me??
    : :
    : : reggards
    : :
    : : johnny
    : :
    : Without a code example, we are very hard-pressed to help you. It might be a typo in the word assembler, or the programmer has written something other than asm to start the assembler part. Perhaps an unknown variable type, or something like that.
    :
    in this example it says 'begin expectet' and the cursor is blinking in the start of 'assembler'

    Procedure Palette(ColNum,R,G,B:Byte); Assembler;
    Asm Mov dx,$3c8; Mov al,ColNum; Out dx,al; Inc dx; Mov al,R;
    Out dx,al; Mov al,G; Out dx,al; Mov al,B; Out dx,al End;


    and in this example it says 'unknown identifier' and the cursor is blinking in the start of 'asm'

    procedure FontAccess( Accessible : boolean );
    begin
    asm
    push ax
    push dx
    cli

    { -- EgaVga sequencer -- }
    mov dx, 3c4h

    mov ax, 0100h
    @1:
    out dx, ax
    mov ax, 0302h
    cmp Accessible, True
    jnz @2
    inc ah { 0402h if accessible }




    i hope you can help me.

    reggards

    johnny

  • PerranPerran Posts: 241Member
    : : : I have got turbo pascal7.0, but why cant i run programs with inline assembler???
    : : :
    : : : i am recieving the commands : begin expected and unknown identifier.
    : : :
    : : : i was told yesterday that version 6.0 and newer, would have the inline assembler build in.
    : : :
    : : : can anybody help me??
    : : :
    : : : reggards
    : : :
    : : : johnny
    : : :
    : : Without a code example, we are very hard-pressed to help you. It might be a typo in the word assembler, or the programmer has written something other than asm to start the assembler part. Perhaps an unknown variable type, or something like that.
    : :
    : in this example it says 'begin expectet' and the cursor is blinking in the start of 'assembler'
    :
    : Procedure Palette(ColNum,R,G,B:Byte); Assembler;
    : Asm Mov dx,$3c8; Mov al,ColNum; Out dx,al; Inc dx; Mov al,R;
    : Out dx,al; Mov al,G; Out dx,al; Mov al,B; Out dx,al End;
    :
    :
    : and in this example it says 'unknown identifier' and the cursor is blinking in the start of 'asm'
    :
    : procedure FontAccess( Accessible : boolean );
    : begin
    : asm
    : push ax
    : push dx
    : cli
    :
    : { -- EgaVga sequencer -- }
    : mov dx, 3c4h
    :
    : mov ax, 0100h
    : @1:
    : out dx, ax
    : mov ax, 0302h
    : cmp Accessible, True
    : jnz @2
    : inc ah { 0402h if accessible }
    :
    :
    :
    :
    : i hope you can help me.
    :
    : reggards
    :
    : johnny
    :
    :
    Neither my TP6.0 manual nor my Delphi 6.0 manual show "assembler" as a reserved word. Comment that out and it should compiles. As noted in my post yesterday, all you need is asm....end; So, in your case,
    [code]
    Procedure Palette(ColNum,R,G,B:Byte);
    Asm
    Mov dx,$3c8; Mov al,ColNum; Out dx,al; Inc dx; Mov al,R;
    Out dx,al; Mov al,G; Out dx,al; Mov al,B; Out dx,al;
    End;
    [/code]
    should compile. HTH
  • zibadianzibadian Posts: 6,349Member
    : : : I have got turbo pascal7.0, but why cant i run programs with inline assembler???
    : : :
    : : : i am recieving the commands : begin expected and unknown identifier.
    : : :
    : : : i was told yesterday that version 6.0 and newer, would have the inline assembler build in.
    : : :
    : : : can anybody help me??
    : : :
    : : : reggards
    : : :
    : : : johnny
    : : :
    : : Without a code example, we are very hard-pressed to help you. It might be a typo in the word assembler, or the programmer has written something other than asm to start the assembler part. Perhaps an unknown variable type, or something like that.
    : :
    : in this example it says 'begin expectet' and the cursor is blinking in the start of 'assembler'
    :
    : Procedure Palette(ColNum,R,G,B:Byte); Assembler;
    : Asm Mov dx,$3c8; Mov al,ColNum; Out dx,al; Inc dx; Mov al,R;
    : Out dx,al; Mov al,G; Out dx,al; Mov al,B; Out dx,al End;
    :
    :
    : and in this example it says 'unknown identifier' and the cursor is blinking in the start of 'asm'
    :
    : procedure FontAccess( Accessible : boolean );
    : begin
    : asm
    : push ax
    : push dx
    : cli
    :
    : { -- EgaVga sequencer -- }
    : mov dx, 3c4h
    :
    : mov ax, 0100h
    : @1:
    : out dx, ax
    : mov ax, 0302h
    : cmp Accessible, True
    : jnz @2
    : inc ah { 0402h if accessible }
    :
    :
    :
    :
    : i hope you can help me.
    :
    : reggards
    :
    : johnny
    :
    :
    I've checked my TP7, but it compiles the Palette() just fine, so I'm at a loss. The only two explanations I can come up with, is that either you're compiler is corrupted and cannot handle assembly or you have some smaller edition of TP7 in which the assembly compiler is turned off. The best way to check this is to see if you can find a simple example with assemly in it (test286.pas is a good one).
  • zibadianzibadian Posts: 6,349Member
    : : : : I have got turbo pascal7.0, but why cant i run programs with inline assembler???
    : : : :
    : : : : i am recieving the commands : begin expected and unknown identifier.
    : : : :
    : : : : i was told yesterday that version 6.0 and newer, would have the inline assembler build in.
    : : : :
    : : : : can anybody help me??
    : : : :
    : : : : reggards
    : : : :
    : : : : johnny
    : : : :
    : : : Without a code example, we are very hard-pressed to help you. It might be a typo in the word assembler, or the programmer has written something other than asm to start the assembler part. Perhaps an unknown variable type, or something like that.
    : : :
    : : in this example it says 'begin expectet' and the cursor is blinking in the start of 'assembler'
    : :
    : : Procedure Palette(ColNum,R,G,B:Byte); Assembler;
    : : Asm Mov dx,$3c8; Mov al,ColNum; Out dx,al; Inc dx; Mov al,R;
    : : Out dx,al; Mov al,G; Out dx,al; Mov al,B; Out dx,al End;
    : :
    : :
    : : and in this example it says 'unknown identifier' and the cursor is blinking in the start of 'asm'
    : :
    : : procedure FontAccess( Accessible : boolean );
    : : begin
    : : asm
    : : push ax
    : : push dx
    : : cli
    : :
    : : { -- EgaVga sequencer -- }
    : : mov dx, 3c4h
    : :
    : : mov ax, 0100h
    : : @1:
    : : out dx, ax
    : : mov ax, 0302h
    : : cmp Accessible, True
    : : jnz @2
    : : inc ah { 0402h if accessible }
    : :
    : :
    : :
    : :
    : : i hope you can help me.
    : :
    : : reggards
    : :
    : : johnny
    : :
    : :
    : Neither my TP6.0 manual nor my Delphi 6.0 manual show "assembler" as a reserved word. Comment that out and it should compiles. As noted in my post yesterday, all you need is asm....end; So, in your case,
    : [code]
    : Procedure Palette(ColNum,R,G,B:Byte);
    : Asm
    : Mov dx,$3c8; Mov al,ColNum; Out dx,al; Inc dx; Mov al,R;
    : Out dx,al; Mov al,G; Out dx,al; Mov al,B; Out dx,al;
    : End;
    : [/code]
    : should compile. HTH
    :
    The TP7 and D5 online helps list the assembler directive as reserved words (in D5 only as backward compatibility).
  • PerranPerran Posts: 241Member
    : : : : : I have got turbo pascal7.0, but why cant i run programs with inline assembler???
    : : : : :
    : : : : : i am recieving the commands : begin expected and unknown identifier.
    : : : : :
    : : : : : i was told yesterday that version 6.0 and newer, would have the inline assembler build in.
    : : : : :
    : : : : : can anybody help me??
    : : : : :
    : : : : : reggards
    : : : : :
    : : : : : johnny
    : : : : :
    : : : : Without a code example, we are very hard-pressed to help you. It might be a typo in the word assembler, or the programmer has written something other than asm to start the assembler part. Perhaps an unknown variable type, or something like that.
    : : : :
    : : : in this example it says 'begin expectet' and the cursor is blinking in the start of 'assembler'
    : : :
    : : : Procedure Palette(ColNum,R,G,B:Byte); Assembler;
    : : : Asm Mov dx,$3c8; Mov al,ColNum; Out dx,al; Inc dx; Mov al,R;
    : : : Out dx,al; Mov al,G; Out dx,al; Mov al,B; Out dx,al End;
    : : :
    : : :
    : : : and in this example it says 'unknown identifier' and the cursor is blinking in the start of 'asm'
    : : :
    : : : procedure FontAccess( Accessible : boolean );
    : : : begin
    : : : asm
    : : : push ax
    : : : push dx
    : : : cli
    : : :
    : : : { -- EgaVga sequencer -- }
    : : : mov dx, 3c4h
    : : :
    : : : mov ax, 0100h
    : : : @1:
    : : : out dx, ax
    : : : mov ax, 0302h
    : : : cmp Accessible, True
    : : : jnz @2
    : : : inc ah { 0402h if accessible }
    : : :
    : : :
    : : :
    : : :
    : : : i hope you can help me.
    : : :
    : : : reggards
    : : :
    : : : johnny
    : : :
    : : :
    : : Neither my TP6.0 manual nor my Delphi 6.0 manual show "assembler" as a reserved word. Comment that out and it should compiles. As noted in my post yesterday, all you need is asm....end; So, in your case,
    : : [code]
    : : Procedure Palette(ColNum,R,G,B:Byte);
    : : Asm
    : : Mov dx,$3c8; Mov al,ColNum; Out dx,al; Inc dx; Mov al,R;
    : : Out dx,al; Mov al,G; Out dx,al; Mov al,B; Out dx,al;
    : : End;
    : : [/code]
    : : should compile. HTH
    : :
    : The TP7 and D5 online helps list the assembler directive as reserved words (in D5 only as backward compatibility).
    :
    I stand corrected. I looked in my D6 documentation and it's in there as well. Sorry about the misinformation.
  • ibyiby Posts: 323Member
    : I've checked my TP7, but it compiles the Palette() just fine, so I'm at a loss. The only two explanations I can come up with, is that either you're compiler is corrupted and cannot handle assembly or you have some smaller edition of TP7 in which the assembly compiler is turned off. The best way to check this is to see if you can find a simple example with assemly in it (test286.pas is a good one).
    :



    What's wrong with non-asm version?
    [code]
    Procedure Palette(ColNum,R,G,B:Byte);
    begin
    port[$3c8]:=ColNum;
    port[$3C9]:=R;
    port[$3C9]:=G;
    port[$3C9]:=B;
    End;
    [/code]


Sign In or Register to comment.