phat code A man will believe anything that does not cost him anything.
Main

Projects

Downloads

Articles

Links

Forum

 

View Message

Back to Messages
Plasma Thu Apr 13 2006 at 12:30 am
I'm guessing
 
 
This is a COM program and you haven't resized your memory block. Since DOS allocates all available memory to COM programs when they run, your 64K allocation is failing. And you aren't checking for errors so you didn't know that. ;)

Here's an example of how to resize your block so you can allocate more memory:

.386
.model use16 tiny

.code
org 100h
start:
        mov     ah, 4Ah         ; resize COM memory block
        mov     bx, offset data_end
        shr     bx, 4           ; convert from bytes to paragraphs
        add     bx, 65          ; round up and add 1K for the stack
        int     21h

        mov     ah, 48h         ; allocate 64000 bytes
        mov     bx, 4000
        int     21h
        mov     buffer_seg, ax

        mov     ah, 0Fh         ; save current mode
        int     10h
        push    ax

        mov     ax, 13h         ; set 13h
        int     10h

        mov     es, buffer_seg  ; write crap to the buffer
        xor     bx, bx
do_stuff:
        mov     es:[bx], bl
        inc     bx
        cmp     bx, 64000
        jb      short do_stuff

        push    ds              ; copy buffer to video
        mov     bx, es
        mov     ds, bx
        mov     bx, 0A000h
        mov     es, bx
        xor     si, si
        xor     di, di
        mov     ecx, 16000
        cld
        rep     movsd
        pop     ds

        mov     ah, 8h          ; wait for keypress
        int     21h

        pop     ax              ; restore video mode
        xor     ah, ah
        int     10h

        ret

        buffer_seg      dw      ?

data_end:

end start

 
 
 
 

Reply to this Message

Name
Subject
Message

No HTML is allowed, except for <code> <b> <i> <u> in the message only.
All URLs and email addresses will automatically be converted to hyperlinks.