IAP calls in BASIC

Questions about the BASICtools and MakeItC
Post Reply
basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

IAP calls in BASIC

Post by basicchip »

IAP calls or In Application Programming, gives access to a number of ROM routines to write flash, enable low power modes, get device IDs and other operations. With the inline Assembly capability of BASIC, it is easy to make these calls.

For the LPC1768 we needed access to getting the device ID, in order to use that unique number to generate a MAC address number for an Ethernet connection. Here is an example to excercise that operation.

Code: Select all

#include "ASMinlineBASIC.bas"

dim COMMAND(4)
dim RESULT(4)

main:

COMMAND(0)= 58

x = addressof COMMAND
ASM_MOV(r0,r7)

x = addressof RESULT
ASM_MOV(r1,r7)

CALL (&H1FFF1FF1)
for x=0 to 4
    print hex(RESULT(x))
next



Post Reply