home *** CD-ROM | disk | FTP | other *** search
- ; pcrammov.asm
- ;
- ; 5/88 by Ted
- ;
- ; Low Level RAM functions for Cscape
- ;
- ; Copyright (c) 1988, 1989 Oakland Group Inc.
- ; ALL RIGHTS RESERVED
- ;
- ; This file contains the low level routines used by display code
- ; to talk to the display (without waiting for retrace signals)
- ;
- ;------------------------REVISION HISTORY--------------------------------------;
- ; 8/30/88 Ted Changed Order of args to ram_memtoseg to extract ram_CopyBox.
- ; 10/07/88 Ted Split into two files: rammov and ramwmov for retrace waiting.
- ; 6/23/89 ted changed args to ram_mem1toseg
- ;
- ;------------------------------------------------------------------------------;
-
- include PCDECL.MAC
-
- PSEG
- ;------------------------------------------------------------------------------;
- ; ram_segwordset(int segm, int segoffs, int bwidth, int dupword);
-
- pubproc DIGPRIV ram_segwordset <segm, segoffs, bwidth, dupword>
- push bp
- mov bp,sp
- pushm <ds, es, di, si>
-
- mov di, [bp].segoffs
- mov cx, [bp].bwidth
- cld ;set direction to increment
- ;---------
- mov ax, [bp].segm
- mov es, ax
-
- mov ax, [bp].dupword
-
- ;---------
- shr cx, 1
- jcxz swjust1
- rep stosw ;store character and attribute
- swjust1:
- jnc swdone
- stosb
- swdone:
- popm <si, di, es, ds>
- pop bp
- ret
- endproc ram_segwordset
- ;------------------------------------------------------------------------------;
- ; ram_segtoseg(int segm, int soffs, int doffs, int bwidth);
-
- pubproc DIGPRIV ram_segtoseg <segm, soffs, doffs, bwidth>
- push bp
- mov bp,sp
- pushm <ds, es, di, si>
-
- mov si, [bp].soffs
- mov di, [bp].doffs
- mov cx, [bp].bwidth
- cld ;set direction to increment
-
- mov ax, [bp].segm
- mov ds, ax
- mov es, ax
-
- ; if (soffs < doffs) postive move
-
- cmp si, di
- jae positive
- ;---------
- ; negative move
- add si, cx ; point si and di to end of area
- dec si
- add di, cx
- dec di
-
- std
- ;; shr cx, 1
- ;; jnc ndow
- ;; movsb
- ;;ndow:
- ;; jcxz ssdone
- ;; dec si
- ;; dec di
- ;; rep movsw
- rep movsb ;; move only a byte at a time so ega scroll will work
- jmp short ssdone
- ;---------
- positive:
- cld
- ;; shr cx, 1
- ;; jnc pdow
- ;; movsb
- ;;pdow:
- ;; jcxz ssdone
- ;; rep movsw
- rep movsb ;; move only a byte at a time so ega scroll will work
- ;--------------------------
- ssdone:
- cld
- popm <si, di, es, ds>
- pop bp
- ret
- endproc ram_segtoseg
- ;------------------------------------------------------------------------------;
- ; ram_mem1toseg(unsigned segm, unsigned segoffs, byte *memaddr, unsigned byte1, unsigned blen);
- ; -Interleave bytes from memaddr array with byte1 at segm:segoffs.
-
- pubproc DIGPRIV ram_mem1toseg <segm, segoffs, memaddr, dptr, byte1, blen>
- push bp
- mov bp,sp
- pushm <ds, es, di, si>
-
- mov cx, [bp].blen
- jcxz m1sdone
-
- mov di, [bp].segoffs
- mov ax, [bp].segm
- mov es, ax
-
- mov si, [bp].memaddr
- IF FAR_DATA
- mov ax, [bp].memaddr+2 ;get memaddr segment
- mov ds, ax
- ENDIF
- ;--------------------------
- mov ax, [bp].byte1
- cld ;set direction to increment
- mem1s:
- movsb
- stosb
- loop mem1s
- ;--------------------------
- m1sdone:
- popm <si, di, es, ds>
- pop bp
- ret
- endproc ram_mem1toseg
- ;------------------------------------------------------------------------------;
- ; ram_memtoseg(int segm, int segoffs, byte *memaddr, int bwidth);
-
- pubproc DIGPRIV ram_memtoseg <segm, segoffs, memaddr, dptr, bwidth>
- push bp
- mov bp,sp
- pushm <ds, es, di, si>
-
- mov si, [bp].memaddr
- mov di, [bp].segoffs
- mov cx, [bp].bwidth
- cld ;set direction to increment
-
- mov ax, [bp].segm
- mov es, ax
-
- IF FAR_DATA
- mov ds, [bp].memaddr+2 ;get memaddr segment
- ENDIF
- ;--------------------------
- shr cx, 1
- jnc msword
- movsb
- msword:
- jcxz msdone
- rep movsw ;store character and attribute
- ;--------------------------
- msdone:
- popm <si, di, es, ds>
- pop bp
- ret
- endproc ram_memtoseg
- ;------------------------------------------------------------------------------;
- ; ram_segtomem(int segm, int segoffs, byte *memaddr, int bwidth);
-
- pubproc DIGPRIV ram_segtomem <segm, segoffs, memaddr, dptr, bwidth>
- push bp
- mov bp,sp
- pushm <ds, es, di, si>
-
- IFE FAR_DATA
- mov bx, ds
- ENDIF
- mov si, [bp].segoffs
- mov di, [bp].memaddr
- mov cx, [bp].bwidth
- cld ;set direction to increment
- ;--------------------------
- mov ax, [bp].segm
- mov ds, ax
-
- IF FAR_DATA
- mov es, [bp].memaddr+2 ;get memaddr segment
- ELSE
- mov es, bx
- ENDIF
-
- shr cx, 1
- jnc smword
- movsb
- smword:
- jcxz smdone
- rep movsw ;store character and attribute
- ;--------------------------
- smdone:
- popm <si, di, es, ds>
- pop bp
- ret
- endproc ram_segtomem
- ;------------------------------------------------------------------------------;
- ENDPS
- end
- ;------------------------------------------------------------------------------;
-