Author Topic: sending odd bytes to a function that wont accept odd bytes  (Read 10757 times)

Offline mik3ca

  • Jr. Member
  • *
  • Posts: 30
sending odd bytes to a function that wont accept odd bytes
« on: February 27, 2021, 11:13:56 PM »
I made a code fragment which can work great when transferring data between local (conventional) memory and extended (XMS) memory, but there's one issue. As per documentation found near the bottom of http://www.ctyme.com/intr/rb-4768.htm, the expected value for size of data to move needs to be an even number of characters.

What my code does is this: before sending the data to ram, it fills in the local offset, remote offset, and size so the data at DS:SI that the XMS function expects is complete.

I'm just trying to figure out the efficient way to process the request if only one byte of data needed to be sent between conventional memory and extended memory or even if an odd number of bytes needed to be sent.

Code: [Select]
Xput: ;stores data to XMS
mov SI,XMSto
mov [cs:xmstsoff],BX ;xmstsoff+2 = local segment already stored
mov [cs:xmstdoff],EDX
mov [cs:xmstl],ECX
jmp Xcopy
Xget: ;grabs data from XMS
mov SI,XMSfr
mov [cs:xmsfdoff],BX ;xmstsoff+2 = local segment already stored
mov [cs:xmsfsoff],EDX
mov [cs:xmsfl],ECX
Xcopy:
  mov AX,CS
  mov DS,AX
  mov AX,0B00h
  xor BX,BX
  call xmsf
  cmp AX,0001h
  jne xfcp
     xor BX,BX
     ret
  xfcp:
  stc
ret

;note: the handle fields are filled in right after XMS memory is allocated and those values
;are the same throughout the duration of the entire program.

XMSto:
xmstl dd 0
xmstsh dw 0
xmstsoff dd 0
xmstdh dw 0
xmstdoff dd 0

XMSfr:
xmsfl dd 0
xmsfsh dw 0
xmsfsoff dd 0
xmsfdh dw 0
xmsfdoff dd 0