flat assembler
Message board for the users of flat assembler.

flat assembler > Macroinstructions > _hghghg=(_tmppp shl _bit111)) error?

Author
Thread Post new topic Reply to topic
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
Code:
macro resetportbit ._addressadd,_bit111
{
_tmppp=1
_hghghg=(_tmppp shl _bit111))
_hghghg5=($ff xor _hghghg)
and [global_port_data_buffer],cxcxc
mov dx,[global_base_address]
add dx,._addressadd
mov al,[global_port_data_buffer]
out dx,al
}
resetportbit 2,2

    

i know a better way to do this, but why is _hghghg=(_tmppp shl _bit111))
an error? it should work as _hghghg=(1 shl _bit111)) too no?
Post 18 Nov 2004, 14:28
View user's profile Send private message Visit poster's website Reply with quote
crc



Joined: 21 Jun 2003
Posts: 637
Location: Penndel, PA [USA]
Are there supposed to be two closing parenthesis in the line below:

Code:
_hghghg=(1 shl _bit111))    
Post 18 Nov 2004, 15:00
View user's profile Send private message Visit poster's website Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
oh, thank you,
how could i miss that? Smile

it works if it is _hghghg=(1 shl _bit111)

Code:
macro resetportbit ._addressadd,_bit111
{
_hghghg=((1 shl _bit111))
_hghghg5=($ff xor _hghghg)
and word [global_port_data_buffer],_hghghg
mov dx,[global_base_address]
add dx,._addressadd
mov al,[global_port_data_buffer]
out dx,al
}
resetportbit 2,2

global_port_data_buffer: db 0
global_base_address: dw $378
    


i was just fooled by the illegal instruction error instead of missing parenthesis.

well maeby i post this to the wrong place Sad
it must had been better if i post this to compiler internals
i'm having a little suggestion to Privalov, namely:
it whould be nice (just for completeness) to check if
-string has quotes, or quotes are closed,
cc db 'string
cc db string'
cc db 'string''
-missing parenthesis:
_hghghg=(1 shl _bit111))
_hghghg=((((1 shl 1) shr 1) shl _bit111)))
-brackets [] are closed
and then display the appropriate error messages
Post 19 Nov 2004, 01:20
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2145
Location: Estonia
Its nearly impossible to know how programmer wants his/her brackets/parenthesis etc.

What you can do is count every (, [, { and relatives in each row and check
the parity and only warn the user - because maybe he/she wants to close
them some 100 lines later.

But when to warn the user? It may even compile fine and work, but some
unnessecary parenthesis exist like in your example: maybe mov eax,[eax+((1+2))]
Post 05 Dec 2004, 22:36
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
it whouldn't be so hard:

say:
Code:
<destination> <instruction> <source>
_hghghg               =             ((1 shl _bit111)

<source> : ((1 shl _bit111)
interpret:
<source> : <open (=1><open (=2> 1 shl _bit111 <close )=2>

next instriction/destination

display error message: go to/highlight error position <open (=1>
index not closed (

mov eax,[eax+((1+2))] 

<instruction> <destination> , <source>
<source> : [eax+((1+2))] 
interpret:
<source> : <open [=1> eax <operator + check arguments> <open (=1><open (=2>1<operator + check arguments>2<close )=2><close )=1>
no error

mov eax,[eax+(1+2))] 

<instruction> <destination> , <source>
<source> : [eax+((1+2))] 
interpret:
<source> : <open [=1> eax <operator + check arguments> <open (=1>1<operator + check arguments>2<close )=1><close )=0>

display error message: go to/highlight error position <close )=0>
index there are no more ( to close
    
Post 05 Dec 2004, 23:04
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2019, Tomasz Grysztar.

Powered by rwasa.