×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Crash-happy VGA writing

Crash-happy VGA writing

Crash-happy VGA writing

(OP)
An asm prog of mine keeps crashing, and I can't figure out why. It has as simple loop like this that copies a 64000 byte array into the VGA segment (the mode is set already) The buffers and everything else is arleadey set up.  This is only a part of the prog.

mov DI,0a00h
mov ES,DI
mov DI,0
mov SI,seg buffer0[0]
mov DS,SI
mov SI,0

copyloop:
mov AL,DS:[SI]
mov ES:[DI],AL
inc SI
inc DI
cmp SI,64000
jnz copyloop

When I run this, it crashes my computer. Some other notes:

This works fine:

mov DI,0a00h
mov ES,DI
mov DI,0
mov SI,seg buffer0[0]
mov DS,SI
mov SI,0

copyloop:
mov AL,DS:[SI]
mov ES:[DI],AL
inc SI
;inc DI
cmp SI,64000
jnz copyloop

And this works fine:

mov DI,0a00h
mov ES,DI
mov DI,0
mov SI,seg buffer0[0]
mov DS,SI
mov SI,0

copyloop:
mov AL,DS:[SI]
;mov ES:[DI],AL
inc SI
inc DI
cmp SI,64000
jnz copyloop

And so does this:
mov DI,0a00h
mov ES,DI
mov DI,0
mov SI,seg buffer0[0]
mov DS,SI
mov SI,0

copyloop:
mov AL,DS:[SI]
mov ES:[DI],AL
inc SI
inc DI
cmp SI,100 ;notice the change in steps
jnz copyloop

I can't figure it out. And it only happens when copying to the VGA segment, copying to other buffers works fine.

Any help is appreciated.


RE: Crash-happy VGA writing

mmm... you're testing seems thorough... I like that. I'm not much on segmented memory models & I don't have dos @ work so I can't test this but it seems to me that you're blowing past the end of your segment.

You can test this by printing your addresses out & seeing where it dies.

Off-hand... a00h (2560) + 64000 = 66560 > 65536 would be the culprit.  Then again...

RE: Crash-happy VGA writing

(OP)
Yeah, but it dies even if I just write near 10,000.  That shouldn't happen.  And by the way, the whole 0a00h is a type, I meant 0a000h.  So that's not the problem, just in case you wondered.  Thanks for the help, let me know if you have any other ideas.

RE: Crash-happy VGA writing

hello
the vga memory is at 0a000h
change es to 0a000h and di to 0
than use movsb [w][d]like below
mov  cx, 64000
rep movsb
or
mov cx,32000
rep movsw
or
mov cx, 16000
rep movsd      

RE: Crash-happy VGA writing

Just what mode are you using...? Only 64000 byte mode I know is mode 13h, 320x200x256... maybe your card doesn't support this mode nicely anymore?

"Information has a tendency to be free.  Which means someone will always tell you something you don't want to know."

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close