;FILENAME: UNIT15.TXT ; ; ASSEMBLY LANGUAGE COURSE, UNIT 15 ; By Don Stoner Revision: 2008.07.20 ; ; This program experiments with ; more graphical display formats. ; ORG 100h ; Code Starts at 100h ; ; Same "Loop Back" trick: ; LOOP_BACK: ; Loop back to here CALL RUN_LOOP JMP LOOP_BACK ;from here RUN_LOOP: ;------------------------------ ; Output the same text: ; CALL INLINE_ASCIIZ_OUT DB "CHARACTER TEST",0 ; ; Draw a diagonal line made up ; of points, with each point a ; different color: ; ;Starting: MOV CX,200 ;X coordinate, MOV DX,200 ;Y coordinate, MOV AL,200 ;and Color GRAPHICS_LOOP: ;draw 1 point per loop MOV AH,0CH ;Code to set 1 point XOR BH,BH ;(use page 0) INT 10h ;Video interrupt ; DEC CX ;Next pixel X coord. DEC DX ;Next pixel Y coord. MOV AL,DL ;Set color from Y ; Notice that color values are ; limited to AL (0 - 255) This ; means BIOS doesn't support ; point-plotting for more ; colors than 256. These need ; direct writes to video RAM. JNZ GRAPHICS_LOOP ;Loop until ; ;Y is 0 ; Fetch a key to tell the ; program what to do next: ; CALL ASCII_IN ;Read key to AL ; ; Select display depending ; on which key was pressed: ;------------------------------ ; VESA graphic modes:(AX=4F02h) ; Table of BX (in hex) ; colors: 16 256 32K 64K 16M ; 320x 200 0D 13 10D 10E 10F ; 640x 480 11 101 110 111 112 ; 800x 600 102 103 113 114 115 ;1024x 768 104 105 116 117 118 ;1280x1024 106 107 119 11A 11B ; ; "1" selects VESA mode 0Dh ; 320x200 16-color graphics CMP AL,"1" JNZ NT1 MOV BX,0Dh ;320x200,16 MOV AX,4F02h ;VESA mode INT 10h ;Video interrupt RET ;Return to LOOP_BACK NT1: ; ; "2" selects VESA mode 13h ; 320x200 256-color graphics CMP AL,"2" JNZ NT2 MOV BX,13h ;320x200,256 MOV AX,4F02h ;VESA mode INT 10h ;Video interrupt RET ;Return to LOOP_BACK NT2: ; ; "3" selects VESA mode 101 ; 640x480 256-color graphics CMP AL,"3" JNZ NT3 MOV BX,101h ;640x480,256 MOV AX,4F02h ;VESA mode INT 10h ;Video interrupt RET ;Return to LOOP_BACK NT3: ; ; "4" selects VESA mode 103 ; 800x600 256-color graphics CMP AL,"4" JNZ NT4 MOV BX,103h ;800x600,265 MOV AX,4F02h ;VESA mode INT 10h ;Video interrupt RET ;Return to LOOP_BACK NT4: ; ; "5" selects VESA mode 105 ; 1024x768 256-color graphics CMP AL,"5" JNZ NT5 MOV BX,105h ;1024x768,265 MOV AX,4F02h ;VESA mode INT 10h ;Video interrupt RET ;Return to LOOP_BACK NT5: ; ; "6" selects VESA mode 107 ; 1280x1024 256-color graphics CMP AL,"6" JNZ NT6 MOV BX,107h ;1280x1024,265 MOV AX,4F02h ;VESA mode INT 10h ;Video interrupt RET ;Return to LOOP_BACK NT6: ;------------------------------ ; Escape? (1Bh) ; CMP AL,1Bh ;(Escape key) JNZ NTESC MOV AX,3 ;Restore normal INT 10h ;VGA mode 3 INT 20h ;And return to DOS NTESC: RET ;-------------------------------------- %INCLUDE "UNIT11.ASM" ;(Subroutines)