!Teletext Script
Annotated version of 'bbcnewsf'

 

As for '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 2 minutes, 15 seconds.
; Yes, I know it fetches p114 twice...

¤script "bbcnewsfst"

; 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?")

; start1 at 104, start2 at 114
set A to 104
set E to 114

.fetchloop
  getframe(A)
  set F to A
  add(F, 10)
  getframe(F)
We still process as we receive. Like before, we remove lines 1 to 5, and 22 to 25.
Please note that the comment regarding duplicate code is possibly no longer relevant - it should be possible to put the page manging code into a 'procedure'.
  ; now remove the top/bottom of first page fetched
  set B to 1
  ; Choose page
  selectframe(A)
  ; Remove the top
  set C to 1
  .omittop_one
    omitline(C)
    C++
    if(C [ 5) go("omittop_one")
  ; Remove the end
  set C to 22
  .omitend_one
    omitline(C)
    C++
    if(C [ 25) go("omitend_one")
  ; Finished updating, store the page
  storeframe()

  ; there's no SIMPLE way to do this, and we have time between p1xx and rollback,
  ; so we'll just dupe the code. It's easier.
(the reason I've not altered this code is because I no longer can receive BBC 1...)
  ; now remove the top/bottom of second page fetched
  set B to 1
  ; Choose page
  selectframe(F)
  ; Remove the top
  set C to 1
  .omittop_two
    omitline(C)
    C++
    if(C [ 5) go("omittop_two")
  ; Remove the end
  set C to 22
  .omitend_two
    omitline(C)
    C++
    if(C [ 25) go("omitend_two")
  ; Finished updating, store the page
  storeframe()

  ; Increment the frame, see if now next page
  A++
  if(A [ E) go("fetchloop")
This is pretty much the same as 'bbcnews'...
; Open file, and copy frames to it as ASCII
filewrite("<Teletext$Temp>.bbcnews")
; Type 2 = ASCII
set A to 104
set E to 124
.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