home *** CD-ROM | disk | FTP | other *** search
- ; Egt view V6.1
- ; Copyright 1996 by Beowulf Shaeffer
- ; Member of The Powerdrome's Beta Zone
- ; WASM sourcefile
-
- start proc near ; use only short jumps
- mov ax,ds
- mov es,ax ; copy ds into es, the extra segment
-
- check_vga mov ax,1a00h ; Setup VGA check
- int 10h
- cmp bl,7 ; Analog?
- jb no_vga
- cmp bl,8 ; Monochrome?
- ja no_vga
-
- start_proc sub bh,bh ; make bh=0
- MOV BL,[com_line] ; Load BL with first COM_LINE byte.
- cmp bl,0
- je no_opts
-
- ; Added to enable the .EGT extention.
- mov al,[bx+com_line-3]
- cmp al,'.'
- jne addit
- mov byte [bx+com_line+1],0
- jmp open
-
- addit mov byte [bx+com_line+1],'.' ; add .egt +chr$(0)
- mov byte [bx+com_line+2],'e' ; to commandline
- mov byte [bx+com_line+3],'g'
- mov byte [bx+com_line+4],'t'
- MOV byte [BX+com_line+5],0
-
- open MOV AX,3D82H ; Prepare int 21h function 3dh
- MOV DX,com_line+2 ; Point second byte at commandline
- INT 21H ; Execute OPEN function.
- JC no_file ; Error? > jump
- MOV FILE_HANDLE,AX ; Put AX in variable FILE_HANDLE.
-
- mcga mov ax,0013h ; Prepare Set Mode 13h (MCGA)
- int 10h ; Execute mode instruction
-
- palette pop dx ; Restore registers after 32 bit
- pop cx ; filepointer operations
- pop bx
- pop ax
-
- mov bx,file_handle ; Put filehandle in bx
- mov dx,offset buffer; First adress of buffer in dx
- MOV CX,768 ; 3 x 256 palette bytes of size
- MOV AX,3F00H ; Prepare read 768 bytes function
- INT 21H ; Execute READ function.
- cmp ax,768 ; Load successful?
- jne close ; No? -> go to close
-
- pallettje mov ax,1012h ; Prepare a block DAC setting
- sub bx,bx ; make bx=0
- mov cx,256 ; Number of (RGB) registers = 256
- mov dx,offset buffer; Put first adress of buffer in dx
- int 10h ; Execute instruction
- jmp regel
-
- no_opts mov dx,offset noopts_msg
- jmp display1
-
- no_vga mov dx,offset novga_msg ; Point to string with dx
- jmp display1
-
- no_file mov dx,offset nofile_msg ; Point to string with dx
-
- display1 mov ah,9h ; Prepare display string function
- int 21h ; Execute
-
- stopje MOV AX,4C00H ; Return to DOS function setup
- INT 21H ; Do it
-
- pall jmp palette ; sub-jump to palette
-
- CLOSE MOV AH,3EH ; Load required functionnumber
- INT 21H ; Execute close function
-
- exit_1 mov ax,0003h ; Prepare setmode 3 (TEXTmode)
- int 10h ; execute it
- jmp stopje
-
- regel push ds ; Save data segment
- mov bx,file_handle ; Put file-handle in bx
- sub dx,dx ; First destination adress dx=0000
- mov ax,0a000h ; Set datasegment to a000h
- mov ds,ax ; (beginning of MCGA VGA-RAM)
-
- MOV CX,0fa00h ; Size is 200 x 320 = fa00h bytes
- MOV AX,3F00H ; Load picturepart of EGT file
- INT 21H ; Execute it
- pop ds
-
- keybd push ax ; Save registers before 32 bit
- push bx ; filepointer operations
- push cx
- push dx
-
- kwait sub ax,ax ; prepare wait for keyboard function
- int 16h ; execute int 16h
-
- cmp ax,011bh ; <ESC> pressed?
- je exit_2
-
- cmp ax,4700h ; <HOME> pressed?
- je f_begin2
- cmp ax,0837h ; <7> pressed? (same action)
- je f_begin2
-
- cmp ax,4f00h ; <END> pressed?
- je f_end
- cmp ax,0231h ; <1> pressed? (same action)
- je f_end
-
- cmp ax,4b00h ; <<-> pressed? (left arrow)
- je f_terug
- cmp ax,0534h ; <4> pressed? (same action)
- je f_terug
- cmp ax,4800h ; <^> pressed? (up arrow)
- je f_terug
- cmp ax,0938h ; <8> pressed? (same action)
- je f_terug
-
- cmp ax,4d00h ; <->> pressed? (right arrow)
- je pall
- cmp ax,0736h ; <6> pressed? (same action)
- je pall
- cmp ax,5000h ; <v> pressed? (down arrow)
- je pall
- cmp ax,0332h ; <2> pressed? (same action)
- je pall
-
- jmp kwait ; wait for another key
-
- f_end mov al,2 ; set end of file function
- xor cx,cx ; offset high=0
- xor dx,dx ; offset low=0
- call f_pointer ; get file size into dx:ax
- mov cx,dx ; copy them to cx:dx
- mov dx,ax
- sub dx,0fd00h ; subtract pictureblock-size
- jc carry ; low 16 bits carry?
- jawel mov al,0 ; set filepointer function
- call f_pointer ; set filepointer
- jmp palette ; get picture
- carry dec cx ; high 16 bits decrease after carry
- jmp jawel
-
- exit_2 jmp exit_1 ; sub-jump to exit_1
-
- f_begin2 jmp f_begin ; sub-jump to f_begin
-
- f_terug mov al,1 ; get current pointer
- xor cx,cx ; offset high=0
- xor dx,dx ; offset low=0
- call f_pointer ; current pointer is in dx:ax
- and dx,dx
- jz f_begin2 ; check if current is first picture
- mov cx,dx
- mov dx,ax
-
- sub dx,0fd00h ; begin filepointer-1 block
- jc carry2
- jmp bloktwee
- carry2 dec cx
-
- bloktwee sub dx,0fd00h
- jc carry3
-
- jawel3 mov al,0
- call f_pointer
- jmp palette ; now filepointer is set 2 picture-
- ; blocks backwards.
-
- carry3 dec cx
- jmp jawel3
-
- f_begin mov al,0 ; point to begin+offset
- xor cx,cx ; offset high=0
- xor dx,dx ; offset low=0
- call f_pointer
- jmp palette ; show first picture in .egt file
-
- f_pointer mov ah,42h ; setpointer function init
- mov bx,file_handle ; for file_handle
- int 21h ; execute
- ret
-
- endp
-
- nofile_msg db 'Sorry, I can',39,'t find that file.',13,'$'
- novga_msg db 'I can',39,'t find a VGA adapter!',13,'$'
- noopts_msg db 'Egt Viewer 6.1 Copyright ',39,'96 by Beowulf Shaeffer',13,10
- db 'To view DEMO.EGT type EV DEMO',13,'$'
- FILE_HANDLE DW ?
- BUFFER DB 768 * ? ; use 768 bytes as buffer
- com_line equ 80h
-