mail@pastecode.io avatar
a year ago
1.8 kB

mov ah,3dh        ;open file
	mov al,02h        ;read/write
	lea dx,file2
	int 21h
	mov handle,ax

	mov ah,42h			; move pointer
	mov al,00h			; relative to start
	mov cx,00			;CX:DX bytes to move
	mov bx,handle	
	mov dx,00
	int 21h

	mov ah,3fh				;read file
	mov bx,handle
	mov cx,100
	lea dx,data1
	int 21h
	mov cnt,ax

	mov ah,40h		;write file
	mov bx,handle
	mov cx,cnt
	lea dx,data1
	int 21h

	mov ah,3eh  ; close file
	mov bx,handle
	int 21h


mov ah,0fh ; get mode
int 10h
mov orgi,al

mov ah,0 ; set mode
mov al,03h
int 10h

mov ah,02h ; move cursor
mov dh,0		;row
mov dl,0		;column
mov bh,0
int 10h

mov ah,09h ; write
mov al,' '
mov bh,0
mov bl,00011010b
mov cx,26*80
int 10h

x1: mov ah,07h		;block
    int 21h
    cmp al,'#'
    jnz x1
mov ah,0
mov al,orgi
int 10h

output block of mxn

      mov     dx,strow

x2:     mov     cx,stcol

x1:     mov     al,att
        mov     ah,0ch
        int     10h

        inc     cx
        cmp     cx,enc
        jnz     x1

        inc     dx
        cmp     dx,enr
        jnz     x2

x3:     mov     ah,07h
        int     21h
        cmp     al,'e'
        jnz     x3
		mov     al,orgn
        mov     ah,0
        int     10h

Keyboard I/O:

mov ah,01h  ; inp w echo, value in al
int 21h

mov ah,08h  ; inp without echo, value in al
int 21h

input string:

max1    db          32                      
act1    db         ?  ;key count incl enter
inp1    db         32 dup('$')          ; Reserve 32 locations
LEA        DX,max1
MOV    	   AH, 0Ah
INT     21h

MOV     DL, ‘A’ ; output character
MOV     AH, 02h
INT        21h

 lea      dx, str1  ;output string
 mov      ah, 09h
 int         21h