DOSSEG ; A Assembler program that demonstrates graphics using the 10h interrupt ; This shows the graphics modes and draws with them ; Author: Curt Hill ; Be careful - this sets the intensity so low that it is extremely difficult to read ; anything and the mouse is impossible to find. It is not clear if this is ; a Win 2000 thing or a Silicon Motion thing or an iSeries laptop thing. ;Data section .model large .stack 100h .486 .code ; Here is the code start: mov ax,@data ; Address the data mov ds,ax ; preserve original mode mov ah,0fh int 10h mov oldmode,al lea dx,initmsg call writenoattr call pause mov ax,4 lowloop: call chmode call dolines inc ax call pause cmp ax,7 jl lowloop ; jmp alldone lea dx,chgmsg call writechars2 call pause mov ax,0dh highloop: call chmode call dolines inc ax call pause cmp al,1fh jl highloop alldone: mov al,oldmode call chmode lea dx,donemsg call writechars2 mov ax,4c00h ; Leave the program int 21h ; Any subroutines would go here dolines proc near pusha mov al,1 ; color xor cx,cx ; column xor dx,dx ; row @@LOOP: call do_a_line add cx,6 inc dx inc al cmp al,126 jl @@LOOP popa ret dolines endp do_a_line proc near pusha mov bp,100 @@LOOP: mov bh,0 ; page 0 mov ah,0ch ; write a pixel int 10h inc cx inc dx sub bp,1 jnz @@LOOP popa ret do_a_line endp ; mode is in al chmode proc near push ax mov ah,0 int 10h pop ax ret chmode endp ; no parameters, nothing is changed but video incr_cursor proc near push ax push bx push cx push dx ; first get cursor mov ah,3 int 10h ; now set up by one mov ah,2 xor bx,bx inc dl int 10h pop dx pop cx pop bx pop ax ret incr_cursor endp ; write characters no attribute using ah=0ah ; DX is the string, which ends with a null character writenoattr proc near push ax push cx push di mov cx,1 mov ah,0ah mov di,dx ; move from di, on pentium move directly @@wcloop: mov al,[di] inc di cmp al,0 je @@wcdone int 10h call incr_cursor jmp @@wcloop @@wcdone: pop di pop cx pop ax ret writenoattr endp ; write characters with attributes using ah=09h ; DX is the string, which ends with a null character writewattr proc near push ax push bx push cx push di mov cx,1 mov ah,09h mov di,dx ; move from di, on pentium move directly mov bl,attrib @@wcloop: mov al,[di] inc di cmp al,0 je @@wcdone int 10h call incr_cursor jmp @@wcloop @@wcdone: pop di pop cx pop bx pop ax ret writewattr endp pause proc near push ax push dx lea dx,readym call writechars2 mov ah,0ah lea dx,block int 21h pop dx pop ax ret pause endp ; write characters using ah=0eh ; DX is the string, which ends with a null character writechars2 proc near push ax push bx push di mov ah,0eh mov di,dx ; move from di, on pentium move directly xor bh,bh ; page zero mov bl,attrib wcloop2: mov al,[di] inc di cmp al,0 je wcdone2 int 10h jmp wcloop2 wcdone2: pop di pop bx pop ax ret writechars2 endp .data ; Data goes here readym db 13,10,10,10,10,10,10,10,10,10,10,10,"Enter when ready for next",13,10,0,'$' attrib db 0fh block db 20 new db ? strn db 20 dup (' ') mode db "This is mode number " modev db "0",0 initmsg db "About to start in graphics mode 4",13,10,0,'$' chgmsg db "That 4,5,6 now on to D-13h",13,10,0 oldmode db 0 donemsg db "All done and returned to original video mode",13,10,0 ; Last line of assembly is end end