flat assembler
Message board for the users of flat assembler.

Index > Main > geek question - about string tokens in real programming 16-b

Author
Thread Post new topic Reply to topic
gumletis



Joined: 18 Dec 2004
Posts: 128
gumletis
Only geeks allowed here, damn so i should't be here Shocked good bye... LOOL just kidding, my question is that i got a string. I need to do it set it in tokens(not replace a symbol with another, i know how to do that) so i need to put it in diffences reserved bytes for diffences split things, its for my compiler, i tryed my self but my code was so lol that i delete it and try make a new one, and so the same again. I have the string fx "mov ah,9" so i need to split it up with first space, and so a ",".... i know i hate to ask about full maded code, but im really stuck.... Thanks

_________________
LOOOL
Post 27 Feb 2005, 19:39
View user's profile Send private message Reply with quote
rea



Joined: 14 Nov 2004
Posts: 92
rea
Why not you make some functions for check if a character is:

A-Z a-z
0-9
punctuiation (, . : ; )
symbol ( (, ), [, ], {, })
space and termination of string


After you are done, you can use those for make a little parser Wink.

About the full code, well there is fasm Smile, also there is masm and others parsers out there, will try it, but you should wait more, I suguest try with those "hints".
Post 28 Feb 2005, 18:01
View user's profile Send private message Reply with quote
gumletis



Joined: 18 Dec 2004
Posts: 128
gumletis
fuck me! i didn't even see that the source was also realeased Very Happy

== EDIT ==
PS i know how to check where a symbols is, ex(not sure if it work, im not with my home computer so can't test it)
Code:
getsymbol:        ; Find the first symbol al in si, and return cx as the number
mov cx,0x-1
@@:
inc cx
cmp byte[si+bx],al
jne @B
RET
    

its easy to do that....

_________________
LOOOL
Post 02 Mar 2005, 08:52
View user's profile Send private message Reply with quote
rea



Joined: 14 Nov 2004
Posts: 92
rea
I supose this one can be a "start".


Code:

org 0x100
section .text
start:
        mov bx, buffer
      call GetLine
        call PrintNL
        call Print
  call PrintNL
        call FindSpaceEnd
   mov ah, 0
   int 0x21

GetLine:
        mov ah, 0x1
 push di
     xor di, di
  .getNextChar:
           int 0x21
            cmp al, 0xD
         jz .fin
                     mov [bx+di], al
                     inc di
                      jmp .getNextChar
            .fin:
           xor ax, ax
          mov [bx+di], al
             pop di
              ret

Print:
       push si
     push dx
     xor si, si
  mov ah, 0x2
 .printNextChar:
         mov dl, [bx+si]
             cmp dl, 0
           jz .end
                     int 0x21
                    inc si
                      jmp .printNextChar
          .end:
   pop dx
      pop si
      ret

PrintNL:
     push bx
     mov bx, NL
  call Print
  pop bx
      ret
 NL db 13,10,0
       
FindSpaceEnd:
       xor si, si
  mov ah, 0x2
 mov dx, si
  .nextSpace:
             mov dl, [bx+si]
             cmp dl, 0
           jz .end
             cmp dl, " "
               jnz .print_ln
                       .nextSpace1:
                    inc si
                      jmp .nextSpace
              .print_ln
           cmp dh, 0
           jz .chars0
                  call PrintNL
                .chars0:
                mov dh, 1
           .chars:
         int 0x21
            inc si
              mov dl,[bx+si]
              cmp dl, " "
               jz .nextSpace1
              cmp dl, 0
           jz .end
             jmp .chars
          .end:
   ret


section .bss
buffer resb 64
    


Note that you must change some things for getit in fasm, altought not much, specially the sections.

I will make a diferent one that can say if is a number and other things....

How you go?
Post 04 Mar 2005, 02:28
View user's profile Send private message Reply with quote
gumletis



Joined: 18 Dec 2004
Posts: 128
gumletis
okay, just hate winrar, ps thanks, ill look at it

_________________
LOOOL
Post 05 Mar 2005, 09:28
View user's profile Send private message 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.

Powered by rwasa.