'===========================================================================
' Subject: FAST MEM COPY                      Date: 05-22-97 (17:01)       
'  Author: Angelo Ken Pesce                   Code: PB                     
'  Origin: us0082@uniserv.uniplan.it        Packet: PB.ABC
'===========================================================================
' THIS IS ONLY AN EXAMPLE OF HOW TO DO FAST MEM COPY
' USELESS!!!!

$optimize size
$cpu 8086
$float npx
$lib all off
$error all off
$dim all
$compile exe

' --------------------------------------------------------
' MEMDISP V0.000000001beta for powerbasic by Angelo KEN Pesce
' Email:ken@uniserv.uniplan.it

' This program displays a bitmap (or I should say "bytemap"??) of the
' memory.
' Starting segment=0000h
' Commands:
' a,z = first half/second half (the program displays 32k at a time)
' s,x = next segment/previous segment (max. seg=f000h)
' e = end
' --------------------------------------------------------


call intro

' Set videomode 13h (320x200x8bit)
! mov ax,&h13
! int &h10


dim segment as word
dim ky as string
dim flag as byte
dim seglist(15) as word
dim i as byte
dim tmp as word

for i=0 to 15
read tmp
seglist(i)=tmp
next

i=0:' Now i = starting segment in seglist. i=0,startseg=0000h
segment=seglist(i)

do

' COPY 32KB AT CURRENT SEGMENT TO a000h (Video memory)
! push ds
! mov ax,segment
! mov si,0
! mov ds,ax
! mov di,0
! mov ax,&ha000
! mov cx,16384
! mov es,ax
! rep movsw
! pop ds

' KEYTEST
ky=inkey$
if ky<>"" then
if ky="e" then end else
if ky="a" and flag=0 then segment=segment+&h800:flag=1 else
if ky="z" and flag=1 then segment=segment-&h800:flag=0 else
if ky="s" and i<15 then incr i:segment=seglist(i):flag=0:else
if ky="x" and i>0 then decr i:segment=seglist(i):flag=0
end if
loop

' SEGMENT DATA
data &h0000,&h1000,&h2000,&h3000,&h4000,&h5000,&h6000,&h7000,&h8000
data &h9000,&ha000,&hb000,&hc000,&hd000,&he000,&hf000

sub intro
color 8
print " MEMDISP V0.000000001beta for PowerBasic"
print " by Angelo KEN Pesce"
print " Email:ken@uniserv.uniplan.it"
print "-------------------------------"
print
print:color 6
print " This program displays a bitmap (or I should say 'bytemap'??) of the memory."
print
print:color 14
print " Starting segment=0000h"
print:color 4
print
print " Commands:"
print
print " a,z = first half/second half (the program displays 32k at a time)"
print " s,x = next segment/previous segment (max. seg=f000h)"
print " e = end"
do:loop until inkey$<>""
end sub
