Hi, I apologize if my english is bad, I need some help printing the value of a variable in the code that I show below, I'm using emu8086 and I need that this works in this code example that is the same that comes in the examples of emu8086 (PrinterDemo.asm) with a little of modification that is of what I need to print.

Thanks for your help

; the printer demonstration.

; this is simplified/ms-dos complatible version.

; this example may not work on Windows XP, however it may work for Windows 95/98:
; http://support.microsoft.com/default.aspx?scid=kb;en-us;Q258878

; the printer device is created by Andrew Nelis.

; the original example that uses i/o ports that are unique to the emulator is located here:
; c:\emu8086\DEVICES\DEVELOPER\sources\Printer_emulation_demo.asm


name "printer"

org 100h

jmp start

quanthamb db 1 
              
quantfries db 2

quantsoda db 3

msg db "*****************", 0Ah, 0Dh
    db "*  COMPANY - X  *", 0Ah, 0Dh
    db "*****************", 0Ah, 0Dh
    db "", 0Ah, 0Dh
    db "Order No. 1", 0Ah, 0Dh
    db "    1", 0Ah, 0Dh
    db "   11", 0Ah, 0Dh
    db "  1 1", 0Ah, 0Dh
    db "    1", 0Ah, 0Dh
    db "    1", 0Ah, 0Dh
    db "    1", 0Ah, 0Dh
    db " 1111111", 0Ah, 0Dh
    db "", 0Ah, 0Dh
    db "Burguer - quantity -", 0Ah, 0Dh
        db "", 0Ah, 0Dh
    db "Fries - quantity -", 0Ah, 0Dh
        db "", 0Ah, 0Dh
    db "Soda - quantity -", 0Ah, 0Dh
  
msg_end db 0
msg2 db "press any key to eject the page.$"

start:
    mov dl, 12      ; form feed code. new page.
    mov ah, 5
    int 21h


    mov si, offset msg
    mov cx, offset msg_end - offset msg
print:
    mov dl, [si]
    mov ah, 5       ; MS-DOS print function.
    int 21h
    inc si	        ; next char.
    loop print
   
    mov dx, offset msg2
    mov ah, 9
    int 21h
   
    mov ax, 0       ; wait for any key...
    int 16h

    mov dl, 12      ; form feed code. page out!
    mov ah, 5
    int 21h
    
ret

I don't see what you are trying to do? Which variable do you want to print the value of.. ?
Try this out, and respond with your results.

mov al,VARIABLENAME
storage db 0, "$"
mov [storage],al
mov ah,9
mov dx,storage
int 21h

That uses DOS vector 21h ("$" = string terminator), replace VARIABLENAME with the variable you are trying to display!

This works in NASM16, I cannot be sure it will work on your assembler.

; the printer demonstration.
; this is simplified/ms-dos complatible version.
; this example may not work on Windows XP, however it may work for Windows 95/98:
; http://support.microsoft.com/default.aspx?scid=kb;en-us;Q258878
; the printer device is created by Andrew Nelis.
; the original example that uses i/o ports that are unique to the emulator is located here:
; c:\emu8086\DEVICES\DEVELOPER\sources\Printer_emulation_demo.asm

.model Tiny
.code           ; Segmentierung - nur 1 Segment!
ORG 100h
;name "printer"  ;???
;jmp start

start:
    mov dl, 12      ; form feed code. new page.
    mov ah, 5
    int 21h
    mov si, offset msg
    mov cx, offset msg_end ; offset msg
print:
    mov dl, [si]
    mov ah, 5       ; MS-DOS print function.
    int 21h
    inc si          ; next char.
    loop print

    mov dx, offset msg2
    mov ah, 9
    int 21h

    mov ax, 0       ; wait for any key...
    int 16h
    mov dl, 12      ; form feed code. page out!

    mov ah, 5
    int 21h

ret

quanthamb db 1               
quantfries db 2
quantsoda db 3

msg db "*****************", 0Ah, 0Dh
    db "*  COMPANY - X  *", 0Ah, 0Dh
    db "*****************", 0Ah, 0Dh
    db 0Ah, 0Dh
    db "Order No. 1", 0Ah, 0Dh
    db "    1", 0Ah, 0Dh
    db "   11", 0Ah, 0Dh
    db "  1 1", 0Ah, 0Dh
    db "    1", 0Ah, 0Dh
    db "    1", 0Ah, 0Dh
    db "    1", 0Ah, 0Dh
    db " 1111111", 0Ah, 0Dh
    db 0Ah, 0Dh
    db "Burguer - quantity -", 0Ah, 0Dh
    db 0Ah, 0Dh
    db "Fries - quantity -", 0Ah, 0Dh
    db 0Ah, 0Dh
    db "Soda - quantity -", 0Ah, 0Dh

msg_end db 0
msg2 db "press any key to eject the page.$"

end start

I think the .model tiny directive for the assembler is missing. You also did NOT use a segment declaration.
As it is just ONE segment in tiny model, one single and simple .CODE is sufficient.
Also for compilation use "tasm file" and "tlink /t file" or "ml /c /AT file.asm" and "link16 /t file.obj"

In general it is better to post declarations at the end after int21h, ah - 4ch, but before- end start

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.