;FILENAME: UNIT14.TXT ; ; ASSEMBLY LANGUAGE COURSE, UNIT 14 ; By Don Stoner Revision: 2008.07.20 ; ; This program allows you to experiment ; with different text and graphical ; display formats. ; ORG 100h ; Code Starts at 100h ; ; Instead of a normal LOOP_BACK ; here we will do a little ; trick with a CALL that will ; enable us to loop back with ; a single byte RET instruction ; LOOP_BACK: ; Loop back to here CALL RUN_LOOP JMP LOOP_BACK ;from here RUN_LOOP: ; Everything from here on down ; is one big subroutine: ;------------------------------ ; Output some text: ; CALL INLINE_ASCIIZ_OUT DB "CHARACTER TEST",0 ; ; Set the Point at Screen ; Position 100,100 to Blue ; MOV CX,100 ; X coordinate ; (0 is left edge) MOV DX,100 ; Y coordinate ; (0 is top) MOV AL,13 ; Color = Magenta ; (Different screen modes use ; different color numbering.) ; MOV AH,0CH ;Code to set 1 point XOR BH,BH ;(use page 0) INT 10h ;Video interrupt ; ; 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: ;------------------------------ ; VGA modes: (AH=0, AL=mode) ; AL=03h: 80x25 16-color text ; AL=42h: 132x43 16-color text ; AL=44h: 132x60 16-color text ; ; "1" selects VGA mode 3 ; (80x25 16-color text) ; CMP AL,"1" JNZ NT1 MOV AX,3 ;VGA mode 3 INT 10h ;Video interrupt RET ;Return to LOOP_BACK NT1: ; ; "2" selects VGA mode 42 ; (132x43 16-color text) ; CMP AL,"2" JNZ NT2 MOV AX,42 ;VGA mode 42 INT 10h ;Video interrupt RET ;Return to LOOP_BACK NT2: ;------------------------------ ; 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 ; ; "3" selects VESA mode 0Dh ; 320x200 16-color graphics ; CMP AL,"3" JNZ NT3 MOV BX,0Dh ;320x200,16 MOV AX,4F02h ;VESA mode INT 10h ;Video interrupt RET ;Return to LOOP_BACK NT3: ; ; "4" selects VESA mode 105 ; 1024x768 256-color graphics ; CMP AL,"4" JNZ NT4 MOV BX,105h ;1024x768,265 MOV AX,4F02h ;VESA mode INT 10h ;Video interrupt RET ;Return to LOOP_BACK NT4: ; ; "5" selects VESA mode 107 ; 1280x1024 256-color graphics ; CMP AL,"5" JNZ NT5 MOV BX,107h ;1280x1024,265 MOV AX,4F02h ;VESA mode INT 10h ;Video interrupt RET ;Return to LOOP_BACK NT5: ;------------------------------ ; 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)