Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The most impressive thing to me was the inbuilt BBC Basic, and the availability of every system function to basic with SWI calls.

This contrasts with languages like GW Basic or even commercial QuickBasic (QBX) or Visual Basic: second class citizens when it came to accessing system calls under Windows (or dos).

In fact, I wrote simple basic code to access the undocumented random number generator within the BCM2835 chip - it worked perfectly under RiscOS and even a dedicated BBC Basic emulutor for the Pico.

This is what the code looks like for those that are interested:

REM MAP MEMORY

SYS "OS_Memory",13,&20104000,32 TO ,,,RNG_CTRL%

SYS "OS_Memory",13,&20104004,32 TO ,,,RNG_STATUS%

SYS "OS_Memory",13,&20104008,32 TO ,,,RNG_DATA%

SYS "OS_Memory",13,&2010400C,32 TO ,,,RNG_FF_THRES%

SYS "OS_Memory",13,&20104010,32 TO ,,,RNG_INT_MASK%

REM CHECK WHERE THE REGISTERS ARE MAPPED

PRINT “RNG_CTRL MAPPED AT &”;STR$~(RNG_CTRL%)

PRINT “RNG_STATUS MAPPED AT &”;STR$~(RNG_STATUS%)

PRINT “RNG_DATA MAPPED AT &”;STR$~(RNG_DATA%)

PRINT “RNG_FF_THRES MAPPED AT &”;STR$~(RNG_FF_THRES%)

PRINT “RNG_INT_MASK MAPPED AT &”;STR$~(RNG_INT_MASK%)

REM THESE INTS BECOME REGISTERS R0-R7 RESPECTIVELY

A%=1

B%=RNG_DATA%

C%=RNG_INT_MASK%

D%=RNG_STATUS%

E%=RNG_CTRL%

F%=&1

G%=&4000000

REM GET A RANDOM NUMBER FROM THE RNG

DIM RNG% 30

P% = RNG%

[ OPT 1

SWI “OS_EnterOS”

LDR R0,[R1]

SWI “OS_LeaveOS”

MOV PC,R14

ALIGN

]

REM INIT THE RNG

DIM INIT% 30

P% = INIT%

[ OPT 1

SWI “OS_EnterOS”

STR R5,[R4]

STR R6,[R3]

SWI “OS_LeaveOS”

MOV PC,R14

ALIGN

]

REM LETS INIT…

CALL INIT%

A%=0

X%=0

FIRST%=0

REM KEEP READING RANDOM NUMBERS UNTIL THEY ACTUALLY BECOME RANDOM

REPEAT

  X%=A%

  A% = USR (RNG%)

  PRINT “WARMING UP &”;STR$~(A%)

  IF FIRST%<50 THEN X%=A%:FIRST%=FIRST%+1
UNTIL X%<>A%

REM DISPLAY RANDOM NUMBERS (RETURNED FROM R0)

REPEAT

  A%=USR (RNG%)

  PRINT “&”;STR$~(A%);" ";
UNTIL 1=0


This was fixed around Visual Basic 5, when it got AOT compilation with VC++ backend, OCX tooling in VB, it got a sweet spot in VB 6. Naturally this was kind of triggered by Delphi's competition, and then .NET came around.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: