The example is an assembler procedure contained in a basic function in an SLL module. It is done this way for a reason, a single call to the enclosing basic function gets the address of the assembler procedure and returns it to the caller. At the caller end, the address is saved into a name which is used to call the assembler procedure. As PB does not directly support calling a bare assembler procedure, a set of macros are provided that make calling the procedure easy to use.
The example is a bit clunky in that setting up an array would not normally be the way it would be used, You would have some form of streaming set up where the data to append is being sourced at high speed.
The example is a bit clunky in that setting up an array would not normally be the way it would be used, You would have some form of streaming set up where the data to append is being sourced at high speed.
Code:
' ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ #compile exe "FpSLL.exe" #compiler PBCC #include "asmcall.inc" #link "szappend.sll" GLOBAL szappend as DWORD ' name for the asm procedure in the SLL ' ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ FUNCTION PBmain as LONG LOCAL buffer as STRINGZ * 1024 LOCAL ptrbuf as DWORD ' output buffer pointer LOCAL text as STRINGZ * 128 LOCAL ptext as DWORD ' pointer to input text buffer LOCAL cloc as DWORD ' current location offset LOCAL acnt as DWORD ' array loop counter szappend = pszappend ' attach the name to the SLL procedure address DIM tArr(10) as STRINGZ * 16 ' dimension a test array tArr(0) = "Text 1 "+$CRLF ' load the array tArr(1) = "Text 2 "+$CRLF tArr(2) = "Text 3 "+$CRLF tArr(3) = "Text 4 "+$CRLF tArr(4) = "Text 5 "+$CRLF tArr(5) = "Text 6 "+$CRLF tArr(6) = "Text 7 "+$CRLF tArr(7) = "Text 8 "+$CRLF tArr(8) = "Text 9 "+$CRLF tArr(9) = "Text 10 "+$CRLF cloc = 0 ' set location offset to zero ptrbuf = VarPtr(buffer) ptext = VarPtr(text) ' only needs to be done once - reuse text buffer acnt = 0 Do text = tArr(acnt) ' assign to single buffer asm3(szappend,ptrbuf,ptext,cloc) ! mov cloc, eax ' update the current location offset ! add acnt, 1 Loop while acnt < 10 StdOut buffer erase tArr() waitkey$ End FUNCTION ' ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤