flat assembler
Message board for the users of flat assembler.

Index > DOS > Clear Screen - Position Cursor - get key press

Author
Thread Post new topic Reply to topic
Kmogi



Joined: 26 Oct 2014
Posts: 2
Kmogi
Trying to clear the screen using '0' for test purpose. The Key press seems to work and the set cursor position work, but I moving a bunch of zero somewhere. Does not show up on the screen. Code compiles ok and executes on 32bit system, but does not execute on a 64bit system. So my two questions are how do I get a screen full of zeros from the code below. And 2nd is how do I compile this code so that I will execute on a 64bit system running windows 8.

Code:
format MZ

;entry .code:start

segment .data

data1   db      52H
data2   db      29H 
total   db      ?
msg:    db      "Hello, World!", 0

segment .code

start:
 push ax       ;move as to ax
 push es 
 mov ax,0b800h ; Start at memory 0b800 
 mov es,ax     ; move video address to es register
 xor di,di     ; zero di register
 mov cx,2000   ; set counter 25 lines by 80 chars.
 mov al,30h    ; character to write 0 for testing
 mov ah,31     ; character attribute blu bg white fg
 ;mov ax,0720h ; Black bg, white fg, 20h = space char

 rep stosw     ; move ax to video memory
 pop ax 
 pop es

 mov ah,2h
 mov bh,0
 mov dh,24
 mov dl,10
 int 10h

 mov ah,0      ; get keypress
 int 16h
done:
 mov ah, 4Ch   ; dos terminate function
 int 21h    
    

_________________
Kmogi
Post 26 Oct 2014, 16:43
View user's profile Send private message Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1399
Location: Toronto, Canada
AsmGuru62
On 64 bit OS you need DOSBox to run the 16-bit code.
The code writing zeroes seems ok - I do not see any issues.
Post 26 Oct 2014, 17:01
View user's profile Send private message Send e-mail Reply with quote
Kmogi



Joined: 26 Oct 2014
Posts: 2
Kmogi
I was trying to avoid DOSBox. I was hoping that It would be possible to compile a program compatible with 64bit system. Is that not possible? As for the 0's , I do not see them. I just have a black screen. The coded seemed correct to me as well.
Post 26 Oct 2014, 17:29
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1903
DOS386
1. Welcome to the FASM forum

2. Please use {code} {/code} (I edited your post)

> possible to compile a program compatible with 64bit system

Brew a Win32 app (and use Windows subforum).

> I just have a black screen

Did you try in DOS?
Post 27 Oct 2014, 00:13
View user's profile Send private message Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1399
Location: Toronto, Canada
AsmGuru62
Kmogi:
You can write a Win32 Console program and fill the screen with 0s.
But that would be different code. The code you have is decades old MS DOS code
and it will no longer run on x64, unless using DOSBox.

The Console API is here:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682087(v=vs.85).aspx
Post 27 Oct 2014, 10:47
View user's profile Send private message Send e-mail 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.

Powered by rwasa.