Changeset 35

Show
Ignore:
Timestamp:
08/05/09 02:59:44 (3 years ago)
Author:
brandonlw
Message:

We can now receive a copy of the TI-OS and save it to pages 04h-07h and 74h-7Bh (pages 00h-03h are redirected to pages 70h-73h, and 7Ch-7Dh to 6Ah-6Bh)
Now we just need the boot loader and TI-OS patches to allow on-the-fly dual booting
And direct USB support so everyone can use it...

Location:
trunk
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/page00/boot.asm

    r34 r35  
    473473       call ReadKeypad 
    474474       cp skGraphvar 
    475        jr z,StartBootLoader 
     475       call z,StartBootLoader 
    476476$$:    set indicRun,(iy+indicFlags) 
    477477       ld hl,1 
     
    512512 
    513513StartBootLoader: 
    514 ;TODO: this whole thing eventually needs to run from sector 70h or wherever I back myself up to 
     514;This is called in two places:     during OS2 boot (we're on page 0) 
     515;                                  while on page 70h and we're temporarily swapped in 
     516;We need to put a loader in RAM and call that, which might return and we're good, or it'll switch OSes. 
     517;TODO: this whole thing needs to run from RAM and depend on neither OS 
     518       ld hl,BootLoader 
     519       ld de,userMem 
     520       ld bc,BootLoaderEnd-BootLoader 
     521       ldir 
     522       jp userMem 
     523BootLoader: 
    515524       res indicOnly,(iy+indicFlags) 
    516525       res curAble,(iy+curFlags) 
     
    552561       jr BootLoaderKeyLoop 
    553562$$:    call ClrLCDFull 
    554        jr TurnCalculatorOn 
     563       jp TurnCalculatorOn 
    555564SwitchOS: 
     565       B_CALL UnlockFlash 
     566       ;NOTE: this loader of the loader needs to execute as if it were either from here or page 70h. 
     567       ;TODO: Uh...not yet! 
    556568       ;Copy a loader to RAM which does the following: 
    557569       ;      Back up sector 0 to the extra RAM pages 
     
    566578       ;      Copy from the extra RAM pages to pages 68h-6Bh 
    567579       ;Restart. 
    568        ;NOTE: this loader of the loader needs to execute as if it were either from here or page 70h. 
    569        ;TODO: Uh...not yet! 
    570        call ClrLCDFull 
    571        jr TurnCalculatorOn 
     580       rst 00h 
    572581NZIfTIOSExists: 
    573582       in a,(memPageAPort) 
     
    601610       DB "enable dual     " 
    602611       DB "booting.",0 
     612BootLoaderEnd: 
    603613 
  • trunk/page00/display.asm

    r29 r35  
    33 
    44 PUBLIC AnimateRunIndicator,DispHexA,PutS,PutC,curBlink,SaveOScreen,DispHexHL,EraseEOL,ClrLCDFull 
    5  PUBLIC _LCD_COMMAND,SetXAutoIncrementMode,SetYAutoIncrementMode 
     5 PUBLIC _LCD_COMMAND,SetXAutoIncrementMode,SetYAutoIncrementMode,IPutSB 
    66 EXTERN IsAtEditTail,IsAtBtm,LCDDelay 
    77 
     
    1111       call LCDDelay 
    1212       out (LCDinstPort),a 
     13       ret 
     14 
     15IPutSB: 
     16       push bc 
     17       ld a,(hl) 
     18       inc hl 
     19       call PutC 
     20       pop bc 
     21       djnz IPutSB 
    1322       ret 
    1423 
  • trunk/page00/util.asm

    r34 r35  
    77 PUBLIC CopyRAMToFlashPage 
    88 PUBLIC BCALL,BJUMP,JErrorNo,SetupPagedPtr,PagedGet,EraseRAMPage 
    9  EXTERN Page0Call,UpdateAPD,PowerOff,GetCSC 
     9 EXTERN Page0Call,UpdateAPD,PowerOff,GetCSC,PutC 
    1010 
    1111 include "includes\os2.inc" 
  • trunk/page1C/linkprotocol.asm

    r34 r35  
    66 
    77 PUBLIC SendCommandA,ReceiveHeaderPacket,SendSkipExitPacket,SendCAndAddToChecksum,SendContinue,ReceiveDataPacket 
    8  PUBLIC receiveRestOfDataPacket 
     8 PUBLIC receiveRestOfDataPacket,SendHCommand 
    99 EXTERN SetupPagedPtr,EnableLinkAssist,Send4Bytes,PagedGet,SendAByte,Get4BytesNC,JErrorNo 
    1010 EXTERN SendCByte,RecAByteIO,SaveFlashBytes,SendAcknowledge 
  • trunk/page1C/silentlink.asm

    r34 r35  
    1010 EXTERN Send4Bytes,SendCAndAddToChecksum,LCDDelay,_LCD_COMMAND,SendAByte,SetXAutoIncrementMode,EraseRAMPage 
    1111 EXTERN SetYAutoIncrementMode,SendContinue,ReceiveDataPacket,DispHexHL,PutC,receiveRestOfDataPacket 
    12  EXTERN CopyToRAMPage,CopyRAMToFlashPage,EraseEOL,PowerOff 
     12 EXTERN CopyToRAMPage,CopyRAMToFlashPage,EraseEOL,PowerOff,SendHCommand,IPutSB 
    1313 
    1414keyscnlnk: 
     
    5151       ;This is a command we don't recognize 
    5252       ;TODO: for now, freak out 
     53       ld a,5 
     54       call PutC 
    5355       ld a,(header+1) 
    5456       call DispHexA 
     
    9496       DB 06h 
    9597       DW receivedVariableHeader 
     98       DB 0A2h 
     99       DW receivedRequestToSend 
    96100       DB 87h 
    97101       DW remoteControlPacket 
     
    101105       DW keyscnlnkEnd 
    102106cmdTableEnd: 
     107 
     108receivedRequestToSend: 
     109       call receiveRestOfDataPacket 
     110       ld a,(ioOP1) 
     111       cp 19h 
     112       jr z,sendDirectoryContentsResponse 
     113       ld a,6 
     114       call PutC 
     115       ld a,0A2h 
     116       call DispHexA 
     117       ld hl,ioOP1 
     118       ld b,11 
     119       call IPutSB 
     120       ld a,6 
     121       call PutC 
     122       jr keyscnlnkEnd 
     123sendDirectoryContentsResponse: 
     124;TODO: actually implement the directory contents response 
     125       ld hl,22000 
     126       ld (ioData),hl 
     127       ld a,15h 
     128       ld hl,2 
     129       call SendCommandA 
     130       ld h,92h 
     131       call SendHCommand 
     132       jr keyscnlnkEnd 
    103133 
    104134screenshotPacket: 
     
    163193       jr z,receivingOS 
    164194       ;Not accepting anything else for now 
     195       call DispHexA 
    165196       ld de,1 
    166197       ld a,0Ch 
     
    170201       bit receiveTIOS,(iy+linkFlags2) 
    171202       jr z,ReceiveNewOS 
     203       B_CALL UnlockFlash 
    172204       ;Wipe the extra RAM pages 
    173205       ld a,84h 
     
    246278       push af 
    247279       push hl 
     280       call DispHexHL       ;*** TESTING 
    248281       ld b,a 
    249282       ld a,(appSearchPage) 
     
    300333       jr dataWritten 
    301334$$:    ;Is this page 7Ch or 7Dh? If so, change it to 6Ah or 6Bh 
    302        push af 
    303        ld a,6 
    304        call PutC 
    305        pop af 
    306335       cp 7Ch 
    307336       ld b,6Ah 
     
    316345       ld b,3Bh 
    317346       jr z,translatePage 
     347       cp 3Ah 
     348       jr z,checkAddress 
     349       cp 7Ah 
     350       jr z,checkAddress 
    318351$$:    ;Just write it 
    319        pop bc 
     352       ld hl,6 
     353       ld (curRow),hl 
     354       call DispHexA 
     355       ex de,hl 
     356       call DispHexHL 
     357       ex de,hl 
     358       pop bc 
     359       push bc 
     360       pop hl 
     361       call DispHexHL 
    320362       ld hl,appData 
    321363       B_CALL WriteFlash 
     
    324366       ld a,b 
    325367       jr $B 
     368checkAddress: 
     369       push de 
     370       ld hl,4200h 
     371       or a 
     372       sbc hl,de 
     373       pop de 
     374       jr c,$B 
     375       jr z,$B 
     376       ;Skip writes to 7A:4000h and 7A:4100h 
    326377dataWritten: 
    327378       call Get4BytesNC 
     
    332383       jr ReceiveOSPage 
    333384$$:    call SendAcknowledge 
    334 ;Patch the received TI-OS to not erase sector 70h (where we will be backed up) 
    335 ;Put the [X,T,theta,N] boot loader in page 0 
     385;TODO: Patch the received TI-OS to not erase sector 70h (where we will be backed up) 
     386;TODO: Put the [X,T,theta,N] boot loader in page 0 
     387       ;This loader needs to read the keypad for skGraphvar, and if it's being pressed, call: 
     388       ;      in a,(6) 
     389       ;      push af 
     390       ;      ld a,70h 
     391       ;      out (6),a 
     392       ;      call StartBootLoader+4000h 
     393       ;      pop af 
     394       ;      out (6),a 
     395       ;      ret 
    336396       call APP_POP_ERRORH 
    337397       ;Seems like the most sensible thing to do after receiving the TI-OS is just shut off 
     
    358418       call SendAcknowledge 
    359419       ld hl,ioData 
    360        ld (hl),OS2_VERSION_MAJOR 
    361        inc hl 
    362        ld (hl),OS2_VERSION_MINOR 
     420       ld (hl),2 ;OS2_VERSION_MAJOR 
     421       inc hl 
     422       ld (hl),22h ;OS2_VERSION_MINOR 
    363423       inc hl 
    364424       B_CALL GetBootVer