2000 ;SSTV routine for reading the comparator INCLUDE MACROS\CONV.MAC INCLUDE MACROS\SCREEN.MAC CSEG SEGMENT ASSUME CS:CSEG,DS:CSEG ORG 100h start: jmp begin ;-------------------------------------------------------------------------- stackspace db 32 dup ('STACK ') newstack dw 0 Org_IRQ3 dd ? Org_INT8 dd ? oldtime dw 0 oldtime2 dw 0 irqmask_save db ? handle dw ? scr_seg dw 0b800h linecntr dw ? linebuf db 1100 dup (?) color_lkup db 255,240,230,220,210,200,194,186,178,170,162,154,146,138,130,122 db 114,106,98,90,81,72,63,54,45,36,27,18,9,0 safe db 10 dup (?) pic_off1 dw ? pic_seg1 dw ? pic_off2 dw ? pic_seg2 dw ? pic_off3 dw ? pic_seg3 dw ? pic_off4 dw ? pic_seg4 dw ? picptr dw ? active_buf db 1 HSIHeader db 'mhwanh' dw 0400h,5401h,0001h,0000h,0,0,0 db 12 dup (0) filename db 'sstv.raw',0 databuf db 1000 dup (?) dataptr dw ? tone_val dw 0 hz_cntr dw 0 done dw 0 ;--------------------------------------------------------------------------- buf_init PROC NEAR mov bp,sp mov dx,word ptr[bp] mov sp,OFFSET newstack ;New stack pointer mov ah,4aH ;Mshrink mov bx,65535/16 ;Bytes left for program int 21H mov ah,48H ;Allocate memory for 1st part of picbuf mov bx,65535/16 int 21H mov pic_seg1,ax ;Pointer to allocated segment mov pic_off1,0 mov ah,48h ;Allocate memory for 2nd part of picbuf mov bx,65535/16 int 21h mov pic_seg2,ax mov pic_off2,0 mov ah,48h ;Allocate memory for 3rd part of picbuf mov bx,65535/16 int 21h mov pic_seg3,ax mov pic_off3,0 mov ah,48h ;Allocate memory for 4th part of picbuf mov bx,65535/16 int 21h mov pic_seg4,ax mov pic_off4,0 mov bp,sp mov word ptr[bp],dx ret buf_init ENDP ;========================================================================= Hz_Int PROC NEAR ASSUME CS:CSEG,DS:CSEG push ds push ax push dx push cs pop ds mov dx,2feh in al,dx and al,2 cmp al,0 ;Test Delta Data Set Ready jz skip mov dx,hz_cntr sub dx,oldtime shl dx,1 mov tone_val,dx mov dx,hz_cntr mov oldtime,dx skip: mov al,20h ;Signal End of Interrupt out 20h,al pop dx pop ax pop ds iret Hz_Int ENDP ;------------------------------------------------------------- Pix_Int PROC NEAR ASSUME CS:CSEG,DS:CSEG push ds push ax push dx push si push cs pop ds inc hz_cntr mov dx,hz_cntr sub dx,oldtime2 cmp dx,52 jnz skip2 mov dx,hz_cntr mov oldtime2,dx mov dx,tone_val sub dx,32h mov si,offset color_lkup add si,dx mov dl,byte ptr[si] mov si,offset linebuf add si,linecntr mov byte ptr[si],dl inc linecntr skip2: mov al,20h ;Signal End of Interrupt out 20h,al pop si pop dx pop ax pop ds iret Pix_Int ENDP ;======================================================================= do_it PROC NEAR ASSUME CS:CSEG,DS:CSEG push cs ;DS m†ste peka p† r„tt segment pop ds ;d† vi skall ladda om vektorn ; mov ah,00h ;Set MCGA mode 320x200x256 ; mov al,13h ; int 10h ;---------- Fixa h†rdvaruinterrupt fr†n serieporten ---------------------- mov al,0Bh ;H„mta vektorn till INT 0Bh (COM2) mov ah,35h int 21h mov word ptr[Org_IRQ3],bx ;Org_Rutinens OFFSET h„mtas mov word ptr[Org_IRQ3+2],es ;Segment sparas mov dx,offset Hz_Int ;Ny IRQ3-interrupt mov al,0Bh mov ah,25h int 21h ;------------------ Fixa pixel-interrupt -------------------------- mov al,08h ;H„mta vektorn till INT 08h mov ah,35h int 21h mov word ptr[Org_INT8],bx mov word ptr[Org_INT8+2],es mov dx,offset Pix_Int ;Ny INT8-interrupt mov al,08h mov ah,25h int 21h ;--------------------------------------------------------------------- cli mov dx,43h ;Programmera om systemtimern mov al,36h out dx,al mov dx,40h ;Ny divisor 10 (119338 Hz) mov al,0Ah out dx,al mov al,00h out dx,al ;------- n”dv„ndiga steg f”r IRQ3-interruptet ------------- mov dx,02f9h ;S„tt bit 3 i IER-registret mov al,08h ;Interrupt Enable out dx,al mov dx,02fch ;Aktivera tristate-grinden in al,dx or al,8 out dx,al mov dx,21h ;0-st„ll bit 3 i PIC-kretsen in al,dx ;s† att IRQ 3 kan tas emot mov irqmask_save,al and al,0F7h out dx,al mov dx,02feh ;G”r klart f”r nytt interrupt in al,dx ;dummy_read ;---------------------------------------------------------------- sti ;/////////////////////////////////////////////////////////////////////////// ;/////////////////////////////////////////////////////////////////////////// main_lp: cmp linecntr,340*3 jnz line_not_finished mov linecntr,0 cmp active_buf,1 ja l1 mov es,pic_seg1 jmp go_on l1: cmp active_buf,2 ja l2 mov es,pic_seg2 jmp go_on l2: cmp active_buf,3 ja l3 mov es,pic_seg3 jmp go_on l3: mov es,pic_seg4 go_on: mov di,picptr mov cx,340 store_line: mov si,offset linebuf+340 sub si,cx mov dl,byte ptr[si] mov byte ptr es:[di],dl add si,340 inc di mov dl,byte ptr[si] mov byte ptr es:[di],dl add si,340 inc di mov dl,byte ptr[si] mov byte ptr es:[di],dl inc di cmp di,65535 jb l5 inc active_buf cmp active_buf,5 jnz l5 mov active_buf,1 l5: loop store_line line_not_finished: mov ah,01h int 16h jnz quit jmp main_lp ;//////////////////////////////////////////////////////////////////////////// ;//////////////////////////////////////////////////////////////////////////// quit: cli mov al,irqmask_save ;¸terst„ll gamla interrupt out 21h,al ;(Och st„ng av IRQ 3) mov dx,43h ;¸terst„ll systemtimern mov al,36h out dx,al mov dx,40h mov al,0h out dx,al mov al,0h out dx,al sti push ds mov dx,word ptr[Org_INT8] ;¸terst„ll INT8 mov bx,word ptr[Org_INT8+2] mov ds,bx mov al,08h mov ah,25h int 21h mov dx,word ptr[Org_IRQ3] ;¸terst„ll INT 0Bh (IRQ3) mov bx,word ptr[Org_IRQ3+2] mov ds,bx mov al,0bh mov ah,25h int 21h pop ds mov ah,3ch mov cx,0 mov dx,offset filename int 21h mov ah,3dh mov al,1 mov dx,offset filename int 21h mov handle,ax mov ah,40h ;Write HSI Raw header... mov bx,handle mov cx,32 mov dx,offset HSIHeader int 21h push ds ;and picture data (260100 bytes) mov dx,ds mov es,dx mov dx,es:[pic_seg1] mov ds,dx mov ah,40h mov bx,es:[handle] mov cx,65535 mov dx,0 int 21h mov dx,es:[pic_seg2] mov ds,dx mov ah,40h mov bx,es:[handle] mov cx,65535 mov dx,0 int 21h mov dx,es:[pic_seg3] mov ds,dx mov ah,40h mov bx,es:[handle] mov cx,65535 mov dx,0 int 21h mov dx,es:[pic_seg4] mov ds,dx mov ah,40h mov bx,es:[handle] mov cx,64515 mov dx,0 int 21h pop ds 240 mov ah,3eh ;Close file mov bx,handle int 21h ret do_it ENDP goodbye PROC NEAR mov ah,49h ;MFree() mov es,pic_seg1 int 21h mov ah,49h mov es,pic_seg2 int 21h mov ah,49h mov es,pic_seg3 int 21h mov ah,49h mov es,pic_seg4 int 21h mov ax,4c00h int 21h goodbye ENDP ;========================================================================= begin: call buf_init call do_it call goodbye CSEG ENDS END start . 0