76 lines
1004 B
NASM
76 lines
1004 B
NASM
.386
|
|
.model flat,c
|
|
.STACK 100h
|
|
|
|
.data
|
|
bufferPtr dword 0
|
|
bufferHandleLow word 0
|
|
bufferHandleHigh word 0
|
|
|
|
.code
|
|
|
|
main PROC
|
|
; we need es the same as ds for movsb
|
|
mov ax,ds
|
|
mov es,ax
|
|
|
|
; place to catch bpint
|
|
mov cx,0fh
|
|
mov dx,1
|
|
mov ah,86h
|
|
int 15h
|
|
|
|
; reserve ram
|
|
mov ax,0501h
|
|
mov bx,0
|
|
mov cx,64000
|
|
int 31h
|
|
shl ebx,16
|
|
mov bx,cx
|
|
mov bufferPtr,ebx
|
|
mov bufferHandleLow,di
|
|
mov bufferHandleHigh,si
|
|
|
|
; clear ram
|
|
mov ecx,64000
|
|
mov edi,ebx
|
|
mov al,0
|
|
rep stosb
|
|
|
|
; write pixel 15 at (10,10)
|
|
mov edi,ebx
|
|
add edi,320*10+10
|
|
mov al,15
|
|
stosb
|
|
|
|
; switch to 320x200 256 color chunky chained mode
|
|
mov ah,0h
|
|
mov al,13h
|
|
int 10h
|
|
|
|
; copy buffer to vga card
|
|
mov esi,bufferPtr
|
|
mov edi,0a0000h
|
|
mov ecx,320*200
|
|
rep movsb
|
|
|
|
; wait 5s
|
|
mov cx,0fh
|
|
mov dx,5000
|
|
mov ah,86h
|
|
int 15h
|
|
|
|
; free memory
|
|
mov ax,0502h
|
|
mov si,bufferHandleHigh
|
|
mov di,bufferHandleLow
|
|
int 31h
|
|
|
|
; terminate with return code
|
|
mov ah,4Ch
|
|
mov al,00h
|
|
int 21h
|
|
main ENDP
|
|
|
|
END main
|