flat assembler
Message board for the users of flat assembler.

Index > Examples and Tutorials > comile error

Author
Thread Post new topic Reply to topic
ricar2ce



Joined: 05 Feb 2020
Posts: 4
ricar2ce
can someone help me and tell me why when I compile this code, it returns the image error (Error: invalid value)
thanks in advance

Code:
format binary as 'img'
ORG 7C00h
MOV AX,CS
MOV DS,AX
XOR EAX, EAX

MOV EDI,0B8000h
MOV AH,0
MOV AL,3
INT 10h

  ADD EDI, 526
  MOV AH,00001010b
  MOV ESI, asigna
  CALL imprimir
  ADD EDI,160
  MOV ESI, separa
  CALL imprimir
  MOV ESI, linea1
  CALL imprimir
  MOV ESI, linea2
  CALL imprimir
  MOV ESI, linea3
  CALL imprimir
  MOV ESI, linea4
  CALL imprimir
  MOV ESI, linea5
  CALL imprimir
  MOV ESI, separa
  CALL imprimir
  ADD EDI,160
  MOV ESI, present
  CALL imprimir
  MOV ESI, nombre1
  CALL imprimir
  MOV ESI, nombre2
  CALL imprimir
  MOV ESI, nombre3
  CALL imprimir
  MOV ESI, nombre4
  CALL imprimir
  jmp fin

imprimir:
    MOV EBX,EDI
  ciclo:
    MOV AL,[ESI]
    CMP AL,'$'
    je salto
    MOV [EDI], AX
    INC ESI
    ADD EDI,2
    loop ciclo
   salto:
    ADD EBX,160
    MOV EDI,EBX
    XOR AL,AL
    XOR EBX,EBX
    ret

asigna db ' Arquitectura de las Computadoras$'
separa db '==================================$'
linea1 dB ' ###  #  #  ##    ####  #  #  #  #$'
linea2 db '#     #  #  # #   #  #  # #   #  #$'
linea3 db ' ##   #  #  #  #  #  #  ##    #  #$'
linea4 db '   #  #  #  # #   #  #  # #   #  #$'
linea5 db '###    ##   ##    ####  #  #   ##$'
present db 'Estudiantes:$'
nombre1 db '- Ricardo Comendador Escalona$'
nombre2 db '- Osmaray Martínez$'
nombre3 db '- Yoandry Baró Fortune$'
nombre4 db '- Sergio$'

fin:
JMP $

times 510-($-$$) dB 0
dW 0xaa55

    


Description:
Filesize: 24.39 KB
Viewed: 2136 Time(s)

error.jpg


Post 05 Feb 2020, 14:02
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17452
Location: In your JS exploiting you and your system
revolution
Probably because your code and text is more than 510 bytes.

The value "510-($-$$)" will come out as a negative number.

Try with this:
Code:
...
fin:
JMP $

if 510-($-$$) < 0
        err
end if
times 510-($-$$) dB 0
dW 0xaa55    
Post 05 Feb 2020, 14:33
View user's profile Send private message Visit poster's website Reply with quote
ricar2ce



Joined: 05 Feb 2020
Posts: 4
ricar2ce
revolution wrote:
Probably because your code and text is more than 510 bytes.

The value "510-($-$$)" will come out as a negative number.

Try with this:
Code:
...
fin:
JMP $

if 510-($-$$) < 0
        err
end if
times 510-($-$$) dB 0
dW 0xaa55    


Thank you very much for responding so soon.
I made the suggested changes and now I have this answer


Description:
Filesize: 13.58 KB
Viewed: 2119 Time(s)

Imagen de Portapapeles (1).jpg


Post 05 Feb 2020, 17:06
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17452
Location: In your JS exploiting you and your system
revolution
So that shows that your code is more than 510 bytes. You need to shorten it.
Post 05 Feb 2020, 17:32
View user's profile Send private message Visit poster's website Reply with quote
ricar2ce



Joined: 05 Feb 2020
Posts: 4
ricar2ce
how is this possible with only 78 lines of code
Post 05 Feb 2020, 21:27
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17452
Location: In your JS exploiting you and your system
revolution
ricar2ce wrote:
how is this possible with only 78 lines of code
You also have a large amount of text in there:
Code:
asigna db ' Arquitectura de las Computadoras$'
separa db '==================================$'
linea1 dB ' ###  #  #  ##    ####  #  #  #  #$'
linea2 db '#     #  #  # #   #  #  # #   #  #$'
linea3 db ' ##   #  #  #  #  #  #  ##    #  #$'
linea4 db '   #  #  #  # #   #  #  # #   #  #$'
linea5 db '###    ##   ##    ####  #  #   ##$'
present db 'Estudiantes:$'
nombre1 db '- Ricardo Comendador Escalona$'
nombre2 db '- Osmaray Martínez$'
nombre3 db '- Yoandry Baró Fortune$'
nombre4 db '- Sergio$'    
Post 05 Feb 2020, 21:29
View user's profile Send private message Visit poster's website Reply with quote
ricar2ce



Joined: 05 Feb 2020
Posts: 4
ricar2ce
Sorry for the inconvenience, what did you propose to do?
fasm has no solution for this?
Post 06 Feb 2020, 00:06
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17452
Location: In your JS exploiting you and your system
revolution
Either make your text shorter, or put your text into another sector.
Post 06 Feb 2020, 00:38
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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.