NASM Forum > Example Code

sending odd bytes to a function that wont accept odd bytes


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, 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: ---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
  mov AX,CS
  mov DS,AX
  mov AX,0B00h
  xor BX,BX
  call xmsf
  cmp AX,0001h
  jne xfcp
     xor BX,BX

;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.

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

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

--- End code ---


[0] Message Index

Go to full version