0

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
2
Contributors
1
Reply
7
Views
7 Years
Discussion Span
Last Post by Goalatio
0

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.

Edited by Goalatio: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.