- Timestamp:
- Jun 21, 2017 8:46:31 PM (8 years ago)
- Location:
- trunk/src/VBox/Devices/Graphics/BIOS
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/BIOS/vbe.c
r63595 r67548 128 128 out_w(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_BPP); 129 129 out_w(VBE_DISPI_IOPORT_DATA, bpp); 130 } 131 132 static uint16_t dispi_get_bpp(void) 133 { 134 out_w(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_BPP); 135 return in_w(VBE_DISPI_IOPORT_DATA); 136 } 137 138 static void dispi_set_virt_width(uint16_t vwidth) 139 { 140 #ifdef VGA_DEBUG 141 printf("vbe_set_virt_width: %04x\n", vwidth); 142 #endif 143 out_w(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_VIRT_WIDTH); 144 out_w(VBE_DISPI_IOPORT_DATA, vwidth); 145 } 146 147 static uint16_t dispi_get_virt_width(void) 148 { 149 out_w(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_VIRT_WIDTH); 150 return in_w(VBE_DISPI_IOPORT_DATA); 151 } 152 153 static uint16_t dispi_get_virt_height(void) 154 { 155 out_w(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_VIRT_HEIGHT); 156 return in_w(VBE_DISPI_IOPORT_DATA); 130 157 } 131 158 … … 691 718 *AX = result; 692 719 } 720 721 /** Function 06h - Set/Get Logical Scan Line Length 722 * 723 * Input: 724 * AX = 4F06h 725 * BL = 00h Set Scan Line Length in Pixels 726 * = 01h Get Scan Line Length 727 * = 02h Set Scan Line Length in Bytes 728 * = 03h Get Maximum Scan Line Length 729 * CX = If BL=00h Desired Width in Pixels 730 * If BL=02h Desired Width in Bytes 731 * (Ignored for Get Functions) 732 * 733 * Output: 734 * AX = VBE Return Status 735 * BX = Bytes Per Scan Line 736 * CX = Actual Pixels Per Scan Line (truncated to 737 * nearest complete pixel) 738 * DX = Maximum Number of Scan Lines 739 */ 740 void vbe_biosfn_get_set_scanline_length(uint16_t STACK_BASED *AX, uint16_t STACK_BASED *BX, 741 uint16_t STACK_BASED *CX, uint16_t STACK_BASED *DX) 742 { 743 uint16_t val; 744 uint16_t result; 745 uint8_t bpp; 746 uint8_t subfn; 747 748 bpp = dispi_get_bpp(); 749 result = 0x004F; 750 val = *CX; 751 subfn = *BX & 0xFF; 752 #ifdef VGA_DEBUG 753 printf("VBE get/set scanline len fn=%x, CX=%x\n", subfn, *CX); 754 #endif 755 switch(subfn) { 756 case 0x02: 757 if (bpp == 4) 758 val = val * 8; 759 else 760 val = val / (bpp / 8); 761 /* fall through */ 762 case 0x00: 763 dispi_set_virt_width(val); 764 /* fall through */ 765 case 0x01: 766 val = dispi_get_virt_width(); 767 *CX = val; /* Width in pixels. */ 768 if (bpp == 4) 769 val = val / 8; 770 else 771 val = val * (bpp / 8); 772 val = (val + 3) & ~3; 773 *BX = val; /* Bytes per scanline. */ 774 *DX = dispi_get_virt_height(); /* Height in lines. */ 775 break; 776 default: 777 // function failed 778 result = 0x100; 779 break; 780 } 781 *AX = result; 782 } -
trunk/src/VBox/Devices/Graphics/BIOS/vberom.asm
r63617 r67548 49 49 public vbe_biosfn_return_current_mode 50 50 public vbe_biosfn_display_window_control 51 public vbe_biosfn_set_get_logical_scan_line_length52 51 public vbe_biosfn_set_get_display_start 53 52 public vbe_biosfn_set_get_dac_palette_format … … 304 303 pop bx 305 304 pop ax 306 ret307 308 dispi_set_virt_width:309 call vga_set_virt_width310 push dx311 push ax312 mov dx, VBE_DISPI_IOPORT_INDEX313 mov ax, VBE_DISPI_INDEX_VIRT_WIDTH314 out_dx_ax315 pop ax316 mov dx, VBE_DISPI_IOPORT_DATA317 out_dx_ax318 pop dx319 ret320 321 dispi_get_virt_width:322 push dx323 mov dx, VBE_DISPI_IOPORT_INDEX324 mov ax, VBE_DISPI_INDEX_VIRT_WIDTH325 out_dx_ax326 mov dx, VBE_DISPI_IOPORT_DATA327 in_ax_dx328 pop dx329 ret330 331 dispi_get_virt_height:332 push dx333 mov dx, VBE_DISPI_IOPORT_INDEX334 mov ax, VBE_DISPI_INDEX_VIRT_HEIGHT335 out_dx_ax336 mov dx, VBE_DISPI_IOPORT_DATA337 in_ax_dx338 pop dx339 305 ret 340 306 … … 569 535 vbe_05_failed: 570 536 mov ax, 014Fh 571 ret572 573 574 ; Function 06h - Set/Get Logical Scan Line Length575 ;576 ; Input:577 ; AX = 4F06h578 ; BL = 00h Set Scan Line Length in Pixels579 ; = 01h Get Scan Line Length580 ; = 02h Set Scan Line Length in Bytes581 ; = 03h Get Maximum Scan Line Length582 ; CX = If BL=00h Desired Width in Pixels583 ; If BL=02h Desired Width in Bytes584 ; (Ignored for Get Functions)585 ;586 ; Output:587 ; AX = VBE Return Status588 ; BX = Bytes Per Scan Line589 ; CX = Actual Pixels Per Scan Line590 ; (truncated to nearest complete pixel)591 ; DX = Maximum Number of Scan Lines592 ;593 vbe_biosfn_set_get_logical_scan_line_length:594 mov ax, cx595 cmp bl, 1596 je get_logical_scan_line_length597 cmp bl, 2598 je set_logical_scan_line_bytes599 jb set_logical_scan_line_pixels600 mov ax, 0100h601 ret602 set_logical_scan_line_bytes:603 push ax604 call dispi_get_bpp605 xor bh, bh606 mov bl, ah607 or bl, bl608 pop ax609 jnz no_4bpp_1610 if VBOX_BIOS_CPU gt 8086611 shl ax, 3612 else613 shl ax, 1614 shl ax, 1615 shl ax, 1616 endif617 mov bl, 1618 no_4bpp_1:619 xor dx, dx620 div bx621 set_logical_scan_line_pixels:622 call dispi_set_virt_width623 get_logical_scan_line_length:624 call dispi_get_bpp625 xor bh, bh626 mov bl, ah627 call dispi_get_virt_width628 mov cx, ax629 or bl, bl630 jnz no_4bpp_2631 if VBOX_BIOS_CPU gt 8086632 shr ax, 3633 else634 shr ax, 1635 shr ax, 1636 shr ax, 1637 endif638 mov bl, 1639 no_4bpp_2:640 mul bx641 mov bx, ax642 call dispi_get_virt_height643 mov dx, ax644 mov ax, 004Fh645 537 ret 646 538 -
trunk/src/VBox/Devices/Graphics/BIOS/vgabios.c
r63562 r67548 2100 2100 extern void vbe_biosfn_set_mode(uint16_t STACK_BASED *AX, uint16_t BX, uint16_t ES, uint16_t DI); 2101 2101 extern void vbe_biosfn_save_restore_state(uint16_t STACK_BASED *AX, uint16_t CX, uint16_t DX, uint16_t ES, uint16_t STACK_BASED *BX); 2102 extern void vbe_biosfn_get_set_scanline_length(uint16_t STACK_BASED *AX, uint16_t STACK_BASED *BX, uint16_t STACK_BASED *CX, uint16_t STACK_BASED *DX); 2102 2103 2103 2104 // -------------------------------------------------------------------------------------------- … … 2295 2296 vbe_biosfn_save_restore_state(&AX, CX, DX, ES, &BX); 2296 2297 break; 2298 case 0x06: 2299 vbe_biosfn_get_set_scanline_length(&AX, &BX, &CX, &DX); 2300 break; 2297 2301 case 0x09: 2298 2302 //FIXME -
trunk/src/VBox/Devices/Graphics/BIOS/vgarom.asm
r60441 r67548 48 48 extrn vbe_biosfn_return_current_mode:near 49 49 extrn vbe_biosfn_display_window_control:near 50 extrn vbe_biosfn_set_get_logical_scan_line_length:near51 50 extrn vbe_biosfn_set_get_display_start:near 52 51 extrn vbe_biosfn_set_get_dac_palette_format:near … … 167 166 int10_test_vbe_05: 168 167 cmp al, 5 169 jne int10_test_vbe_0 6168 jne int10_test_vbe_07 170 169 call vbe_biosfn_display_window_control 171 jmp int10_end172 int10_test_vbe_06:173 cmp al, 6174 jne int10_test_vbe_07175 call vbe_biosfn_set_get_logical_scan_line_length176 170 jmp int10_end 177 171 int10_test_vbe_07:
Note:
See TracChangeset
for help on using the changeset viewer.