×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

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

Another question :) Getting data back from the display

Another question :) Getting data back from the display

Another question :) Getting data back from the display

(OP)
I am in the process of printing some data to the screen in Assembly. Basically what I am doing is making a happy face slowly run accross the screen. The problem with this is that it deletes the text that was there before the happy face was so I end up with a black line on the screen. How would I go about getting the character that was displayed before I erase it so I could print it back to the screen when I am done?

Below you will find my program:

.model small
.stack 100h
.data
.code
drive proc
call clear    ;clears the entire screen
call move    ;Moves the smile around on the screen!
mov ax,4C00h
int 21h
drive endp




clear proc
mov ax,0b800h
mov ds,ax
mov ax, 0FDBh    ;WHITE BLOCK character on a black backgroubd
next:

mov [bx],ax    ;Places blank character onthe screen
add bx,2        ;Moves over one loaction
cmp bx,0FA0h    ;Checks to see if we are at the end of the display
jl next            ;if we aren't at the end keep moving
ret
clear endp


move proc
mov ax,0B800h    ;The start of the display
mov ds,ax
mov ax,02001h    ;AH=Blank character    AL=:)
mov bx,0A00h    ;BX points the the leftmost possition
again:
***I want to get the character from the screen here
mov [bx],al        ;Draws a smile on the loaction
call delay
***I want to write the old character to the screen now
add bx,2
cmp bx,0AA0h    
jl again
ret
move endp

delay proc
mov cx,070h
outer:
dec cx
jl done
mov dx,0
inner:
inc dx
jne inner
jmp outer
done:
ret
delay endp
end drive


Thanks for your help
Smilee

RE: Another question :) Getting data back from the display

Hi SmileeTiger,

From what I gather from your code, you are writing directly to screen memory. So to get the already-displayed character, simply read from that particular memory location and store it in a variable before printing the smiley to the screen.

Hope that helps.

RE: Another question :) Getting data back from the display

(OP)
Actually that's what I want to do but I am not sure how to do it :P

RE: Another question :) Getting data back from the display

Hi,

I will try to modify it for you below:

oldchar      db    ?

move proc
mov ax,0B800h    ;The start of the display
mov ds,ax
mov bx,0A00h    ;BX points the the leftmost possition
again:
mov al, [bx]
mov oldchar, al
mov ax, 2001h
mov [bx],al        ;Draws a smile on the loaction
call delay
mov al, oldchar
mov [bx], al
add bx,2
cmp bx,0AA0h    
jl again
ret
move endp

I hope the above helps. :))

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