17.07.2013 Views

GWBASIC User's Manual

GWBASIC User's Manual

GWBASIC User's Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

GW-BASIC <strong>User's</strong> Guide<br />

MOV CL, [BX] ; Gets length of B$ in CL.<br />

MOV DX, 1[BX] ; Gets address of B$ text in DX.<br />

.<br />

.<br />

.<br />

MOV SI, 10[BP] ; Gets address of A in SI.<br />

MOV DI, 6[BP] ; Gets pointer to C in DI.<br />

MOVSW ; Stores variable A in C.<br />

RET 6 ; Restores stack and returns.<br />

MOVSW copies only two bytes. This is sufficient if variables A and C are integer. Four bytes must<br />

be copied if they are single precision; eight bytes, if they are double precision.<br />

Example 3:<br />

100 DEF SEG=&H2000<br />

110 ACC=&H7FA<br />

120 CALL ACC(A, B$, C)<br />

.<br />

.<br />

.<br />

Line 100 sets the segment to hex 2000. The value of variable ACC is added into the address as<br />

the low word after the DEF SEG value is shifted four bits to the left (this is a function of the<br />

microprocessor, not of GW-BASIC). Here, ACC is set to &H7FA, so that the call to ACC<br />

executes the subroutine at the location hex 2000:7FA (absolute address hex 207FA).<br />

file:///C|/Documents%20and%20Settings/Lorenzo/Desktop/GW%20Basic/CALL.html (3 of 3)28/03/2004 21.29.13

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!