; ; PROGRAM: SLMT.Z80 ; AUTHOR: Fred Haines ; PURPOSE: This program sets the left margin on printers using the ; Diablo 1610 command set, clears all previously set tabs, ; and inserts nine new tabs at the standard eight-column ; interval. ; DATE: Febrary 17, 1988 ; This program has only one command, SLMT n, where n is a number from 1 to ; 255, and it sets a left margin on your Diablo 1610 compatible daisywheel ; printer in that column. (The number 0 is also converted to column 1). It then ; sets nine tab stops at eight-column intervals. Typing SLMT alone, or with ; any parameter other than a number from 0-255, displays the program banner. ; SLMT is based on SLM v2.0 and Z33SLM v1.0, and, like the latter, allows ; assembly as a Z33 program to link and load in high memory. Set Z33CIM FALSE ; to assemble file for ordinary load at base of TPA. Loading in high memory ; allows you to restart VDE with GO , saving you the time normally ; taken to reload VDE. ; equates false equ 0 true equ not false ; user setable equates z33cim equ true ; set true to link and load in high memory ldaddr equ 98 ; program load address * 100h, that is, ; 80 = 8000h, 98 = 9800h, and so on - needed ; for banner only if Z33CIM is set TRUE ; general equates z33env equ 0fe00h bdos equ 05h fcp equ 5dh ; fcb + 1 esc equ 1bh tab equ 09h cr equ 0dh ; external syslib routines ext print ext crlf ext eval10 ext lout ext lprint ; Z33 header entry: jr start0 ; must use relative jump defb 0 ; filler db 'Z3ENV',3 ; type-3 environment z3env: dw z33env ; filled in by Z33 dw entry ; intended load address start0: ld hl,0 ; point to warmboot entry ld a,(hl) ; save the byte there di ; protect against interrupts ld (hl),0c9h ; replace warmboot with a return opcode rst 0 ; call address 0, pushing RETADDR onto stack retaddr: ld (hl),a ; restore byte at 0 dec sp ; get stack pointer to point dec sp ; ..to the value of RETADDR pop hl ; get it into HL and restore stack ei ; we can allow interrupts again ld de,retaddr ; this is where we should be xor a ; clear carry flag push hl ; save address again sbc hl,de ; subtract - we should have 0 now pop hl ; restore value of RETADDR jr z,start ; if addresses atched, begin real code ld de,notz33msg-retaddr ; offset to message add hl,de ex de,hl ; switch pointer to message into DE ld c,9 jp 0005h ; return via BDOS print string function notz33msg: defb 'Not Z33+$' ; abort message if not Z33-copatible ; print program banner and help screen start: call print db 'Set Left Margin and Tabs v1.0',0 if z33cim call print db ' (loaded at ' db ldaddr / 10 + '0' db ldaddr mod 10 + '0' db '00h)',0 endif ; z33cim call crlf call print db 'Syntax:',0 call crlf call print db ' SLMT n sets left margin at column n = 1-255',0 call crlf call print db ' and standard 8-column tab stops on',0 call crlf call print db ' Diablo 1610-compatible printers.',0 ; send prefix string to printer ld a,esc call lout ld a,tab call lout ; get offset, convert, send to printer ld hl,fcp ; point hl at column position call eval10 ; convert to hex, result in a and e cp 0 ; is it zero? jp nz,skip ; if not, don't increment inc a ; if so, bump to 1 skip: call lout ; set left margin ld a,esc call lout ld a,'9' call lout ; clear previous tabs ld b,9 ; set counter to clear nine tabs clear: ld a,tab ; move to tab stop call lout clrtab: ld a,esc ; printer code escape prefix call lout ld a,38h ; clear tab code call lout djnz clear ; loop if not done ld a,cr ; return carriage to left margin call lout ; set eight tab stops at intervals of eight columns ld b,9 ; set counter for nine tab stops gonext: call lprint ; send eight spaces to printer db ' ',0 settab: ld a,esc ; printer code escape prefix call lout ld a,31h ; set tab code call lout djnz gonext ; loop if not done ld a,cr ; return carriage to left margin call lout ret ; finished ; end