//---------------------------------------------------------------- // copypage.s // // This function was written in assembly language, but may // be called from a graphics application written in C/C++. // It performs a very fast bit-blt operation that uses the // 'rep movsl' instruction to copy a page of video memory. // // assemble using: $ as copypage.s -o copypage.o // // programmer: ALLAN CRUSE // written on: 03 DEC 2003 //---------------------------------------------------------------- .equ vram, 0xA0000000 # base-address of vram .text copypage: # # void copypage( int src_pgno, int dst_pgno, int pgsize ); # pushl %ebp # save caller's frame-pointer movl %esp, %ebp # setup access to parameters pushal # preserve general registers cld # forward processing movl 16(%ebp), %ecx # bytes to be copied movl 8(%ebp), %eax # source page-number mull %ecx # times page-size leal vram(%eax), %esi # setup source-index movl 12(%ebp), %eax # dest'n page-number mull %ecx # times page-size leal vram(%eax), %edi # setup dest'n-index shrl $2, %ecx # divide count by 4 rep movsl # copy as longwords popal # restore saved cpu registers popl %ebp # recover caller's frame-pointer ret # return control to caller .globl copypage # make symbol visible to linker