home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
SIMTEL
/
CPMUG
/
CPMUG051.ARK
/
STG2SUP.ASM
< prev
next >
Wrap
Assembly Source File
|
1984-04-29
|
4KB
|
218 lines
%SREV: DB 31H ; 05/31/79 R. CURTISS
%;
%; PUT REVISION INFO INTO SIGNON MESSAGE
%;
%; HL - REVISION LIST POINTER
%; DE - DESTINATION STRING POINTER
%; C - COUNT OF REVISION ITEMS
%;
%DSPR: MOV A,M
% INX H
% STAX D ; PUT REV ID CHARACTER
% INX D
%
% PUSH B ; SAVE COUNT
% MOV C,M
% INX H
% MOV B,M ; BC POINTS TO REV NUMBER
% INX H
%
% LDAX B ; GET REVISION BYTE
% RRC
% RRC
% RRC
% RRC
% CALL DSPR1
% LDAX B
% CALL DSPR1
% INX D ; SKIP FOR SPACING
%
% POP B ; RECALL COUNT
% DCR C
% JNZ DSPR
%
% RET
%
%
%DSPR1: ANI 0FH
% ADI '0'
% CPI '9'+1
% JC $+5
% ADI 7
% STAX D
% INX D
% RET
%;
%; ----------------------------------- INITL
%; STAGE2 INITIALIZATION
%;
%INITL: LXI H,LINE ; LINE BUFFER ORIGIN
% SHLD IPTR
% SHLD OPTR
% SHLD WPTR
% XRA A
% STA LENGTH
%;
% LXI D,MEMLOW
% CALL MEMSET
% PUSH H ; SAVE HIGH BOUND
%
% XCHG
% LXI D,15
% DAD D
% MOV A,L
% ANI 0F0H
% MOV L,A ; ADJUSTED FOR 4 BYTE BOUNDRY
% CALL UDIV4 ; DIVIDE BY 4
% SHLD K8 ; LOW MEMORY BOUND
%
% POP H ; RECALL HIGH BOUND
% LXI D,-15
% DAD D
% MOV A,L
% ANI 0F0H
% MOV L,A ; ADJUSTED FOR 4 BYTE BOUNDRY
% CALL UDIV4 ; DIVIDE BY 4
% SHLD K9 ; HIGH MEMORY BOUND
% RET
%;
%; ------------------------------------ MOVE
%; MOVE A FLUB WORD TO OR FROM MEMORY
%;
%; REG(DE) = MEM(4*HL)
%;
%GMOVE: DAD H
% DAD H ; MULTIPLY BY 4
% XCHG
% JMP MOVE
%;
%; MEM(4*HL) = REG(DE)
%;
%SMOVE: DAD H
% DAD H ; MULTIPLY BY 4
%
%MOVE: LDAX D
% MOV M,A
% INX H
% INX D
%
% LDAX D
% MOV M,A
% INX H
% INX D
%
% LDAX D
% MOV M,A
% INX H
% INX D
%
% LDAX D
% MOV M,A
% RET
%;
%; ------------------------------------------ REWIND
%; REWIND ON CHANNEL (A)
%;
%REWIND: MOV B,A ; CHANNEL NUMBER
% MVI A,0 ; OPERATION CODE
% CALL IOOP
% RET
%;
%; ------------------------------------------- READ
%; INPUT NEXT LINE FROM CHANNEL (A)
%;
%READ: MOV B,A ; CHANNEL NUMBER
% MVI A,0FFH ; OPERATION CODE
% LXI H,LINE ; START OF LINE BUFFER
% SHLD IPTR
% CALL IOOP
% LXI H,LENGTH
% MOV E,M ; GET LINE LENGTH
% MVI D,0
% INX H ; POINT TO START OF LINE
% SHLD OPTR ; RESET LINE BUFFER POINTER
% DAD D ; POINT ONE PAST END OF LINE
% MVI M,0FFH ; TERMINATE LINE
% RET
%;
%; ------------------------------------------- LEN
%; COMPUTE LINE LENGTH (LENGTH) = (HL) - LINE ; (HL) = LINE
%;
%LEN: PUSH PSW ; SAVE (A)
% LXI D,LINE ; START OF LINE BUFFER
% CALL DSUB
% MOV A,L ; LINE LENGTH .LT. 255
% STA LENGTH
% XCHG ; (HL) = LINE
% POP PSW ; RESTORE (A)
% RET
%;
%; ---------------------------------------------- RDCH
%; GET CHARACTER FROM LINE
%;
%RDCH: LHLD IPTR ; GET LINE BUFFER POINTER
% MOV A,M
% INX H
% SHLD IPTR
% RET
%;
%; ------------------------------------------------- WRCH
%; STORE CHARACTER INTO LINE BUFFER
%;
%WRCH: LHLD OPTR ; GET LINE BUFFER POINTER
% ORA A ; TEST (A)
% JM WRCH1 ; JUMP IF NEGATIVE
%;
% MOV B,A ; SAVE CHARACTER POINTER
% LXI D,LINE+132 ; END OF LINE POINTER
% CALL UCMPLT ; UNSIGNED COMPARE LESS THAN
% JNC WRCH1 ; JUMP IF OPTR AT END OF BUFFER
%;
% MOV M,B ; PUT CHARACTER INTO BUFFER
% INX H ; INCREMENT POINTER
% SHLD OPTR ; SAVE LINE BUFFER POINTER
% XRA A ; (A) = 0 = STATUS
% RET
%;
%WRCH1: MVI M,0FFH ; MARK END OF LINE
% CALL LEN
% SHLD OPTR ; RESET LINE BUFFER POINTER
% MVI A,1 ; (A) = 1 = STATUS
% RET
%;
%; ----------------------------------------- WRITE
%; OUTPUT LINE ON CHANNEL (A)
%;
%WRITE: MOV B,A ; CHANNEL NUMBER
% MVI A,1 ; OPERATION CODE
% LXI H,LINE ; START OF LINE BUFFER
% SHLD OPTR ; INITIALIZE FOR NEXT LINE
% CALL IOOP
% RET
%;
%; ------------------------------------------ MWRITE
%; OUTPUT ERROR MESSAGE ON CHANNEL (A)
%;
%MWRITE: MOV B,A ; CHANNEL NUMBER
% MVI A,1 ; OPERATION CODE
% INX H ; (HL) = START OF MESSAGE
% CALL IOOP
% RET
%;
%; ----------------------------------------- STORAGE
%; STORAGE FOR I/O
%;
%IPTR: DW LINE ; INPUT POINTER
%OPTR: DW LINE ; OUTPUT POINTER
%WPTR: DW LINE ; WCH POINTER
%;
%; THE NEXT THREE ITEMS MUST APPEAR IN ORDER
%;
%MAXLEN: DB 132 ; MAX LENGTH OF LINE
%LENGTH: DB 0 ; LINE LENGTH
%LINE: DS 133 ; LINE BUFFER
%;
% DB 0,0,0,0,0,0,0,0,0,0 ; UNUSED SPACE
%;
%;