Changeset 60 for trunk/page00/boot.asm

Show
Ignore:
Timestamp:
11/08/09 18:23:13 (3 years ago)
Author:
brandonlw
Message:

More attempts to stabilize dual booting

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/page00/boot.asm

    r59 r60  
    66 PUBLIC LdHLInd,BCALLRoutine,CheckForBootLoader,OS2Marker,AppInit,JForceCmdNoChar,JForceCmd 
    77 EXTERN PutS,PutC,ifastcopy,CallUSBActivityHook,CheckLowBatteriesTurnOff,SaveOScreen 
    8  EXTERN RunLinkActivityHook,HandleLinkKeyActivity,ResetStacks,_LCD_DRIVERON,NZIf84PlusSeries 
     8 EXTERN RunLinkActivityHook,HandleLinkKeyActivity,ResetStacks,LCD_DRIVERON,NZIf84PlusSeries 
    99 EXTERN _APP_PUSH_ERRORH,_APP_POP_ERRORH,FindSym,PushRealO1,Mov9ToOP1,FPAdd,OP1ToOP2,LCDDelay 
    1010 EXTERN Placeholder005Fh,Placeholder0006h,Placeholder004Eh,Placeholder0003h,Placeholder0035h 
     
    1818 
    1919;0000h: 
    20 boot:  jp BootCalculator 
     20boot:  jp JumpToBootCode 
    2121;0003h: 
    2222       jp Placeholder0003h 
     
    418418       ret 
    419419 
     420JumpToBootCode: 
     421       in a,(statusPort) 
     422       and STATUS_NON_83P_MASK 
     423       ld a,1Fh 
     424       jr z,$F 
     425       ld a,3 
     426       out (0Eh),a ;not sure yet 
     427       ld a,7Fh 
     428$$:    out (memPageAPort),a 
     429       ld a,7 
     430       out (4),a 
     431       ld hl,812Ch 
     432       in a,(statusPort) 
     433       and STATUS_84P_SERIES_MASK 
     434       jr nz,$F 
     435       ld hl,80D5h 
     436$$:    jp (hl) 
     437       xor a 
    420438BootCalculator: 
    421439       di 
     
    494512       ld a,17h ;default contrast level 
    495513       ld (contrast),a 
    496        call _LCD_DRIVERON 
     514       call LCD_DRIVERON 
    497515       ld hl,0800h 
    498516       ld (winTop),hl 
     
    520538       call APP_PUSH_ERRORH 
    521539       ld (onSP),sp 
    522        call _LCD_DRIVERON 
     540       call LCD_DRIVERON 
    523541       set onRunning,(iy+onFlags) 
    524542       res indicOnly,(iy+indicFlags) 
     
    552570       ld (RAMChecksum),de 
    553571TurnCalculatorOn: 
    554        call _LCD_DRIVERON 
     572       call LCD_DRIVERON 
    555573       set onRunning,(iy+onFlags) 
    556574       res indicOnly,(iy+indicFlags) 
     
    765783       nop 
    766784       in a,(1) 
    767        and 07Fh 
     785       bit 7,a 
    768786       ld a,0FFh 
    769787       out (1),a 
     
    777795;We need to put a loader in RAM and call that, which might return and we're good, or it'll switch OSes. 
    778796;TODO: this whole thing needs to run from RAM and depend on neither OS (or both, you might say) 
     797       ld a,81h 
     798       out (memPageBPort),a 
     799       xor a 
     800       out (memPageCPort),a 
    779801       ld a,(OS2Marker) 
    780802       or a 
     
    787809       jp userMem 
    788810BootLoader: 
     811       B_CALL LCD_DRIVERON 
    789812       res indicOnly,(iy+indicFlags) 
    790813       res curAble,(iy+curFlags) 
     
    796819       ld hl,2 
    797820       ld (curRow),hl 
    798        call NZIfTIOSExists-BootLoader+userMem 
     821       call DoesSecondOSExist-BootLoader+userMem 
    799822       jp z,ReceiveTIOS-BootLoader+userMem 
    800823       ;We have the TI-OS, decide to make the switch or not 
     
    835858       jr nz,bootSelectKeyLoop 
    836859       ;We pressed CLEAR, just reset and boot whatever it is that we are 
    837        B_CALL ClrLCDFull 
     860;       B_CALL ClrLCDFull 
     861       xor a 
     862       out (memPageBPort),a 
    838863       rst 00h 
    839864contrastUp: 
     
    944969       jr nz,$B 
    945970       ;Restart. 
    946        B_CALL ClrLCDFull 
     971       ld hl,0 
     972       ld (RAMChecksum),hl 
     973;       B_CALL ClrLCDFull 
     974;       B_CALL PowerOff 
    947975       rst 00h 
    948976DeleteOS: 
     
    953981       B_CALL WriteAByte 
    954982       ;Restart. 
     983       xor a 
     984       out (memPageBPort),a 
    955985       rst 00h 
    956986ReceiveTIOS: 
     
    965995       ld hl,2 
    966996       ld (curRow),hl 
    967        call NZIfTIOSExists-BootLoader+userMem 
     997       call DoesSecondOSExist-BootLoader+userMem 
    968998       ld hl,sStartTransfer2-BootLoader+userMem 
    969999       jr nz,$F 
     
    9821012$$:    B_CALL ClrLCDFull 
    9831013       jp TurnCalculatorOn 
    984 NZIfTIOSExists: 
     1014DoesSecondOSExist: 
    9851015       in a,(memPageAPort) 
    9861016       push af 
     
    9921022       jr z,$F 
    9931023       xor a 
    994        jr NZIfTIOSExists_1 
     1024       jr DoesSecondOSExist_1 
    9951025$$:    or 1 
    996 NZIfTIOSExists_1: 
     1026DoesSecondOSExist_1: 
    9971027       pop bc 
    9981028       ld a,b 
     
    12141244       DB LlBrack,"CLEAR] to exit",0 
    12151245sStartTransfer: 
    1216        DB "TI-OS not found." 
     1246       DB "OS not found.   " 
    12171247sStartTransfer2: 
    1218        DB "Send TI-OS now  " 
    1219        DB "to enable dual  " 
    1220        DB "booting.",0 
     1248       DB "Send secondary  " 
     1249       DB "OS now to enable" 
     1250       DB "dual booting.",0 
    12211251sSwitching: 
    12221252       DB "Switching...",0