@basic by A. Fachat (fachat@galileo.rhein-neckar.de) ----------------------------------------------------------------------- @basic is covered by the GNU public License, see file COPYING 0) Preface The Programm @basic is a BASIC extension with over 40 new BASIC commands and several additional features. I have written this programm some years ago and I do not support it any more. I do also not take any warranty for this programm or its use in any form. 1) How to use To use this BASIC extension, you have to load this extension into memory as a machine programm (",8,1") and then initialize it by a reset or "SYS 64738". All Commands are now available. To restore a BASIC programm, use the new command "OLD". You loose 8kByte of BASIC memory, but $c000-$cfff stays free. 2) Commands All commands can be abbriviated as usual (deL for DELETE and so) A) Toolkit TRACE switches on Trace mode, i.e. the actual BASIC line is being printed in the first two lines of the screen. Pressing the shift Key gives continous execution, CBM Key makes single step. "TRACE OFF" switches back to normal mode. These two commands can be anywhere in the programm code. DELETE This command removes Lines from the BASIC code. Syntax as the syntax from the LIST command. AUTO Automatic linenumbering while inputting a new BASIC programm. I.e. The computer automagically prints the line number on the screen, you just type the BASIC code. An empty line stops this mode. An asterix ("*") before the line number says that this line already exists. With an empty line you can break without overwriting the existing line. With an additional Text you can even spare writing e.g. "DATA" each and every line - it gets printed and writen to the line. (e.g. "AUTO 10000,10,DATA" first prints " 10000 DATA" and waits for the input line and then prints " 10010 DATA" and so on) Standard is starting line 100, and go on with steps of 10 Syntax: AUTO [Starting_line][,[Stepping][,additional_text] OLD This command recalls a BASIC programm that has been removed with "NEW" or by a RESET. You must not define any variable after the deletion of the programm because that will overwrite the programm code. Note that a "SYNTAX ERROR" sometime is an indicator that a new variable has been defined because a command has not been recognized. DUMP This command prints out all actual variables, defined fields and functions. FIND searches the complete BASIC programm for a specific expression "FIND GET" e.g. lists all lines that contain the "GET" BASIC command. RENUMBER renumbers a BASIC programm. All GOTOs, GOSUBs and IF THENs get new numbers to point to the same location, just with the same number. You can even renumber only a part of the programm. Syntax: RENUMBER [[Starting_Line][,[Stepping][,[Start_of_area][-] [End_of_Area]]]] DLOAD/DSAVE/DVERIFY/MLOAD/MVERIFY/MSAVE New Disk Basic commands. D* works for BASIC programms that are on Disk, M* works on Machine language programms that are on Disk. Syntax: DLOAD"name"[,D0][,U8] MSAVE"name"[,D0][,U8],startaddress,endaddress MLOAD"name"[,D0][,U8][,startaddress] *VERIFY is as *LOAD; DSAVE is as DLOAD. Replace the 0 with the Disk drive on your Floppy Unit the file is on and the 8 with the Unit (IEC) address. RUN This is new, man? Yes it is: RUN"name"[,D0][,U8] loads and immediately runs a BASIC programm. CATALOG/DIRECTORY shows the directory of the specified drive. CATALOG[#4][,]["mask"][,D0][,U8] replace the 4 with the printer (IEC) device you want to print the directory on. SCRATCH removes file(s) from disk COLLECT chkdsk HEADER formats floppy COPY copies files on Disk, not via the computer. Works best on dual drive floppies. BACKUP Copies whole disks on dual drive floppies. RENAME renames files. common syntax: COMMAND ["name1"][,][D0] [TO ["name2"][,][D1]] [,U8] DISK a) sends a command to a disk drive: DISK"command"[,U8] b) sets default device (the one that is used without a ",Ux"): DISK dev (e.g. "DISK 9") DS/DS$ These two variables represent the status of the disk. DS is the numerical code (=0) DS$ is the error string (=00, ok,00,00) APPEND/MERGE APPEND appends a BASIC programm to the one in memory. MERGE merges the new programm into the old one, using line numbers. I.e. if the programm in memory has line numbers above 1000 and the one on disk numbers below, we end up with the "MERGE"'d programm in front of the old one. Syntax is as DLOAD. LIST/ENTER 'LIST #4 [,[a][-][e]]' lists the programm directly to the printer. 'LIST "name"[,D0][,U8] [,[a][-][e]]' lists the programm directly into a file on Disk. 'ENTER "name"[,D0][,U8]' loads this ASCII file back into memory and puts the lines in the right place. It even executes commands from the file (ever heard about stdin redirection?) For those running "SPEEDDOS", you have to switch of the display of the memory location the programm is loaded to before the first MLOAD/DLOAD/LOAD in any 'enter' file by doing "POKE $0298,3" You can easily create an executable enter file by: OPEN 1,8,1,"enterfile" PRINT#1,"MLOAD"chr$(34)"load me"chr$(34)",$c000" PRINT#1,"MLOAD"chr$(34)"@mon 1.1/7"chr$(34) PRINT#1,"HIMEM$7000" CLOSE1 KEY is the key to the function keys ;-) KEY shows the current function key mapping, KEY 1,"DUMP" puts the string "DUMP" on F-key 1 The apostroph (') is converted into (") and the left arrow becomes a carriage return. KEY OFF switches the key mapping off, KEY ON switches back on. COLOUR COLOUR [Border_colour][,[Background_colour][,Cursor colour]] sets the colours. SET TIME / SET ALARM These commands handle the builtin "Time of Day" clock. SET TIME "1213145" sets the TOD to 12 o'clock, 13 minutes, 14 seconds and 5 tenths of a second. SET ALARM has the same syntax. ALARM OFF switches the ALARM clock off, ALARM ON back again. When the alarm goes off, the computer stops and makes an awful noise ;-) (RUN/STOP gives it a break ;-) The variable TIME gives the actual TOD in the same 5 digit format. HELP lists all new commands and functions. BASIC/RESET/EXIT BASIC exits @basic and goes back to CBM BASIC, but keeps the memory for @basic allocated. a run/stop-restore brings you back. RESET reinitializes @basic and EXIT exits @basic fully and goes back to CBM Basic SCREEN switches the actual screen with a buffered one, i.e. the now actual one gets buffered and the bufferes one is displayed. At the first time the screen is filled with nonsense, you have to clear it (otherwise the computer may even crash). But the buffered screen is kept over a reset. B) The Screen editor The screen editor is a bit improved. You have some additional keys available: CTRL-L clear the rest of the line from the cursor postition. CTRL-A put the cursor behind the last character of the actual line. CTRL-U go to the lower left edge of the screen CTRL-Z insert mode CTRL-D Delete the character underneath the cursor and move the rest of the line one character to the left. You can map these keys to other codes (e.g. SPEEDDOS users may map CTRL-U to CTRL-Home ($82) and CTRL-L to CTRL-Del ($84)). People who burn their own kernel EPROM, you can fill unused entries in the CTRL-keymap at $ec78 with unused codes (e.g. $80-$84) and map e.g. CTRL-CrsrRight to $80 to 'Put cursor to the end of the line' (former CTRL-A) List-Scroll If you move the cursor 'out of the screen' at the top or the bottom of of the screen, the screen scrolls up and down and a BASIC listing is being continued, i.e. the right lines are being printed on the top or the bottom of the screen. C) Arithmetic Each value can now be expressed in decimal as usual, in hexadecimal with a preceeding "$" and in binary format with a preceeding "%". Both have a maximal length of 16 Bit, i.e. 16 binary digits or 4 hex digits. HEX$/BIN$ build a hex/binary string out of an integer. try 'PRINT HEX$(123),BIN$(245)' DEEK/DOKE Same as PEEK/POKE, just for two byte values. low byte goes in the lower address, the high byte into the higher byte. LORAM/HIRAM These commands set the start of BASIC RAM and end of BASIC RAM pointer to new values. The LORAM command makes a new. The HIRAM command makes a CLR; if a BASIC programm would be destroyed, you get an "OUT OF MEMORY ERROR". Syntax: HIMEM $7000 LORAM $1000 D) Monitor In @basic a small Hex Monitor is included. You have the following commands: .m adr1 [adr2] Memory dump .t start1 end1 start2 Transfer mem1 to mem2 .c start1 end1 start2 compare memory .o start end byte occupies memory with byte .f start end "text" find "text" in memory .f start end byte [byte2 [...]] find bytes in memory .g adr go to memory address (SYS) To change memory locations, overwrite the hex numbers in the hex dump. Of course the monitor is in the list scroll function as well. E) Other stuff If the interpreter finds a "!" to execute, it jumps to $c006. So you can easily include some own extensions. @basic has three special bytes: $9ffd: default disk unit (in EPROM version at $02a9) $9ffe: internal flag (in EPROM version at $02a7) bit 7=1: List only till colon (for function dump) bit 2=1: suppress screen control character. print invers character instead (LIST, DUMP, MON, KEY) $9fff: externel flag (in EPROM version at $02a8) bit 7=1: Alarm on bit 6=1: Trace on bit 5=1: Key on bit 4=1: editor on bit 3=1: don't tokenize input bit 1=1: put only normal (CBM) Tokens into a new BASIC line (e.g. my Assembler doesn't know about new tokens!) If you press CTRL during reset or @basic initialization, the command 'ENTER"@r*"' is being executed. So you can put an appropriately named enter file on each working disk that automagically installs all your needed programms. Memory Map: Zero Page $fb-$ff as well as already used ones. Memory $8000-$9fff programm code. contains function keys and disk buffer in the RAM version. $a001-$a813 the buffered screen. in EPROM version the help screen, the function keys etc are under the modul in the RAM between $8000 and $9fff BTW I have never tested if the EPROM version works ;-) System jump vectors: $0314 IRQ $0316 BRK $0324 INPUT $0326 OUTPUT Reset and NMI are caught by the 'CBM80' mark and the appropriate vectors at the beginning of the Module. BASIC vectors: $0300-$030b, whereas the vector at $0306 is not needed as I have an own new routine for the LIST command.