home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
mbug
/
mbug097.arc
/
SWAPA.MAC
< prev
next >
Wrap
Text File
|
1979-12-31
|
3KB
|
210 lines
;
;
; SWAPA : Operating system support program.
; Selects what A: refers to (physical A, ramdisk M or ramdisk N)
;
;
bdos equ 5
cr equ 13
lf equ 10
tab equ 9
bell equ 7
map_port equ 50h
normal_map equ 4
sys_page equ 5
rst_00h equ 0C7h
command_line equ 80h
bios_start equ 0E700h
id equ 218h
id_val equ 0AA55h
swap_a_m equ 21Bh
pages_n equ 227h
sl_table equ 2CBh
sl_messages equ 2CDh
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
jp nz,get_lost
ld hl,move_stuff_src
ld de,move_stuff_dest
ld bc,move_stuff_len
ldir
ld hl,command_line
ld a,(hl)
or a
jr z,show_use
ld b,a
parse:
inc hl
ld a,(hl)
cp '?'
jr z,show_status
cp 'A'
jr z,set_swap
cp 'M'
jr z,set_swap
cp 'N'
jr z,set_swap_n
cp ' '
jr nz,show_use
djnz parse
show_use:
ld de,use_mesg
ld c,9
call bdos
jr show_status
set_swap_n:
ld de,no_n_mesg
ld a,(bios_start+pages_n)
or a
jr z,prt_ret
ld a,'N'
set_swap:
sub 'A'
ld (bios_start+swap_a_m),a
ld a,rst_00h
ld (ret_inst),a
call change_status_mesg
show_status:
ld hl,name_a
ld de,name_m
ld bc,name_n
ld a,(bios_start+swap_a_m)
cp 'M'-'A'
jr z,ss_is_m
cp 'N'-'A'
jr nz,ss_put
push bc
push hl
pop bc
pop hl
jr ss_put
ss_is_m:
ex de,hl
ss_put:
push bc
push de
ld de,stat_a
ld bc,len_name
ldir
pop hl
ld de,stat_m
ld c,len_name
ldir
pop hl
ld de,stat_n
ld c,len_name
ldir
ld de,stat_mesg
jr prt_ret
get_lost:
ld de,wb_mesg
prt_ret:
ld c,9
call bdos
ret_inst:
ret
move_stuff_src equ $
.phase 8000h
move_stuff_dest equ $
change_status_mesg:
ld a,sys_page
out (map_port),a
ld hl,(bios_start+sl_table)
ld de,+(3*5)+2
add hl,de
ld e,(hl)
ld hl,(bios_start+sl_messages)
add hl,de
ld e,3
add hl,de
ld a,(bios_start+swap_a_m)
add a,'A'
ld (hl),a
ld a,normal_map
out (map_port),a
ret
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 'SWAPA : swaps drive A: and either ramdisk.',cr,lf,lf,'$'
wb_mesg:
db bell,'Wrong operating system !!',cr,lf,lf,'$'
use_mesg:
db 'Use : SWAPA A/M/N/?',cr,lf
db tab,'A - assigns A: to pysical drive A,',cr,lf
db tab,tab,'(this is the normal configuration)',cr,lf
db tab,'M - assigns A: to first ramdisk (M)',cr,lf
db tab,tab, 'and M: to physical drive A,',cr,lf
db tab,'N - assigns A: to second ramdisk (N, if enabled)',cr,lf
db tab,tab, 'and N: to physical drive A,',cr,lf
db tab,'? - displays current assignment.',cr,lf,lf,'$'
no_n_mesg:
db bell,'No memory assigned to ramdisk N:.',cr,lf,lf,'$'
name_a:
db 'physical drive A',0,0
name_m:
db 'first ramdisk (M)',0
name_n:
db 'second ramdisk (N)'
len_name equ $-name_n
n_space macro
ds len_name,' '
endm
stat_mesg:
db 'A: --> '
stat_a:
n_space
db ',',cr,lf
db 'M: --> '
stat_m:
n_space
db ',',cr,lf
db 'N: --> '
stat_n:
n_space
db '.',cr,lf,lf,'$'
if ($ and 7Fh) ne 0
ds 80h-($ and 7Fh)
endif
end