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