Mail Archives: djgpp/1998/03/22/14:15:35
I would be overjoyed if any1 could rewrite this asm to fit djgpp v2...
I´m a not so good asm-coder...:(
Thanks...
Ulrik S.
keso-98 AT swipnet DOT se
http://start.at/winodws98
//**********************************************************
//******************* ASM SOURCES ************************
//**********************************************************
void OnVideo(void)
{
asm mov bl,0x36
asm mov ax,0x1200
asm int 0x10
}
void OffVideo(void)
{
asm mov bl,0x36
asm mov ax,0x1201
asm int 0x10
}
void SetMode(char mode)
{
asm mov ah,0x00
asm mov al,mode
asm int 0x10
}
char GetMode()
{
char mode;
asm mov ah,0x0f
asm int 0x10
asm mov mode,al
return (mode);
}
void WaitRast()
{
asm mov dx,0x3da
bra1:
asm in al,dx
asm and al,8
asm jnz bra1
bra2:
asm in al,dx
asm and al,8
asm jz bra2
}
void SetBank(unsigned char wbank, unsigned char rbank)
{
unsigned char n=rbank<<4|wbank;
asm mov al,n
asm mov dx,0x3cd // Point to memory segment register
asm out dx,al // Set it.
}
void SetDisplayStart(int adsr)
{
// This part uses standard VGA DisplayStart registers
asm mov bx,adsr // Load start adress
asm mov dx,0x3d0 // color register (mono = 0x3b0
asm add dx,4
asm mov al,0x0d
asm out dx,al
asm inc dx
asm mov al,bl
asm out dx,al
asm dec dx
asm mov al,0x0c
asm out dx,al
asm inc dx
asm mov al,bh
asm out dx,al // Listing 14.32
}
void DubImage(int off, unsigned char buf[], int nbyte, int nrow)
{
asm push es
asm mov ax,0xa000
asm mov es,ax
asm mov di,off
asm lds si,buf
asm xor dx,dx
asm mov bx,320
asm sub bx,nbyte
asm sub bx,nbyte
asm mov cx,nrow
asm xor ch,ch
asm mov ah,[bp+10]
loop1:
asm mov dx,nbyte
loop2:
asm mov al,[si]
asm mov ah,al
asm mov es:[di],ax
asm inc di
asm inc di
asm inc si
asm dec dx
asm jg loop2
asm add di,bx
asm sub si,nbyte
asm mov dx,nbyte
loop3:
asm mov al,[si]
asm mov ah,al
asm mov es:[di],ax
asm inc di
asm inc di
asm inc si
asm dec dx
asm jg loop3
asm add di,bx
asm loop loop1
asm pop es
}
void SetPal(uchar col, uchar red, uchar gre, uchar blu)
{
asm mov al,col // load palette
asm mov dx,PEL_write // Ignite write mode
asm out dx,al // store it
asm mov dx,PEL_data // Initialize color data
asm mov al,red // red color
asm out dx,al // store it
asm mov al,gre // green color
asm out dx,al // store it
asm mov al,blu // blue color
asm out dx,al // and store it
}
....
a lot of c-code....
*********EOF**********
- Raw text -