1 | ; File name : DisplayPage.asm
|
---|
2 | ; Project name : Assembly Library
|
---|
3 | ; Created date : 26.6.2010
|
---|
4 | ; Last update : 3.7.2010
|
---|
5 | ; Author : Tomi Tilli
|
---|
6 | ; Description : Functions for managing display page.
|
---|
7 |
|
---|
8 | ; Section containing code
|
---|
9 | SECTION .text
|
---|
10 |
|
---|
11 | ;--------------------------------------------------------------------
|
---|
12 | ; DisplayPage_SetFromAL
|
---|
13 | ; Parameters:
|
---|
14 | ; AL: New display page
|
---|
15 | ; DS: BDA segment (zero)
|
---|
16 | ; Returns:
|
---|
17 | ; Nothing
|
---|
18 | ; Corrupts registers:
|
---|
19 | ; AX, DX
|
---|
20 | ;--------------------------------------------------------------------
|
---|
21 | ALIGN JUMP_ALIGN
|
---|
22 | DisplayPage_SetFromAL:
|
---|
23 | xor ah, ah
|
---|
24 | mul WORD [VIDEO_BDA.wBytesPerPage] ; AX = Offset to page
|
---|
25 | mov [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fpCursorPosition], ax
|
---|
26 | ret
|
---|
27 |
|
---|
28 |
|
---|
29 | ;--------------------------------------------------------------------
|
---|
30 | ; DisplayPage_GetColumnsToALandRowsToAH
|
---|
31 | ; Parameters:
|
---|
32 | ; DS: BDA segment (zero)
|
---|
33 | ; Returns:
|
---|
34 | ; AL: Number of columns in selected text mode
|
---|
35 | ; AH: Number of rows in selected text mode
|
---|
36 | ; Corrupts registers:
|
---|
37 | ; Nothing
|
---|
38 | ;--------------------------------------------------------------------
|
---|
39 | ALIGN JUMP_ALIGN
|
---|
40 | DisplayPage_GetColumnsToALandRowsToAH:
|
---|
41 | mov al, [VIDEO_BDA.wColumns] ; 40 or 80
|
---|
42 | mov ah, 25 ; Always 25 rows on standard text modes
|
---|
43 | ret
|
---|
44 |
|
---|
45 |
|
---|
46 | ;--------------------------------------------------------------------
|
---|
47 | ; DisplayPage_SynchronizeToHardware
|
---|
48 | ; Parameters:
|
---|
49 | ; DS: BDA segment (zero)
|
---|
50 | ; Returns:
|
---|
51 | ; Nothing
|
---|
52 | ; Corrupts registers:
|
---|
53 | ; AX, DX
|
---|
54 | ;--------------------------------------------------------------------
|
---|
55 | ALIGN JUMP_ALIGN
|
---|
56 | DisplayPage_SynchronizeToHardware:
|
---|
57 | xor dx, dx
|
---|
58 | mov ax, [VIDEO_BDA.displayContext+DISPLAY_CONTEXT.fpCursorPosition]
|
---|
59 | div WORD [VIDEO_BDA.wBytesPerPage] ; AX = Page
|
---|
60 |
|
---|
61 | cmp al, [VIDEO_BDA.bActivePage]
|
---|
62 | je SHORT .Return ; Same page, no need to synchronize
|
---|
63 | mov ah, SELECT_ACTIVE_DISPLAY_PAGE
|
---|
64 | int BIOS_VIDEO_INTERRUPT_10h
|
---|
65 | ALIGN JUMP_ALIGN, ret
|
---|
66 | .Return:
|
---|
67 | ret
|
---|