User Tools

Site Tools


calling_20internal_20routines_20from_20assembler_20code

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
calling_20internal_20routines_20from_20assembler_20code [2018/03/31 13:19] – external edit 127.0.0.1calling_20internal_20routines_20from_20assembler_20code [2024/01/05 00:22] (current) – external edit 127.0.0.1
Line 1: Line 1:
 =====Calling internal routines from assembler code===== =====Calling internal routines from assembler code=====
  
-//by Richard Russell, January 2016//\\ \\  A small selection of subroutines, internal to the BB4W interpreter, is exposed to the assembly language programmer so that they may be called from his own assembler code. These are grouped into two sets; the most commonly needed subroutines are callable by **name** and the less commonly needed ones by a **jump table**. The first set is as follows (documented also in the main BB4W Help manual):\\ \\ +//by Richard Russell, January 2016//\\ \\  A small selection of subroutines, internal to the BASIC interpreter, is exposed to the assembly language programmer so that they may be called from his own assembler code. These are grouped into two sets; the most commonly needed subroutines are callable by **name** and the less commonly needed ones by a **jump table**. The first set is as follows (documented also in the main Help manual):\\ 
   CALL "osbget" ; Read byte from file to AL, EBX contains channel number   CALL "osbget" ; Read byte from file to AL, EBX contains channel number
   CALL "osbput" ; Write byte from AL to file, EBX contains channel number   CALL "osbput" ; Write byte from AL to file, EBX contains channel number
Line 22: Line 22:
   CALL "csenter"; Enter critical section (@memhdc% settings may change)   CALL "csenter"; Enter critical section (@memhdc% settings may change)
   CALL "csleave"; Leave critical section (@memhdc% may not be changed)   CALL "csleave"; Leave critical section (@memhdc% may not be changed)
-\\  The second set is as follows (//BBC BASIC for Windows// v6.00a or later only):\\ \\ + 
 +The second set is as follows (//BBC BASIC for Windows// v6.00a or later and //BBC BASIC for SDL 2.0// only): 
   CALL @fn%(0)  ; Load numeric (al=type, ebp=varptr, returns ebx,ecx,edx)   CALL @fn%(0)  ; Load numeric (al=type, ebp=varptr, returns ebx,ecx,edx)
   CALL @fn%(1)  ; Load string (al=type, ebp=varptr, returns len=ecx, addr=edx)   CALL @fn%(1)  ; Load string (al=type, ebp=varptr, returns len=ecx, addr=edx)
Line 41: Line 43:
   CALL @fn%(16) ; EXP() function; calculate e raised to the power of (bx,ecx,edx)   CALL @fn%(16) ; EXP() function; calculate e raised to the power of (bx,ecx,edx)
   JMP  @fn%(17) ; Return to BASIC (jmp rather than call), esi addresses statement   JMP  @fn%(17) ; Return to BASIC (jmp rather than call), esi addresses statement
-  CALL @fn%(18) ; Queue event (as in SYS @fn%(18), msg%, wparam%, lparam%)+  SYS  @fn%(18) ; Queue an eventSYS @fn%(18), handler%, msg%, wparam%, lparam% 
 +   
 +Extensions in //BBC BASIC for SDL 2.0// only: 
 + 
 +  SYS @fn%(19 ; Return a pointer to the current bitmap font: SYS @fn%(19) TO font%% 
 +  SYS @fn%(20)  ; Set the pointer to the current bitmap font: SYS @fn%(20), font%% 
 +  SYS @fn%(21)  ; Redefine a character: SYS @fn%(21), @memhdc%, char%, addr%%, w%, h% 
calling_20internal_20routines_20from_20assembler_20code.1522502347.txt.gz · Last modified: 2024/01/05 00:16 (external edit)