Title IMS -In Memory Submit for the Micro-Decision (25_Apr_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. ; ; ; 4/16/84 Add version check for use with CP/M 2 or 3. ; .z80 aseg org 0100h ;---------------------------------------------------------------------- ; Equates (25_Apr_84) ;------------------- ; WrmBot equ 0 ;Warm Boot Vector sys equ 5 ;bdos call location StrOut equ 9 ;bdos Output Sting to CON: function Ret_ver equ 0ch ;return version number ExtFun equ 0FE00h ;bios extended function location InjIMS equ 11 InjIMS_off equ 52h IBuf equ 80h ;tail buffer location Tab equ 9 ;Tab Cr equ 0Dh ;carriage return PCr equ 8Dh ;pause carriage return Lf equ 0Ah ;line feed page ;---------------------------------------------------------------------- ; IMS (16_Apr_84) ;--------------- ; ; Exit with Error if there's no command tail ;------------------------------------------- ; ims: ld de,IBuf ;DE:= Start of command tail ld a,(de) ;A:= Tail Length or a ;If (tail length ne 0) jr nz,ImsSk1 ld de,ntmesg ; pointer to no tail message ld c,StrOut ; StrOut line call sys ; call bdos jp WrmBot ; warm boot ; Strip Leading White Space ;-------------------------- ; ImsSk1: ld b,a ;B:= tail length ImsLp1: inc de ;Repeat DE:= Pointer to next char in Ims String dec b ; B:= Ims String Adjusted Length ld a,(de) ; 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) dec de ;DE:= last white_space character inc b ;B:= Ims String Length page ;Translate special characters in the Ims String ;---------------------------------------------- ; ld hl,IMSbuf ;HL:= pointer to translated Ims String ld (hl),b ;Save the length ld c,0 ;C:= Length adjustment (used in back slash rtn) ImsLp2: inc hl ;Repeat (output pointer (HL) to next character) inc de ; (input pointer (DE) to next character) ld a,(de) cp ';' ; If (char eq Standard_Cr) jr nz,ImsSk2 ld a,Cr ; substitute Cr jr ImsSto ImsSk2: cp '|' ; Else If (char eq Pause_Cr) jr nz,ImsSk3 ld a,PCr ; substitute pause Cr jr ImsSto ImsSk3: cp '\' ; Else If (char eq back slash) jr nz,ImsSto dec b ; Adjust the line length inc c ; increment Length_Adjustment inc de ; (move inp_pointer to next char) ld a,(de) ; substitute the next character ImsSto: ld (hl),a djnz ImsLp2 ;Until (all of buffer is processed) ld de,IMSbuf ;DE:= Pointer to start of translated input buf ld a,(de) ;A:= Length Byte sub c ;Subtract the number of backslashed characters ld (de),a ;Save the adjusted length ;Inject the Ims string into the Ims buffer ;----------------------------------------- ; push de ld c,Ret_ver ;check version of CP/M call sys ld a,0f0h and l cp 30h jr nz,cpm2 ;jump if CP/M 2 pop de ld a,InjIMS ;A:= extended function call (inject ims) call ExtFun ;Inject the Ims Sting jp WrmBot ;warm boot cpm2: pop de ld hl,(1) ld bc,InjIMS_off add hl,bc call hljp jp WrmBot hljp: jp (hl) ntmesg: db Cr,Lf,Lf,'IMS requires a CP/M command list.',Cr,Lf,'$' IMSbuf: ds 256,0 ;Local Ims buffer (holds translated input line) end