Q . Write a subroutine in C which toggles the cursor?
Write a subroutine in C which toggles the cursor. It takes one argument which toggles the value between on (1) and off (0) using simplified directives:
PUBLIC CURSW
.MODEL small, C
.CODE
CURSW PROC switch: word
MOV AX, SWITCH ; get flag value
XOR AX, AX ; test zero / nonzero
:
:
// routine to test the switch and accordingly
switch off or switch on the cursor //
:
:
CURSW ENDP
END
In a similar manner variables can be passed in C as pointers also. Values can be returned to C either by altering the variable values in C data segment or by returning the value in registers as given previously.