Shop OBEX P1 Docs P2 Docs Learn Events
simple basic — Parallax Forums

simple basic

[Deleted User][Deleted User] Posts: 0
edited 2006-12-17 16:40 in Propeller 1
In mike's OS he has·simple basic demo program , how is the program Assigning the the value of 140 to quit·.


········ a += 3 + strsize(a+2)
··········· 138: ' run
················· clearvars
··········· 129, 139: ' then, rnd
·············· abort(@syn)
··········· 140: ' quit
·············· boot.bootEEPROM(boot#bootAddr)
····· else
········ abort(@syn)

Thanks ,Brian

Comments

  • [Deleted User][Deleted User] Posts: 0
    edited 2006-12-16 22:34
    I don’t believe it ,I actually figured this one out myself .If you view the code ,that’s the address there at .

    Brian
  • [Deleted User][Deleted User] Posts: 0
    edited 2006-12-17 15:09
    Mike,

    ··Seem to have a handle on·Peek & Poke .I'm calling up the· readEEprom & writeEEprom in the loader object in your OS .Still trying to wrap my brain around a save comand·.Would·I use a udatebitmapEEprom· from the file system object & then A writeEEprom from the loader object ?



    Brian
  • Mike GreenMike Green Posts: 23,101
    edited 2006-12-17 16:28
    The copy command is the prototype because it can create a file, lookup a file, overwrite a file, etc. It's in two sections. The first one looks up the names, checks for special cases including whether there's room left
        $59504F43:  ' copy <fileFrom> <fileTo>
          x := \getTextWord(x,@fileName,12,true," ")
          if x < 0
            abort -string("missing <fileFrom>")
          x := \getTextWord(x,@fileNameTo,12,true," ")
          if x < 0
            abort -string("missing <fileTo>")
          fileAddr := \files.searchFile(@fileName)
          if fileAddr < 0
            abort -string("<fileFrom> not found")
          fileAddrTo := \files.searchFile(@fileNameTo)
          if fileAddrTo < 0
            if fileNameTo[noparse][[/noparse]0] == files#altBoot1
              if fileNameTo == files#altBoot2
               abort -string("can't create **BOOT")
            fileAddrTo := \files.searchFile(0)
            if fileAddrTo < 0
              abort -string("can't create <fileTo>")
            fileChange := false
          else
            fileChange := true
          return processCopy     ' Options were copied
    
    


    The second section takes care of getting permission to overwrite an existing copy, then actually does the copy.
        processCopy:
          if fileChange
            dsp.str(string("    Overwrite? (Y/n) "))
            repeat
              t := key.getkey
              if t == dsp#Cr
                t := "y"
            until t == "Y" or t == "y" or t == "N" or t == "n"
            dsp.out(t)
          else
            files.markNewName(@fileNameTo,fileAddrTo,fileAddr)
            t := "y"
            dsp.str(string("Created"))
          if t == "Y" or t == "y"
            if fileChange
              files.writeFilename(@fileNameTo,fileAddrTo,fileAddr)
            dsp.out(" ")
            j := dsp.windowCol
            fileAddr &= $7FF000    ' Remove option bits
            fileAddrTo &= $7FF000  '  from addresses
            repeat i from 0 to $7FE0 step 32
              dsp.decFixed(i,5)
              dsp.out2(dsp#MoveX,j)
              if i == $7FE0
                k := 16
              else
                k := 32
              if not ldr.readEEPROM(fileAddr+i,@b0,k)
                abort string("copy EEPROM read error")
              if not ldr.writeEEPROM(fileAddrTo+i,@b0,k)
                abort string("copy EEPROM write error")
              ldr.writeWait(fileAddrTo+i)
            dsp.str(string("Saved"))
          dsp.out(dsp#Cr)
    
    


    The updateBitmapEEPROM routine is used only to recheck if there are any new EEPROMs attached. It's used during initialization and for the "probe" command.
  • [Deleted User][Deleted User] Posts: 0
    edited 2006-12-17 16:40
    Mike,
    From what I can tell , the program a person is writing is sitting in the stack.
    Would I end up with somthing like this ?

    to save:
    10 Print " Hello World"
    copy "stack" hello_world
    to load:
    copy hello_world· "stack"
    list
    10 print "Hello World"

    Brian


    I'm about four steps ahead of myself , Is there going to be a way to call up the main OS services . I tried to include it , but it made the program over 32k .

    Post Edited (truckwiz) : 12/18/2006 1:00:40 AM GMT
Sign In or Register to comment.