By Derek Walker

Originally published in EUG #17

I have never considered myself a programmer, simply because I very seldom write programs. I generally modify other peoples' to suit my needs such as the Data Link program (EDL) and Ground Controls' UVIPROM EPROM programmer. The last couple of programs, ERLOAD and ERSAVE which appeared in EUG #14 were my first serious attempts at programming. As there's been no adverse feedback from readers, I take it the utilities were both successful and bug free.

I would now like to present another utility, a *ROMS command which will list the ROMs in your machine. To use the program, select it from the Utilities Menu B or type CHAIN"U.DWROMS". This will do three things:

  1. Assemble the program
  2. RUN the program
  3. SAVE a file to your disc called DROMS

The best thing to do now is to *COPY both U.DWROMS and DROMS to another disk. You may find it useful to rename the latter compiled file ROMS. If not, use the command *DROMS at the prompt.

When the program is complete, you should have on your screen a list of all ROMs and RAM in your computer. It will look similar to this but with entries for your specific computer:

>*ROMS (or *DROMS)
0) < S > CLICK 
1) < S > CLICK 
2) < S > DFS V2.00 
3) < SL> ViewSpell 
4) < SL> View 
5) <R  > 
6) < S > UVIPROM V1E1 
7) <R  > 
8) <   > 
9) <   > 
A) < S > Stop Press 64 v1.01 
B) <  L> BASIC 
C) < S > Plus 1 Expansion 
D) < SL> Mode 7 Sim v1.4 
E) < SL> AFM v1.09 
F) < S > ADFS V1.00 
R indicates a RAM device is present
S indicates the ROM has a Service entry point
L indicates the ROM has a Language entry point

Whenever you wish to know what's in your machine just type *ROMS. ADFS users can also put the file into their LIBRARY on the Welcome Disc for easy access. However, because the Electron handles its ROMs slightly differently than the BBC and Master 128 computers, the file created by the program on the Electron will not wrok on the BBC/Master and vice versa. If you wish to use the command on both machines, just CHAIN the file "U.DWROMS" on each machine in turn then *RENAME the created file to something memorable for that machine.

   10REM *ROMS by D. Walker (c) Oct.1994  
   20REM Compatible with E/B/B+/M/C  
   30A=INKEY(-256)                                    \ decides computer
   40IF A=1 THEN computer=&FE05 ELSE computer=&FE30      \ program is on 
   50PROCass                                          \ assemble program
   60CALL&900                                   \ test assembled program 
   70*SAVE DROMS 900 A2B                    \ save the assembled program 
  110P%=&900                  \ assemble for use at this memory location 
  130LDA&F4:STA&8D                                \ save the current ROM 
  140LDA#&0C:STA&F4:STAcomputer    \ patch for the Electron # see note 1 
  150LDY#00:LDX#00                 \ initialise registers   # see note 2 
  160LDA#&30:STA&8F               \ store ascii value for 0 # see note 3 
  170JSR&FFE7                             \ new line at start of command 
  190STY&F4:STYcomputer                         \ set up ROM for reading 
  200INY                                           \ increment ROM count 
  210CPY#17                           \ check if they have all been read 
  230JSR&FFE7                               \ new line at end of command 
  260LDA&8000:STA&8E                              \ 
  270LDA#&FF:STA&8000                             \ 
  280LDA&8000:CMP#&FF                             \ 
  290BNErom                                       \ RAM test 
  300LDA#&00:STA&8000                             \ test for &FF and &00
  310LDA&8000:CMP#&00                             \ 
  320BNErom                                       \ 
  330LDA&8E:STA&8000:JMPram                       \ 
  350JSRromnumber                   \ jump to print ROM number on screen
  360LDA#&3C:JSR&FFEE                                        \ print "<" 
  370LDA#&20:JSR&FFEE                                        \ print " " 
  380JMPtype                                              \ to type test 
  400JSRromnumber                   \ jump to print ROM number on screen 
  410LDA#&3C:JSR&FFEE                                        \ print "<" 
  420LDA#&52:JSR&FFEE                                        \ print "R" 
  430JMPtype                                              \ to type test 
  450LDA&8006                                           \ read type byte 
  460CMP#&C2:BEQlangserv                                \  
  470CMP#&C0:BEQlangserv                                \  look up table 
  480CMP#&82:BEQservice                                 \
  490CMP#&60:BEQlang                                    \
  5000LDA#&20:JSR&FFEE:JSR&FFEE:LDA#&3E:JSR&FFEE \ empty ROM print "  >"
  510JSR&FFE7                                  \ new line for next entry 
  520BNEcount                                      \ look for next entry 
  540LDA#&53:JSR&FFEE                                        \ print "S" 
  550LDA#&4C:JSR&FFEE                                        \ print "L" 
  560LDA#&3E:JSR&FFEE:LDA#&20:JSR&FFEE                      \ print "> " 
  590LDA#&20:JSR&FFEE                                        \ print " " 
  600LDA#&4C:JSR&FFEE                                        \ print "L" 
  610LDA#&3E:JSR&FFEE:LDA#&20:JSR&FFEE                      \ print "> " 
  640LDA#&53:JSR&FFEE                                        \ print "S" 
  650LDA#&20:JSR&FFEE                                        \ print " " 
  660LDA#&3E:JSR&FFEE:LDA#&20:JSR&FFEE                      \ print "> " 
  690LDA#&20:JMPtest1                                     \ insert space 
  710LDA#&00:JMPtest2                                      \ insert null 
  730LDA#&00:JMPtest3                                      \ insert null 
  750LDA &8009,X                  \ load first and successive characters 
  770CMP#&00:BEQgap                               \ if null insert space 
  790CMP#&0D:BEQignorecr                             \ if CR insert null 
  810CMP#&0A:BEQignorelf                             \ if LF insert null 
  820CMP#&28                             \ check for end of title string 
  830BEQnewline                                            \ to new line 
  840JSR&FFEE                   \ print title string character to screen 
  850INX                                \ increment title string address 
  860JMPread                                        \ get next character 
  880JSR&FFE7                                  \ new line for next entry 
  890LDX#00                        \ reset title string address register 
  900JMPcount                                         \ go to next entry 
  920LDA&8F:CMP#&3A:BEQpokea:JSR&FFEE  \ print ROM number, No. > than 9? 
  930LDA#&29:JSR&FFEE                                        \ print ")" 
  940LDA#&20:JSR&FFEE                                        \ print " " 
  950INC&8F:RTS                                   \ increment ROM number 
  970LDA#&41:STA&8F:JMPromnumber       \ poke in A into ROM number store 
  990LDA&8D:STA&F4:STAcomputer         \ restore computer to current ROM 
 1000RTS                                                          \ exit 

Note 1 : For the Electron to access ROMs lower than BASIC, a ROM higher than BASIC has to be selected first.

Note 2 : Y register holds the ROM count, X register holds the Title string character address.

Note 3 : Memory allocation - &8D current ROM number, &8E store for RAM byte during test, &8F ascii code for displayed ROM numbers.

Derek Walker, EUG #17