hoglet67 / PiTubeDirect

Bare-metal Raspberry Pi project that attaches to the Acorn TUBE interface and emulates many BBC Micro Co Processors
GNU General Public License v3.0
187 stars 23 forks source link

Native ARM Co Pro: Implement additional APIs #33

Open hoglet67 opened 7 years ago

hoglet67 commented 7 years ago

Not all the APIs that BBC Basic uses are currently implemented.

(Updated 7/9/2021)

There are implemented:

(Operating System)
00      WRITEC
01      WRITES
02      WRITE0
03      NEWLINE
04      READC
05      CLI
06      BYTE
07      WORD
08      FILE
09      ARGS
0A      BGET
0B      BPUT
0C      MULTIPLE (aka GBPB)
0D      OPEN (aka FIND)
0E      READLINE
10      GETENV
11      EXIT
16      ENTERSWI (aka EnterOS but check usage)
1C      MOUSE
2B      GENERATEERROR
31      READVDUVARIABLES                                used in A=VDU(x)
32      READPOINT                                       used in A=POINT(x,y)
39      SWINUMBERFROMSTRING                             used in SYS and assembler
20040   XOSCHANGEENV
20045   XOSPLOT
46      WRITEN
65      SCREENMODE
2006E   XOSSYNCHRONISECODEAREAS
100     WRITEI

(Operating System Modules)
40743   COLOURTRANSSETGCOL
40761   COLOURTRANSSETTEXTCOLOUR
62C81   BASICTrans_Error
62C80   BASICTrans_HELP
62C82   BASICTrans_Message

These are not implemented:

(Operating System)
2001E   XOS_Module                                      used in modHead.s
23      READVARVAL                                      used to read BASIC$crunch)
61      SETCOLOUR                                       used in COLOUR OF <colour num> ON <colour num>
DC      OS_ConvertInteger4                              used in module MOVEMEMORY

(Operating System Modules)
40140   SOUNDCONFIGURE
40141   SOUNDENABLE
401C6   SOUNDEVENTQBEAT
401C1   SOUNDEVENTQSCHEDULE
401C5   SOUNDEVENTTEMPO
40142   SOUNDSTEREO
4018A   SOUNDVOICE
4305F   Territory_ReadCalendarInformation
400EC   WIMPSLOT

A stretch goal might be to reach parity with Sprow's ARM7TDMI Co Pro: http://www.sprow.co.uk/bbc/hardware/armcopro/armtubeoscalls.pdf

For GCOL syntax, see here

jgharston commented 7 years ago

2001E XOS_Module Used by the BASIC command to RMRun itself, the ARM equivalent of FX142,n

31 READVDUVARIABLES used in A=VDU(x) 61 SETCOLOUR 65 SCREENMODE Simple enough to implement. READVDUVARIABLES(n)=OSBYTE(160,n) SETCOLOUR(n):VDU 17,n or VDU 18,k,n as appropriate. The read functions can be implemented with the algorithm worked out at http://beebwiki.mdfs.net/Reading_current_colours

SCREENMODE: I think this is only used with MODE "string". MODE number does VDU 22,number, so returning a SWI not known error would probably be most appropriate.

40140+x SOUND_* Not really sure how we could implement these, as the BBC doesn't have the hardware required. These are only called with SOUND with five parameters, SOUND with four parameters calls the standard OSWORD 7 SOUND call.

DC OS_ConvertInteger4 used in module MOVEMEMORY Called if BASIC's memory is moved. Not needed until we implement a multi-tasking task manager :)