!Teletext Script
Annotated version of 'bbcnews'

 

This script was written in January 2002.

What we are doing here, quite simply, is fetching two frames in quick succession, so they may both be fetched in one 'pass'. This, in itself, should have the effect of doubling the fetch rate.

; Script to fetch news articles on BBC ceefax, in half the time
;
; Timed at 4 minutes, 16 seconds.
; Most of this wating for page fetches.

¤script "bbcnews"

; Select channel
channel(1)

; check we are receiving
getframe(100)
set A to status(pagefound)
if (A ! 1) error("Timed out trying to fetch page - is antenna connected?")

; start at 104, finish at 124
set A to 104
set E to 124

.fetchloop
  getframe(A)
We process as we receive. We remove lines 1 to 5, and 22 to 25.
  ; now remove the top/bottom
  set B to 1
  ; Choose page
  selectframe(A)
  ; Remove the top
  set C to 1
  .omittop
    omitline(C)
    C++
    if(C [ 5) go("omittop")
  ; Remove the end
  set C to 22
  .omitend
    omitline(C)
    C++
    if(C [ 25) go("omitend")
  ; Finished updating, store the page
  storeframe()
  
  ; Increment the frame, see if now next page
  A++
  if(A [ E) go("fetchloop")
Now save the files. Remember, E is still valid from before, set to '124'...
; Open file, and copy frames to it as ASCII
filewrite("<Teletext$Temp>.bbcnews")
; Type 2 = ASCII
set A to 104
.outputframes
  appendframe(A, 2)
  filewritebyte(10)
  filewritebyte(10)
  A++
  if(A [ E) go("outputframes")
fileclose()
filetype("<Teletext$Temp>.bbcnews", &FFF)
Because the output file is a 'text' file, running it will load it into an editor - possibly !Edit, but maybe !Zap or !StrongEd, etc...
; Call the OS to execute a command
oscall("%Filer_Run <Teletext$Temp>.bbcnews")

; done!
terminate()

Return to !Teletext index
Copyright © 2003 Richard Murray