flat assembler
Message board for the users of flat assembler.

Index > DOS > Text mode display problem

Author
Thread Post new topic Reply to topic
jzbl



Joined: 07 Apr 2006
Posts: 3
Location: pl.silesia
jzbl 17 Dec 2007, 00:47
This code works under WinXP commandline and through doubleclicking the com file, but does not work under DosBox, Dos, WinXP fullscreen commandline... Why?

The program draws gray crossing on the screen.

Code:
format binary
org 100h
start:
          call ustawtekst
             call drogarysuj
             waiter:         ;czekanie na klawisz 
           in al,60h    
               or al,al       
             je waiter
           mov ax, 4C00h
               int 21h
ustawtekst:
          mov ax, 0003h
               int 10h
             ret
drogarysuj:
              push $B800
          pop es
              mov di, 80*9*2          ; wyliczamy startujcy offset x (xekranu*linia-1*2)
            mov cx, 80*6                    ; szer wiersza * ilosc powt 
                xor ax,ax                               
            rysuj:
          mov ax, 8020h                   ; szara spacja (atrybut znak)
               mov [es:di], ax             
            add di, 2                                       ; zwieksz o 2 zeby nie nadpisac atrybutu
            loop rysuj
          ;pionowa
            mov di, (80/2-6)*2      ; wyliczamy offset x
                mov cx, 25                              ; ile wysokosci
             xor ax,ax
           rysuj1:
         push cx                                 ; loop uzywa cx, trzeba zachowac
            mov cx, 8                               ; szerokosc jezdni ;>
                    inner:                                      ; petla wewnetrzna
                  mov ax, 8020h           ;szara spacja
                       mov [es:di], ax
                 add di,2
                    loop inner
          pop cx
              add di, 160-16                  ; offset linii ponizej - <szerokosc jezdni * 2>
               loop rysuj1
         ret
    

_________________
jzbl
Post 17 Dec 2007, 00:47
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 17 Dec 2007, 00:53
no problem, just try to make a wait echap loop, like this, your result rest on the screen

in al,60
cmp al,1
je exit
Post 17 Dec 2007, 00:53
View user's profile Send private message Visit poster's website Reply with quote
jzbl



Joined: 07 Apr 2006
Posts: 3
Location: pl.silesia
jzbl 17 Dec 2007, 07:54
Still can't figure out why it runs in a window, but not when run in fullscreen cmd.exe...

It runs every single time in a window.

I've changed the "key press" wait section and it does not help :/

_________________
jzbl
Post 17 Dec 2007, 07:54
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 17 Dec 2007, 08:22
i have the problem too on win98
i try to fix it
Post 17 Dec 2007, 08:22
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 17 Dec 2007, 08:30
fixed
the 8020h word, is equivalent to a blinking space character, so it is invisible.
i've modified with 7f20h and it's ok.
Code:
                org 100h
                call mode3
                call crossdraw
@@:
                mov ax,0c00h
                int 21h
                in al,60h
                cmp al,1
                jne @b
exit:
                ret
mode3:
                mov ax,3
                int 10h
                mov ax,0b800h
                mov es,ax
                ret
crossdraw:
                mov di,80*9*2
                mov cx,80*6
                xor ax,ax
@@:
                mov ax,7f20h
                mov [es:di], ax
                add di,2
                loop @b
                mov di,(80/2-6)*2
                mov cx,25
                xor ax,ax
.loop:
                push cx
                mov cx, 8
@@:
                mov ax,7f20h
                mov [es:di],ax
                add di,2
                loop @b
                pop cx
                add di,160-16
                loop .loop
                ret                              
    


try to label in english and clean your code.
Post 17 Dec 2007, 08:30
View user's profile Send private message Visit poster's website Reply with quote
jzbl



Joined: 07 Apr 2006
Posts: 3
Location: pl.silesia
jzbl 17 Dec 2007, 08:40
Thanks! It works now. I've missed the whole character attribute thing.
Your code makes me wanna read some fasm docs about loop construction Smile

The comments are in Polish, because it's a school project that I later want to explain to my friends.

_________________
jzbl
Post 17 Dec 2007, 08:40
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 17 Dec 2007, 08:42
ouah, you, polish, represent in asm as i can see.

apparently, poland is the ASM land.
code in asm for school, impossible in france.

Wink Very Happy
Post 17 Dec 2007, 08:42
View user's profile Send private message Visit poster's website Reply with quote
dap



Joined: 01 Dec 2007
Posts: 61
Location: Belgium
dap 17 Dec 2007, 11:19
edfed wrote:
code in asm for school, impossible in france.

Wink Very Happy

In my school (in Belgium) we learn selfmodifying code during the first year. Wink

_________________
(French only) http://dap.developpez.com
Post 17 Dec 2007, 11:19
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.