In a message to Rich Veraa, Scott McNay wrote:
JD> {
JD> mov ah,15
JD> int 16
JD> push dx
JD> mov ax,y
JD> cmp ax,24
JD> ja, end
JD> mov dh, al
JD> mov ax,x
JD> cmp ax,79
JD> ja end
JD> mov dl,al
JD> mov ah,2
JD> int 16
JD> end:
JD> pop dx
JD> }
JD> This was my locate command, of course OS2 hates it. I just was
JD> looking for a simple way to do the same in an OS2 program.
RV> Are these DOS interrupts? I couldn't find a AH=15 INT 16 in
RV> Ralf Brown's list. If you'd tell me what this interrupt
RV> does, I could perhaps find you the appropriate API calls.
SM> You must have missed it; I found it without trouble:
SM> --------V-100F-------------------------------
SM> INT 10 - VIDEO - GET CURRENT VIDEO MODE
SM> AH = 0Fh
SM> Return: AH = number of character columns
SM> AL = display mode (see #0009 at AH=00h)
SM> BH = active page (see AH=05h)
There's an API call: GetVideoModeInfo that returns column, rows, and colors.
This is the assembly code that Virtual Pascal generates for a 3-line demo
program (in comment lines).
;
; Virtual Pascal Version 1.10 Copyright (C) 1996 fPrint UK Ltd ;
.386P
IFDEF ??VERSION
LOCALS @@
ENDIF
CODE32 SEGMENT DWORD USE32 PUBLIC 'CODE'
CODE32 ENDS
CONST32 SEGMENT DWORD USE32 PUBLIC 'CONST'
CONST32 ENDS
DATA32 SEGMENT DWORD USE32 PUBLIC 'DATA'
DATA32 ENDS
TLS SEGMENT DWORD USE32 PUBLIC 'TLS'
TLS ENDS
BSS32 SEGMENT DWORD USE32 PUBLIC 'BSS'
BSS32 ENDS
DGROUP GROUP CONST32, DATA32, TLS, BSS32
.MODEL FLAT
CODE32 SEGMENT
ASSUME CS:FLAT, DS:FLAT, SS:FLAT, ES:FLAT
Program@Code@ EQU $
ALIGN DWORD
Program@$Init PROC NEAR
@@?0:
;
; begin
;
MOV ECX,OFFSET Program@Const@+34h
MOV EAX,4000h
CALL System@_InitExe
CALL System@$Init
ENTER 0,0
PUSH 0
CALL System@_StkChk
;
; GetVideoModeInfo( Cols, Rows, Colours );
;
PUSH OFFSET Program@Cols
PUSH OFFSET Program@Rows
PUSH OFFSET Program@Colours
CALL VPUtils@GetVideoModeInfo
;
; Writeln( 'The current display is ',Cols, 'x', Rows ); ;
PUSH OFFSET System@Output
PUSH OFFSET Program@Const@
PUSH 0
CALL System@_TxtWStr
PUSH DWORD PTR Program@Cols
PUSH 0
CALL System@_TxtWInt
PUSH 78h
PUSH 0
CALL System@_TxtWChar
PUSH DWORD PTR Program@Rows
PUSH 0
CALL System@_TxtWInt
CALL System@_TxtWLn
CALL System@_IOChk
;
; Writeln( 'The number of colours is ', Colours );
;
PUSH OFFSET System@Output
PUSH OFFSET Program@Const@+18h
PUSH 0
CALL System@_TxtWStr
PUSH DWORD PTR Program@Colours
PUSH 0
CALL System@_TxtWInt
CALL System@_TxtWLn
CALL System@_IOChk
;
; end.
;
MOV ESP,EBP
POP EBP
PUSH 0
CALL System@_Halt
Program@$Init ENDP
; EXTERNALS
EXTRN System@_Halt:PROC
CODE32 ENDS
CONST32 SEGMENT
Program@Const@ EQU $
DB 17h, 54h, 68h, 65h, 20h, 63h, 75h, 72h ;'.The cur'
DB 72h, 65h, 6Eh, 74h, 20h, 64h, 69h, 73h ;'rent dis'
DB 70h, 6Ch, 61h, 79h, 20h, 69h, 73h, 20h ;'play is '
DB 19h, 54h, 68h, 65h, 20h, 6Eh, 75h, 6Dh ;'.The num'
DB 62h, 65h, 72h, 20h, 6Fh, 66h, 20h, 63h ;'ber of c'
DB 6Fh, 6Ch, 6Fh, 75h, 72h, 73h, 20h, 69h ;'olours i'
DB 73h, 20h, 00h, 00h ;'s ..'
DD OFFSET Program@Tls@
DD OFFSET Program@Bss@
DD OFFSET Program@Code@
DB 0FFh,0FFh,0FFh,0FFh, 56h, 50h, 55h, 4Dh ;'....VPUM'
DB 20h, 00h, 00h, 00h ;' ...'
DD OFFSET Program@Code@
DD OFFSET Program@Const@
DD OFFSET Program@Data@
DD OFFSET Program@Tls@
DD OFFSET Program@Bss@
DD OFFSET System@ExitCode
DD OFFSET System@InOutRes
DD OFFSET System@Input
; EXTERNALS
; NONE
CONST32 ENDS
DATA32 SEGMENT
Program@Data@ EQU $
; EXTERNALS
EXTRN System@ExitCode:BYTE
DATA32 ENDS
TLS SEGMENT
Program@Tls@ EQU $
; EXTERNALS
EXTRN System@InOutRes:BYTE
TLS ENDS
BSS32 SEGMENT
Program@Bss@ EQU $
Program@Cols DB 4 DUP(?)
Program@Rows DB 4 DUP(?)
Program@Colours DB 4 DUP(?)
; EXTERNALS
EXTRN System@Input:BYTE
BSS32 ENDS
STACK32 SEGMENT DWORD USE32 STACK 'STACK'
DB 16384 DUP(?)
STACK32 ENDS
INCLUDELIB OS2.LIB
; PUBLICS
PUBLIC Program@$Init
PUBLIC Program@Rows
PUBLIC Program@Colours
PUBLIC Program@Cols
PUBLIC Program@Code@
PUBLIC Program@Const@
PUBLIC Program@Data@
PUBLIC Program@Tls@
PUBLIC Program@Bss@
END Program@$Init
Cheers,
Rich
http://www.netside.net/~rveraa/
---------------
* Origin: Birdsoft - North Miami (1:135/907)
|