Howdy, Stranger!

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

Categories

GetLine problem ...

I'm newbie in ASM ... I've tried to read AOAP (art of asm)
and I understand the theory ... arhitecture ... and so on
but I found hard to do the exams ...
All the codes in the book are in MASM and I'm tring to
rewrite them in FASM (MASM I have refuse to work :))))
I tried to do this simple program couple of times but
all I get is ERR's...
****************************************************
; A stupid GetLine prog
; it should read chars until CR or
; while their number (si) <= 10

jmp start
bafer: times 10 db 0x0D ; if you have some advice about
; reserving buffer pls tell me
; I tried alone and this is it ... :)))
start:
mov si, 0 ; counter
citaj:
mov ah, 0x00
int 0x16
cmp al, 0x0D
je pecati
mov [bafer+si], al
inc si
cmp si, 10
je pecati
jmp citaj
pecati:
mov si, 0
l1:
cmp si, 10
je kraj
mov al, [bafer+si]
cmp al, 0x0D
je kraj
mov ah, 0x0E
int 0x10
inc si
jmp l1

kraj:
mov ah, 0x4C ; I don't even know
mov al, 0x00 ; if I have to write this
int 0x21 ; at the end of every prog ????
*******************************************************
I'm using FASM for WinGUI ... Win2000

First when I tried to use cx as counter I got compile time err
mov [bafer+cx], al -> reserved word used as symbol ?!@??!@?????

... so I tried si ... why? ... why not :)))

I suceseed to assemble it and then everything went wrong ...
If I input couple of chars and press ENTER (CR) it prints back
the chars and some crazy ASCII symbols:
I.E: Input: 1234(CR)
Output: 1234(6 other ASCII symbols)
Input: 121(CR)
Output: 121 (7 other symbols)

Symbols are aways the same so I guess they are in the buffer
and that's why the prog prints 10 chars (there are no CR to stop it)
But I've inicialize my buffer with 0x0D (CR) what have happend ??????????????

After that I tried 2 other examples:
Input: 123456789(CR)
Output: a win meesage: ... CPU has encounter a illegal instruction ...
????????????????? NO COMENT ??????????????????
Input: 1234567890
Output: couple of rows with ASCII symbols and couple of screens
like this: -h-h-h-h-h-h-h-h-h-h-h-h-h-h-h-h-h-h-h-h-h-h-h-...
?????????????????? NO COMENT AGAIN ???????????????????????

I know I wrote a lot for a such simple prog but WHAT THA HELL IS GOING ON ????

so if anybody can help ????
THX

PC-SandMan^^
... And justice for all ...

Comments

  • PCSandManPCSandMan Member Posts: 27
    Ok if anybody interested
    I found the mistake
    all I had to do is write org 256 at the begining because of the .com PSP format ...

    PC-SandMan^^
    ... To Live is to die ...
Sign In or Register to comment.