Title IMS -In Memory Submit for the MD-11 using CP/M 3 (5_Feb_84) ; ; Copyright 1983, 1984 ; Morrow Designs, Inc. ; San Leandro, Ca. ; Howard Fullmer, John Zalabak ; ; ; This program Moves all characters following the command ; until the first carriage return of exclamation point into the ; Ims Buffer. This character string is collectivly refered to as ; the command tail. ; Two operations are preformed on the command tail before it ; is moved into the Ims buffer. First, all leading white space is ; removed (i.e. spaces, commas and tabs). Secondly; All occurances of ; the carriage return symbol (;) are replaced with carriage returns; ; and, All occurances of the warm boot symbol (|) are replaced with ; carriage returns with the most signifigant bit set. ; ; .z80 aseg org 0100h ;---------------------------------------------------------------------- ; Equates (5_Feb_84) ;------------------- ; Bios_Entry equ 0 ;Warm Boot Vector Bdos_Entry equ 5 ;bdos call location Bdos_PString equ 9 ;bdos Output Sting to CON: function IBuf equ 80h ;tail buffer location RamDatY_Offset equ 42h - 3 ;Offset to the RamDatY Vector Pool_Offset equ 46h - 3 ;Offset to the Pool Vector CFlag equ 12h @ImsAct equ 6 @ImsWet equ 7 Tab equ 9 ;Tab Cr equ 0Dh ;carriage return PCr equ 8Dh ;pause carriage return Lf equ 0Ah ;line feed page ;---------------------------------------------------------------------- ; IMS (5_Feb_84) ;--------------- ; ; Exit with Error if there's no command tail ;------------------------------------------- ; ims: ld hl,IBuf ;HL:= Start of command tail ld a,(hl) ;A:= Tail Length or a ;If (tail length ne 0) jr nz,ImsSk1 ld de,ntmesg ; pointer to no tail message ld c,Bdos_PString ; StrOut line call Bdos_Entry ; call bdos jp Bios_Entry ; warm boot ; Strip Leading White Space ;-------------------------- ; ImsSk1: ld b,a ;B:= tail length ImsLp1: inc hl ;Repeat HL:= Pointer to next char in Ims String dec b ; B:= Ims String Adjusted Length ld a,(hl) ; A:= Starting char of Ims String cp ' ' ; (Char eq Space) jr z,ImsLp1 cp ',' ; (Char eq Comma?) jr z,ImsLp1 cp Tab ; (Char eq Tab?) jr z,ImsLp1 ;Until (char ne Space or Comma or Tab) inc b ;B:= Ims String Length dec hl ;HL:= Ims String Base Pointer ld (hl),b ;(set correct length) page ;Translate special characters in the Ims String ;---------------------------------------------- ; push hl ;HL is a pointer to the base of the Ims String ImsLp2: inc hl ;Repeat (move HL past the length byte) ld a,';' ; If (char eq Standard_Cr) cp (hl) jr nz,ImsSk2 ld (hl),Cr ; substitute Cr jr ImsSk3 ImsSk2: ld a,'|' ; Else If (char eq Pause_Cr) cp (hl) jr nz,ImsSk3 ld (hl),PCr ; substitute pause Cr ImsSk3: djnz ImsLp2 ;Until (all of buffer is processed) ;Inject the Ims string into the Ims buffer ;----------------------------------------- ; pop de ;pointer to processed buffer call Inject ;Inject the Ims String into the Free Space jp Bios_Entry ;warm boot page ;---------------------------------------------------------------------- ; INJECT - Insert character string into IMS buffer, activate IMS ;--------------------------------------------------------------- ; 1) enter with [DE] -> string with length byte first, exit w/IMS active ; inject: ld hl,RamDatY_Offset call Get_Pointer push hl pop iy ;IY:= RamDatY ld a,(de) ;get length byte ld c,a ;save ld b,0 inc de ;point at string text push de ;save string address ld hl,Pool_Offset ;address of free space call Get_Pointer ld a,-1 ;free marker call find ;[de]=free length ;[hl]->free.leng(hi) push hl ;save free address ld h,d ld l,e ;[hl]=free length or a ;[cy]=0 sbc hl,bc ;free.len = free.len - string.len jr nc,ImsSk ;if (out of space) pop de ; drop pop de ; drop ret ; exit with carry = set ImsSk: ex de,hl ;[de]=new free.len ex (sp),hl ;[hl]=free.address (save old length) ld (hl),d ;write new free.len(hi) dec hl ld (hl),e ;write new free.len(lo) inc hl inc hl ;[hl] -> free.data_area pop de ;[de] = old free.len add hl,de ;point at IMS.head (=fd) inc hl ;[hl] -> ims.len(lo) ld e,(hl) ;read ims.len inc hl ld d,(hl) ex de,hl ;[hl]=ims.len, [de]->ims.len(hi) ; add hl,de ;ims.len = ims.len + string.len add hl,bc ;ims.len = ims.len + string.len ex de,hl ;[hl] -> ims.len(hi) sbc hl,bc ;ims.address = ims.address - string.len ld (hl),d ;write new ims header, ims.len(hi) dec hl ld (hl),e dec hl ld (hl),0fdh ;ims head complete inc hl inc hl inc hl ex de,hl ;[de] -> new ims space (destination) pop hl ;[hl] -> string text ldir ;copy string ld a,(iy+CFlag) bit @imswet,a jr z,fcn4 bit @imsact,a jr nz,fcn4 dec de ld a,(de) set 7,a ;mark bit ld (de),a ;of last char fcn4: set @imswet,(iy+CFlag) set @imsact,(iy+CFlag) xor a ret ;exit with carry = clear ;---------------------------------------------------------------------- ; FIND - Find a block header ;--------------------------- ; find searches bios ram area starting from hl for the block ; header contained in a. ; find: cp (hl) ;see if header code matches inc hl ;increment pointer ld e,(hl) ;get offset to next block inc hl ld d,(hl) ret z ;return if block found inc hl ;set pointer to next block add hl,de jr find ;keep looking page ;---------------------------------------------------------------------- ; Get a Bios Pointer (10_Jan_85) ;------------------------------- ; 1) Entry with HL equal to the Offset of the Vector Desired ; Get_Pointer: push de ld de,(Bios_Entry+1) add hl,de ;HL:= Pointer to Vector ld e,(hl) inc hl ld d,(hl) ex de,hl pop de ;HL:= Vector ret ;Return ;---------------------------------------------------------------------- ; Data Area ;---------- ; ntmesg: db Cr,Lf,Lf,'IMS requires a CP/M command list.',Cr,Lf,'$' end