\ VIDEO2.SEQ Actual video output routine By Tom Zimmer FILES DEFINITIONS VARIABLE VIDEO2.SEQ FORTH DEFINITIONS VARIABLE NOSETCUR DECIMAL CODE VIDEO-TYPE ( string length -- ) MOV AX, #LINE MOV DX, #OUT POP BX cmp bx, # 0 \ if length = 0 then exit <= if pop bx next then PUSH BX \ Put length and #OUT on stack PUSH DX cmp ax, # 24 \ Clip #LINE to 25 lines u>= if mov ax, # 24 then mov #line ax PUSH AX ADD DX, BX \ Set length + X position to DL cmp dx, # 80 \ Clip #OUT to 80 characters u>= if mov dx, # 80 then mov #out dx cmp nosetcur # 0 \ Do we want to spend time setting 0= if \ the cursor position? MOV DH, AL \ Move Y to DH XOR BX, BX \ Clear BX MOV AH, # 2 INT 16 \ Move cursor to end of typed string then MOV AX, # 160 \ calculate actual cursor position POP BX MUL BX MOV DI, AX POP AX SHL AX, # 1 ADD DI, AX POP CX POP BX XCHG SI, BX \ SI is the source PUSH BX \ Save SI for later restoral PUSH ES \ save ES MOV AH, ATTRIB \ display attributes MOV ES, VIDEO-SEG \ destination segment cmp cx, # 80 >= if \ Clip line to 80 characters mov cx, # 80 then mov dx, # 80 sub dx, cx xchg dx, cx shl cx, # 1 add cx, # here 10 + \ Add base addr of array MOV DS, TYPESEG \ source segment jmp cx \ JUMP to the right instruction \ we are blowing out the loop here for speed, it only cost 160 bytes. LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW LODSB STOSW POP ES \ restore ES POP SI \ Restore IP MOV BX, CS MOV DS, BX \ restore DS NEXT END-CODE DECIMAL