flat assembler
Message board for the users of flat assembler.

Index > Main > Converting asm program - OR in a db

Author
Thread Post new topic Reply to topic
MajorDill



Joined: 01 Nov 2010
Posts: 18
MajorDill
I am converting a program from another assembler and ran into this:

table db 'LIS', 'T' | 80h
dw (address of something)
db 'LOA', 'D' | 80h
dw (another address)
which turns on the left most bit in 'T' so in memory, it looks like this
L I S T
4C 49 53 D4 <--(instead of 54)

this allows you to rip thru a table using the turned on bit to signal the end of an alpha string

is there some way to do this in FASM?
Post 10 Jul 2014, 20:48
View user's profile Send private message Reply with quote
cod3b453



Joined: 25 Aug 2004
Posts: 619
cod3b453
The following will do it but you'd need a struc and macro version to allow labeled/unlabeled strings.
Code:
struc str [x]
{
 common
        local .end

        db x
    .end:

        load b byte from .end-1
        b = b or 0x80
        store byte b at .end-1

}

table str 'tes','t'    
Post 10 Jul 2014, 21:24
View user's profile Send private message Reply with quote
l_inc



Joined: 23 Oct 2009
Posts: 881
l_inc
MajorDill
Just use the operator or instead of the pipe character:
Code:
table db 'LIS', 'T' or 80h    

_________________
Faith is a superposition of knowledge and fallacy
Post 10 Jul 2014, 22:02
View user's profile Send private message Reply with quote
shutdownall



Joined: 02 Apr 2010
Posts: 518
Location: Munich
shutdownall
This looks similar to Sinclair's ZX Basic structures. Cool

Code:
        DEFB    $31,$34,$26,$29+$80             ; LOAD
        DEFB    $31,$2E,$38,$39+$80             ; LIST
        DEFB    $31,$2A,$39+$80                 ; LET
        DEFB    $35,$26,$3A,$38,$2A+$80         ; PAUSE
        DEFB    $33,$2A,$3D,$39+$80             ; NEXT
        DEFB    $35,$34,$30,$2A+$80             ; POKE
    


For use in ASCII I would prefer

Code:
table:
db 'LIS','T'+$80
dw adr_list
db 'LOA','D'+$80
dw adr_load
    
Post 10 Jul 2014, 23:44
View user's profile Send private message Send e-mail 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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.