; * * * * * * * * * * * * * * * version 2.1 * * * * * * * * * * * * * * * ; [7] Do tab expansion and suppress nulls while in telnet mode. ; RonB,12/24/83 ; * * * * * * * * * * * * * * * version 2.0 * * * * * * * * * * * * * * * ; BDOS command codes reset EQU 00H conin EQU 01H conout EQU 02H rdrin EQU 03H punout EQU 04H lstout EQU 05H dconio EQU 06H gtiob EQU 07H prstr EQU 09H consta EQU 0BH opnfil EQU 0FH clsfil EQU 10H sfirst EQU 11H snext EQU 12H delf EQU 13H readf EQU 14H writef EQU 15H makef EQU 16H cflsz EQU 23H dmaset EQU 1AH dmabas EQU 33H CSEG $ ; Resume coding segment. tmsgcr: call tmsg ; Print the string call tcrlf ; Print a CRLF. ret tcrmsg: push dx ; Don't trash our string. call tcrlf ; Print a CRLF. pop dx ; Restore our string. call tmsg ; Print the string ret tcmsgc: push dx ; Don't trash our string. call tcrlf ; Print a CRLF. pop dx ; Restore our string. call tmsg ; Print the string call tcrlf ; Print a CRLF. ret tcrlf: lea dx, crlf ; Get a CRLF. call tmsg ; Print it. ret tmsg: push bx ; Don't clobber my ACs. mov cl, prstr ; Ask BDOS for string printing. int 224 ; What a way to call the BDOS. pop bx ret bout: mov cl, conout ; Ask BDOS for character printing. int 224 ret bin: mov cl, conin ; Get a char from the console. int 224 ret dbout: if necapc cmp dl, 0 ; skip null fillers ;[7] begin je dbout3 cmp dl, tab ; need routine to expand tabs je dotab ;[7] end endif dbout2: mov cl, dconio ; Put a char to the console. int 224 dbout3: ret if necapc dotab: lea dx, curbuf ; get current cursor position ;[7] begin mov cl, 4 int 220 ; special BIOS function mov al, curbuf+5 ; column position in ascii (01-80) sub al, '0' shl al, 1 ; multiply 1st digit by 10 mov ah, al shl al, 1 shl al, 1 add al, ah add al, curbuf+6 ; add second digit sub al, '0' dec al ; number of spaces needed and al, 07h ; = 8 - ((col-1) mod 8) mov cx, 0008h sub cl, al dotab2: push cx mov dl, ' ' call dbout2 pop cx loop dotab2 ret ;[7] end endif dbin: push dx mov cl, dconio ; Get a char from the console without mov dl, 0FFH ; interference. int 224 pop dx ret dbinst: push dx mov cl, dconio ; Check the console's input status. mov dl, 0FEH int 224 pop dx cmp al, 0 ; Char ready? jz dbins2 jmp rskp ; Yes. dbins2: ret ; No. ; Halt this program. haltf: mov cl, reset ; End this program. int 224 ret ; One never knows! ; Get the first file in a wild card search. gtjfn: mov cl, sfirst int 224 ret ; Get the next file in a wild card search. gnjfn: mov cl, snext int 224 ret ; Close the file pointed to by the FCB in DX. closf: mov cl, clsfil int 224 ret ; Open the file pointed to by the FCB in DX. openf: cmp dmaflg, 0 ; Has the DMA been set up? jnz openf2 call inidma ; No, so set it up. openf2: mov cl, opnfil int 224 ret ; Create the file pointed to by the FCB in DX. create: cmp dmaflg, 0 ; Has the DMA been set up? jnz creat2 call inidma ; No, so set it up. creat2: mov cl, makef int 224 ret inidma: push dx lea dx, dma call setdma pop dx mov dmaflg, 0FFH ; Say we've mapped the DMA. ret ; Write a record to the file pointed to by the FCB in DX. soutr: mov cl, writef int 224 ret ; Read a record from the file pointed to by the FCB in DX. sinr: mov cl, readf int 224 ret ; Delete the file pointed to by the FCB in DX. delete: mov cl, delf int 224 ret ; Sets the DMA to the offset pointed to in DX and the base in DS. setdma: mov cl, dmaset int 224 mov dx, ds mov cl, dmabas int 224 ret ; Jumping to this location is like retskp. It assumes the instruction ; after the call is a jmp addr. rskp: pop bp add bp, 3 push bp ret ; Jumping here is the same as a ret. r: ret DSEG $ ; Resume data segment. crlf DB cr,lf,'$' curbuf DB esc,'[25;80R' ; string returned by cursor pos request ;[7]