Add paracli, a parallel port comm utility
This commit is contained in:
80
paracli.s
Normal file
80
paracli.s
Normal file
@@ -0,0 +1,80 @@
|
||||
.arch i8086,jumps
|
||||
.code16
|
||||
.intel_syntax noprefix
|
||||
|
||||
.section .init
|
||||
.global _start
|
||||
_start:
|
||||
mov ax, cs
|
||||
mov ds, ax
|
||||
mov es, ax
|
||||
cli
|
||||
mov ss, ax
|
||||
mov sp, 0x100
|
||||
sti
|
||||
jmp main
|
||||
|
||||
.section .text.parcb
|
||||
parcb:
|
||||
push bx
|
||||
push si
|
||||
push bp
|
||||
mov si, ax
|
||||
1:
|
||||
test dx, dx
|
||||
jz 0f
|
||||
mov al, [si]
|
||||
mov ah, 0x0e
|
||||
mov bh, 0
|
||||
int 0x10
|
||||
dec dx
|
||||
inc si
|
||||
jmp 1b
|
||||
0:
|
||||
pop bp
|
||||
pop si
|
||||
pop bx
|
||||
ret
|
||||
|
||||
.section .rodata.l0
|
||||
.l0: .ascii "> "
|
||||
.l1: .ascii "."
|
||||
|
||||
delay = 500
|
||||
|
||||
.section .text.main
|
||||
.global main
|
||||
main:
|
||||
mov ax, 0x0002
|
||||
int 0x10
|
||||
mov ax, offset parcb
|
||||
call paracomm_init
|
||||
0:
|
||||
mov ah, 0x01
|
||||
int 0x16
|
||||
jz 1f
|
||||
mov ah, 0x00
|
||||
int 0x16
|
||||
mov ah, 0
|
||||
call paracomm_send
|
||||
test ax, ax
|
||||
jz 0b
|
||||
1:
|
||||
call paracomm_nextbyte
|
||||
mov dx, 0x3bc
|
||||
out dx, al
|
||||
add dl, 2
|
||||
mov al, 1
|
||||
out dx, al
|
||||
mov cx, delay
|
||||
2: loop 2b
|
||||
mov al, 0
|
||||
out dx, al
|
||||
mov cx, delay
|
||||
3: loop 3b
|
||||
dec dl
|
||||
in al, dx
|
||||
mov cl, 4
|
||||
shr al, cl
|
||||
call paracomm_feed
|
||||
jmp 0b
|
Reference in New Issue
Block a user