Enhanced BASIC, extending CALL
CALL <address> calls a machine code routine at location address. While this in itself is useful it can be extended by adding parameters to the CALL and parsing them from within the routine.
This technique can also be used to pass extra parameters to the USR() function.
B>How to.
First you need to define the parameters for your CALL. This example is for an imaginary bitmapped graphic device.
CALL PLOT,x,y | Set the pixel at x,y | |
PLOT | routine address | |
x | x axis value, range 0 to 255 | |
y | y axis value, range 0 to 64 |
This will then be the form that the call will always take.
Now you need to write the code.
.include BASIC.DIS ; include the BASIC labels file. this allows you ; easy access to the internal routines you need ; to parse the command stream and access some of ; the internals of BASIC. It is usually output ; by the assembler as part of the listing or as a ; separate, optional, file. ; for now we'll put this in the spare RAM at $F400 *= $F400 PLOT JSR LAB_SCGB ; scan for "," and get byte STX PLOT_XBYT ; save plot x JSR LAB_SCGB ; scan for "," and get byte CPX #$40 ; compare with max+1 BCS PLOT_FCER ; if 64d or greater do function call error STX PLOT_YBYT ; save plot y ; now would be your code to perform the plot command ;. ;. ;. ;. ;. RTS ; return to BASIC ; does BASIC function call error PLOT_FCER JMP LAB_FCER ; do function call error, then warm start ; now we just need the variable storage PLOT_XBYT .byte $00 ; set default PLOT_YBYT .byte $00 ; set default END
Finally you need to set the value of PLOT in your BASIC program and use that to callit.
E.g.
. 10 PLOT = $F400 . . 145 CALL PLOT,25,14 : REM set pixel .
See also:
RSC-Forth
This page is about the operation and use of the Rockwell Single-Chip RSC-FORTH system as implemented in the Rockwell R65...
This page is about the operation and use of the Rockwell Single-Chip RSC-FORTH system as implemented in the Rockwell R65...
RSC-Forth R56F11 R6501Q
Rockwell made many 6502 variants. Some were 'SOCs', complete computers in an IC. and Rockwell was strong in Forth, e.g....
Rockwell made many 6502 variants. Some were 'SOCs', complete computers in an IC. and Rockwell was strong in Forth, e.g....
R6501Q kit
I have two R6501 IC's. One came with the Glitchworks GW-R65X1QSBC-1 kit, a R6501Q. The other from ebay, a R6501AQ (A for...
I have two R6501 IC's. One came with the Glitchworks GW-R65X1QSBC-1 kit, a R6501Q. The other from ebay, a R6501AQ (A for...
R65F11 Forth computer
I have recently acquired a R65F11 IC. This IC is part of the RSC (Rockwell Single Computer) Forth system. Rockwell Sin...
I have recently acquired a R65F11 IC. This IC is part of the RSC (Rockwell Single Computer) Forth system. Rockwell Sin...