Hi guys,

/* increment our line if paginating, display message at end of screen */
static int incline(void) {
  if (!optP) return E_None;
  if (++line >= MAX_Y) {
    line = 0;
    return pause();
  }
  return 0;
}

Now the obvious question of course is "what is MAX_Y?". And one grep
later, I've got the answer:

$ grep 'MAX_Y' -R *
cmd/dir.c:  if (++line >= MAX_Y)
include/misc.h:#define MAX_Y (*(unsigned char far*)MK_FP(0x40, 0x84))
include/misc.h:#define SCREEN_ROWS (MAX_Y + 1)
(...)

Yes, I've also run into such phenomenon although in that case, the screen _width_ was zero by buggy BIOS.

The Drivers unit in Borland Pascal's Turbo Vision fetches the screen height like this (comments by me), SetCrtData() is to be called:

[...]

{ Save registers and call video interrupt }

procedure VideoInt; near; assembler;
asm
        PUSH    BP ; save registers that are destroyed in buggy BIOS'es
        PUSH    ES
        INT     10H
        POP     ES
        POP     BP
end;

{ Return CRT mode in AX and dimensions in DX }

procedure GetCrtMode; near; assembler;
asm
        MOV     AH,0FH   ; "get current video mode" function
        CALL    VideoInt ; video mode in AL, screen width in AH
        PUSH    AX
        MOV     AX,1130H ; "get font information" function
        MOV     BH,0     ; request for arbitrary pointer
        MOV     DL,0     ; pre-load with default value
        CALL    VideoInt ; last row number in DL
        POP     AX
        MOV     DH,AH    ; screen width in DH
        CMP     DL,25    ; for more than 25 rows, hires screen is
        SBB     AH,AH    ;  marked in high byte of video mode
        INC     AH
end;

{ Set CRT data areas and mouse range }

procedure SetCrtData; near; assembler;
asm
        CALL    GetCrtMode
        MOV     CL,1           ; by default, hires screen
        OR      DL,DL
        JNE     @@1            ; for an invalue last row number of 0,
        MOV     CL,0           ;  correct to to lores screen and last row
        MOV     DL,24          ;  number of 24
@@1:    INC     DL             ; convert last row number to screen height
        MOV     ScreenMode,AX  ; store video mode, screen width/height,
        MOV     ScreenWidth,DH ;  hires/lores screen
        MOV     ScreenHeight,DL
        MOV     HiResScreen,CL
        XOR     CL,1           ; set hires screen as non-snowing, lores
        MOV     BX,SegB800     ;  as snowing, set color video segment
        CMP     AL,smMono
        JNE     @@2
        MOV     CL,0           ; for mono mode, non-snowing, set mono
        MOV     BX,SegB000     ;  video segment
@@2:    MOV     CheckSnow,CL   ; dis-/enable snow checking

[...]


The whole point is that CGA's (that need snow checking) can be detected exactly by the invalid last row number of 0.

Joe
--
KOVÁCS Balázs alias Joe Forster/STA      s...@c64.org; http://sta.c64.org
Don't E-mail spam, HTML or uncompressed files! More contacts on homepage
------------------------------------------------------------------------------
_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to