News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

INT 10, AH=13 cursor

Started by redskull, September 11, 2009, 11:27:52 AM

Previous topic - Next topic

redskull

Hey -

Does anybody have any evidence to support the behavior of INT 10,13 (write string) as it relates to the cursor?  According to ralph brown, setting the write mode (using bit 0 of AL) will cause it to either update the cursor position or not after the write, however in my experience it fails to do so in either case.  The best it seems to do is return the new cursor position in DH,DL, which is behavior I can't find documented anywhere, yet retrieving the position via INT 10, 3 still reports where it was before the call.  Is my BIOS just unique, or is this the way it's intended?

-r
Strange women, lying in ponds, distributing swords, is no basis for a system of government

FORTRANS

Hi redskull ,

   Coded up a test case and it works as advertised here.  The
cursor is moved to the end of the string if AL = 1.

Regards,

Steve N.

dedndave

that piece of BIOS code is in the video adapter BIOS - not the machine BIOS
the machine BIOS has INT 13h code in it, but it gets replaced when the video adapter installs itself (before the OS boots)
it sounds to me like a bug in the video adapter

FORTRANS

Hi,

   Oh, just checked, all registers unchanged.  RADEON video
card (good point Dave).

Steve

redskull

It must just be unique to my video card (cheap Intel chipset on motherboard, Intel(R) G33/G31 Express Chipset Family), unless I'm doing something wrong. My test case:


.8086
.model tiny
option casemap:none


.code
org 100h

start:

mov ah, 00h
mov al, 03h
int 10h         ; set text video mode, 80x25

mov ah, 05h
mov al, 0h
int 10h         ; set active page 0

mov ax, cs
mov es, ax      ; set up ES register

mov dx, 0000h         ; write at 0,0

mov bp, OFFSET Msg1
mov cx, SIZEOF Msg1
mov ax, 1301h ; AH=13, AL=01 (Write String, no attributes, cursor advance)
mov bx, 1007h ; BH=00, BL=07 (Video page 0, light gray on black)
int 10h

mov ah, 03h
mov bh, 00h
int 10h           ; get cursor position in dh,dl

mov bp, OFFSET Msg2
mov cx, SIZEOF Msg2
mov ax, 1301h ; AH=13, AL=01 (Write String with no attributes)
mov bx, 1007h ; BH=00, BL=07 (Video page 0, light gray on black)
int 10h
ret

Msg1 db 'This is a particular message!'
Msg2 db 'This is another message!'
END start





It gives the output:

This is another message!sage!

showing that it reset the cursor back to the beggining.

However, if you take out the call to get the cursor position between the string outputs, then the new cursor position shows up in DH,DL after the first call, ready to go for the second:

Output using the returned DH,DL values from first call:
This is a particular message!This is another message!

which is what I was expecting.

Thanks for the verification

-r
Strange women, lying in ponds, distributing swords, is no basis for a system of government

FORTRANS

Hi,


mov bx, 1007h ; BH=00, BL=07 (Video page 0, light gray on black)


   Well BH is 10H, not 0.

   Here's my version.


        PAGE ,132
        TITLE Test10
        NAME  Test10
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Test BIOS Int 10H string function.  11 Sept 09, SRN.

; MASM Test10;
; LINK Test10;
; EXE2BIN Test10.EXE Test10.COM

CODE    SEGMENT
        ASSUME  CS:CODE,DS:CODE
        ORG     100H    ; COM file opening
START:
        MOV     AX,CS   ;\
        MOV     DS,AX   ; If run as an EXE...
        MOV     ES,AX   ;/
        JMP     Setup

; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Data for main program.

Hello   DB      ' Hit a key. ', 13, 10, ' Test of cursor positioning.'
Len     DW      Len - Hello
; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
; Main program.
Setup:
        MOV     AX,3H   ; Not really needed, but it
        INT     10H     ; clears the screen.

        MOV     AH,13H  ; Video BIOS Print String function,
        MOV     AL,1    ; Move cursor,
        MOV     BX,07   ; BL Attribute, BH Page Number,
        MOV     CX,[Len]; CX Sting Length,
        MOV     DH,3    ; DH Row to start displaying (zero based),
        MOV     DL,0    ; DL Column to start displaying,
        MOV     BP,OFFSET Hello ; and ES:BP far pointer to string.
        INT     10H     ; Video BIOS interrupt

; Wait for things to settle down, get user to hit a key.
        MOV     AH,10H  ; Read Extended Keyboard Input.
        INT     16H     ; {Used for a pause.  Not needed, but makes the
                        ; message legitimate.}
        MOV     AH,4CH
        MOV     AL,0
        INT     21H     ; Exit to DOS

; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CODE    ENDS
        END     START


FWIW,

Steve N.

redskull

Quote from: FORTRANS on September 11, 2009, 03:12:08 PM
Well BH is 10H, not 0.

Dammit, that was it right there.  I guess for whatever reason, fixing that solved the problem.  I suppose I should be checking my code for typos, and not just my comments :red
I wonder why the output still worked, but the cursor update didn't?  There isn't any page 10h in text mode right, only up to 8?  Oh well, ces la vie.
Thank you again, a second set of eyes always helps.

-r
Strange women, lying in ponds, distributing swords, is no basis for a system of government