home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
MBUG
/
MBUG097.ARC
/
ERARAM.MAC
< prev
next >
Wrap
Text File
|
1979-12-31
|
4KB
|
269 lines
;
;
; ERAseRAM : 512k operating system support program.
; Erases ramdisks.
;
;
bdos equ 5
cr equ 13
lf equ 10
tab equ 9
bell equ 7
command_line equ 80h
bios_start equ 0E700h
id equ 218h
id_val equ 0AA55h
pages_m equ 225h
pages_n equ 227h
mem_page_addr equ 292h
map_port equ 50h
bios_map equ 0Ch
normal_map equ 4
map macro mval
ld a,mval
out (map_port),a
endm
aseg
org 100h
ld de,start_mesg
ld c,9
call bdos
ld hl,(bios_start+id)
ld de,id_val
or a
sbc hl,de
jr nz,get_lost
ld hl,move_stuff_src
ld de,move_stuff_dest
ld bc,move_stuff_len
ldir
ld hl,command_line
ld b,(hl)
ld a,b
or a
jr z,ask_which
parse_name:
inc hl
ld a,(hl)
cp 'M'
jr z,got_name
cp 'N'
jr z,got_name
cp ' '
jr nz,ask_which
djnz parse_name
jr ask_which
got_name:
sub 'M'
ld (name),a
or a
jr z,gn_1
ld a,(bios_start+pages_n)
or a
jr z,show_use
gn_1:
dec b
jr z,ask_conf
dec b
jr z,ask_conf
inc hl
jr parse_conf
parse_conf:
inc hl
ld a,(hl)
cp 'F'
jr z,do_erase
cp ' '
jr nz,ask_conf
djnz parse_conf
jr ask_conf
do_erase:
ld a,(name)
or a
jr z,de_1
ld a,'N'
ld (era_name),a
ld a,(bios_start+pages_m)
de_1:
add a,3
jp erase_it
show_use:
ld de,use_mesg
jr prt_ret
get_lost:
ld de,wb_mesg
prt_ret:
ld c,9
call bdos
ret
ask_which:
call show_use
ld a,(bios_start+pages_n)
or a
jr z,ask_conf
ld de,ask_name_mesg
ld c,9
call bdos
aw_1:
ld e,0FFh
ld c,6
call bdos
res 5,a
cp '['-40h
jr z,aw_4
cp 'C'-40h
jr nz,aw_3
aw_4:
pop hl
ld de,crlf_mesg
jr prt_ret
aw_3:
cp 'N'
jr z,aw_2
cp 'M'
jr nz,aw_1
aw_2:
push af
ld de,crlf_mesg-1
ld (de),a
ld c,9
call bdos
pop af
sub 'M'
ld (name),a
ask_conf:
ld a,(name)
or a
jr z,ac_1
ld a,'N'
ld (ask_conf_name),a
ac_1:
ld de,ask_conf_mesg
ld c,9
call bdos
ac_2:
ld e,0FFh
ld c,6
call bdos
or a
jr z,ac_2
res 5,a
cp 'Y'
jr z,ac_3
ld de,no_era_mesg
jr prt_ret
ac_3:
ld de,crlf_mesg-1
ld (de),a
ld c,9
call bdos
jp do_erase
move_stuff_src equ $
.phase 9000h
move_stuff_dest equ $
erase_it:
push af
cp 3
jr z,er_1
ld a,'N'+80h
ld (ram_name),a
er_1:
map bios_map
pop af
ld hl,(bios_start+mem_page_addr)
ld (call_addr),hl
call_addr equ $+1
call 0
ld hl,32
ld de,33
ld bc,+(255*32)-1
ld (hl),0E5h
ldir
ld hl,ram_file_name
ld de,0
ld bc,16
ldir
xor a
ld b,16
er_2:
ld (de),a
inc de
djnz er_2
map normal_map
ld de,era_mesg
ld c,9
call bdos
rst 0
ram_file_name:
db 0,'-RAMDISK'
ram_name:
db 'M',':'+80h,' ',0,0,0,0
move_stuff_len equ $-move_stuff_dest
.dephase
start_mesg:
db cr,lf,'Microbee 512k Enhanced Operating System v2.2,'
db ' (c) 1987 Peter Broughton.',cr,lf
db 'ERARAM : Erases ramdisks.',cr,lf,lf,'$'
wb_mesg:
db bell,'Wrong operating system !!',cr,lf,lf,'$'
use_mesg:
db 'Use : ERARAM [M:/N: [F]]',cr,lf
db tab,'F - don''t ask for confirmation.',cr,lf
db tab,'If no memory is assigned to N: then ramdisk M: is'
db ' assumed.'
crlf_mesg:
db cr,lf,lf,'$'
ask_name_mesg:
db 'Erase which ramdisk (M:/N:) ? $'
ask_conf_mesg:
db 'Erase ramdisk '
ask_conf_name:
db 'M:, are you sure ? $'
no_era_mesg:
db 'N',cr,lf,lf,'Erase aborted !!',cr,lf,lf,'$'
era_mesg:
db 'Ramdisk '
era_name:
db 'M: erased !!',cr,lf,lf,'$'
name equ $
if ($ and 7Fh) ne 0
ds 80h-($ and 7Fh)
endif
end