Refactor parallel comms a bit

This commit is contained in:
2025-10-01 23:24:59 +02:00
parent 3df5b28e4e
commit 2ba1546dec
8 changed files with 116 additions and 87 deletions

View File

@@ -16,13 +16,14 @@ _start:
.section .bss
kBufSize = 77
kParaDelay = 500
kDividerRow = 23
kRecvBufSize = 128
curpos: .word 0
inputsize: .byte 0
escaped: .byte 0
inputbuf: .zero kBufSize
recvbuf: .zero kRecvBufSize
# XXX: funky call
# inputs:
@@ -109,15 +110,6 @@ addtext:
pop di
ret
.section .text.paracb
paracb:
push si
mov si, ax
mov cl, dl
call addtext
pop si
ret
.section .text.sendbuffer
sendbuffer:
push bp
@@ -167,22 +159,17 @@ drawchar:
.section .text.parasend
parasend:
1:
test cl, cl
jz 0f
mov al, [si]
mov ah, 0x06 # send parallel
push cx
call paracomm_send
pop cx
test al, al
jnz 2f
inc si
dec cl
jmp 1b
0:
mov al, '\n'
call paracomm_send
2:
push si
int 0x80
mov cx, 1
push cx
mov cx, offset .l1 + 1
push cx
mov ah, 0x06 # send parallel
int 0x80
add sp, 8
ret
prompt:
@@ -212,8 +199,6 @@ main:
movb escaped, 0
mov ax, 0x0002
int 0x10
mov ax, offset paracb
call paracomm_init
mov si, offset .l2
mov cl, l2len
call addtext
@@ -259,21 +244,18 @@ main:
4:
call sendbuffer # send input buffer
1:
call paracomm_nextbyte
mov dx, 0x3bc
out dx, al
add dl, 2
mov al, 1
out dx, al
mov cx, kParaDelay
2: loop 2b
mov al, 0
out dx, al
mov cx, kParaDelay
3: loop 3b
dec dl
in al, dx
mov cl, 4
shr al, cl
call paracomm_feed
mov ah, 0x07 # do parallel comms
int 0x80
mov ax, kRecvBufSize
push ax
mov ax, offset recvbuf
push ax
mov ah, 0x05 # recv
int 0x80
test al, al
mov cl, al
pop si
pop bx
jz 0b
call addtext
jmp 0b