flat assembler
Message board for the users of flat assembler.

Index > DOS > Need help getting a character from video memory...

Author
Thread Post new topic Reply to topic
Steve



Joined: 10 Sep 2005
Posts: 10
Steve
Hi. Yesterday, with a lot of help from Spook, I was able to get this:

Code:
org 100h
use16

Main:

mov ah, 09h
mov dx, textOne

int 21h

mov bx,0x0B800
mov es,bx
xor di,di

mov al,BYTE[es:di]
mov BYTE[textTwo+9],al

;cmp al, 'l'

;je PrintSuccess

;int 20h

;PrintSuccess:

xor dx,dx
xor ax,ax

mov ah, 09h
mov dx, textTwo

int 21h

int 20h

Var:

textOne db 'Hello',13,10,'$'
textTwo db 'Returns:  $'    


It's supposed to get the first character printed on screen from video memory. (Which is 'H') But, instead, it doesn't return anything. I really have no clue about segments so I'm looking for assistance to see how it should work. Any information / help on what's wrong would be great! Smile

Thank you,

- Steve
Post 09 Apr 2006, 23:20
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
So near, but so far Wink, this code, does what you want on my PC.
Code:
org 100huse16Main:mov ah,09hmov dx,textOneint 21hmov bx,0x0B800mov es,bxxor di,dimov al,BYTE[es:di]mov BYTE[textTwo+9],al;cmp al, 'l';je PrintSuccess;int 20h;PrintSuccess:xor dx,dxxor ax,axmov ah,09hmov dx,textTwoint 21hxor ax,axint 16hint 20h Var: textOne db 'Hello',13,10,'$'textTwo db 'Returns:  ', '$'    
Post 09 Apr 2006, 23:53
View user's profile Send private message Reply with quote
Steve



Joined: 10 Sep 2005
Posts: 10
Steve
Hi, Dex. Wow, such bad luck! Sad It seems I have been left out. Mad This code doesn't work for me, either. Spook's code worked on his machine and yours worked on your own.. but they both don't work on mine. Terrible... :\

- Steve
Post 10 Apr 2006, 03:16
View user's profile Send private message Reply with quote
TDCNL



Joined: 25 Jan 2006
Posts: 56
TDCNL
I've tested this piece of code too, (from you both) and it doesn't work on my PC either (WinXP SP2 Pro).

_________________
:: The Dutch Cracker ::
Post 10 Apr 2006, 07:00
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
Works on 5 win98, but not on xp, if yours is xp PC, then it does not seem to work on XP.

EDIT: I do not program on XP at all, but on some test i have just Carried out, it seems you can not directly access screen in XP.
Eg: this works fine in win98
Code:
org 100huse16Main:mov ax,0xB800mov es,axlea si,[textOne]mov di,2mov cx,10cldrep movsbxor ax,axint 16hint 20htextOne db 'H e l l o '    
But not in XP Sad .
screenshot:


Description:
Filesize: 14.09 KB
Viewed: 1227 Time(s)

hello.jpg


Post 10 Apr 2006, 11:23
View user's profile Send private message Reply with quote
Steve



Joined: 10 Sep 2005
Posts: 10
Steve
What a shame.. Mad Oh well, thanks for helping me find out what was wrong. Very Happy
Post 10 Apr 2006, 16:02
View user's profile Send private message Reply with quote
Dex4u



Joined: 08 Feb 2005
Posts: 1601
Location: web
Dex4u
Theres always DOSBox, runs great even on XP Wink .
http://dosbox.sourceforge.net/news.php?show_news=1
Post 10 Apr 2006, 19:01
View user's profile Send private message Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
Matrix
Code:

mov ax,$0003
int 10h

    


put this at the beginning, and try on XP Wink
Razz
Post 10 Apr 2006, 21:08
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.