Changeset 48

Show
Ignore:
Timestamp:
10/10/09 22:20:11 (2 years ago)
Author:
brandonlw
Message:

Finally fixed that LCD-still-off-when-turning-on problem, and we're now impervious to battery pulls
We finally have a way to start implementing reset-specific things, like setting up the various floating-point and operator stacks, as well as the beginnings of variable storage

Location:
trunk
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • trunk/includes/os2.inc

    r47 r48  
    110110onSP                        EQU    85BCh 
    111111RAMChecksum                 EQU    85BEh 
     112; 
     113menuCurrent                 EQU    85DEh 
    112114; 
    113115ioFlag                      EQU    8670h 
  • trunk/page00/boot.asm

    r47 r48  
    44 include "includes\os2.inc" 
    55 
    6  PUBLIC LdHLInd,BCALLRoutine,CheckForBootLoader,OS2Marker 
     6 PUBLIC LdHLInd,BCALLRoutine,CheckForBootLoader,OS2Marker,AppInit 
    77 EXTERN PutS,PutC,ifastcopy,CallUSBActivityHook,CheckLowBatteriesTurnOff,SaveOScreen 
    8  EXTERN RunLinkActivityHook,HandleLinkKeyActivity 
     8 EXTERN RunLinkActivityHook,HandleLinkKeyActivity,ResetStacks 
    99 EXTERN _APP_PUSH_ERRORH,_APP_POP_ERRORH,FindSym,PushRealO1,Mov9ToOP1,FPAdd,OP1ToOP2,LCDDelay 
    1010 EXTERN Placeholder005Fh,Placeholder0006h,Placeholder004Eh,Placeholder0003h,Placeholder0035h 
    1111 EXTERN outputPage,NZIf83Plus,_ZERO_PORT_3,_OUT_PORT_3,AnimateRunIndicator,PowerOff 
    12  EXTERN DispHexA,DispHexHL,IPutC,ReadKeyboardKey,ReadKeypad,ClrLCDFull 
     12 EXTERN DispHexA,DispHexHL,IPutC,ReadKeyboardKey,ReadKeypad,ClrLCDFull,InitHomescreenContext 
    1313 EXTERN curBlink,resetAPDTimer,UpdateAPD,BCALL,BJUMP,CopyRAMToFlashPage,cphlde,CalculateOSChecksum 
    1414 EXTERN _HandleDefaultUSBInterrupt,_ReadUSBInterruptData,_HandleUSBInterruptInitialize,CopyToRAMPage 
     
    374374       pop hl 
    375375       call _ZERO_PORT_3 
    376        ld a,iNormal 
     376       ld a,11h 
    377377       jr interruptDirectReturnA 
    378378handleKeyOn: 
     
    397397       and 4Fh 
    398398       cp 41h 
    399 dol2:  jr nz,TurnCalculatorOn 
     399dol2:  jr nz,RAMUnhookedTurnCalculatorOn 
    400400       bit shift2nd,(iy+shiftFlags) 
    401401       jr z,_2ndNotPressedWithOn 
     
    438438       ld sp,0FFC5h 
    439439       ld iy,flags 
    440        B_CALL ClrScrnFull 
    441440       ;Do any other initialization 
     441       call SetContrast 
    442442       ;Appear "off" 
    443443       xor a 
     
    451451       ei 
    452452       halt 
    453 TurnCalculatorOn: 
     453RAMUnhookedTurnCalculatorOn: 
    454454       ;Set everything back up 
    455455       ld a,STATE_MODE0_DEFAULT 
     
    467467       out (0Fh),a 
    468468$$:    call _ZERO_PORT_3 
    469        ld a,lcdTurnOn 
    470        out (LCDinstPort),a 
    471469       call SetContrast 
    472470       ld a,INTERRUPT_MASK_POWER+INTERRUPT_MASK_HW1+INTERRUPT_MASK_ON 
    473471       out (interruptEnPort),a 
    474        set onRunning,(iy+onFlags) 
    475472       res receiveTIOS,(iy+linkFlags2) 
    476473;Start the OS, minimal as it is 
     474       ld hl,(RAMChecksum) 
     475       ld de,0A55Ah 
     476       call cphlde 
     477       jr z,$F 
    477478       call CalculateOSChecksum 
    478479       ld de,(RAMChecksum) 
     
    481482       ;The RAM checksum check has failed, so wipe out RAM and hope for the best 
    482483       ;TODO: figure out what this actually needs to do 
    483 ;       ld hl,appData 
    484 ;       ld de,appData+1 
    485 ;       ld bc,7FFFh 
    486 ;       ld (hl),0 
    487 ;       ldir 
    488 ;       jp 0000h 
     484       ld hl,appData 
     485       ld de,appData+1 
     486       ld bc,7FFFh 
     487       ld (hl),0 
     488       ldir 
    489489$$:    ;Screw up the RAM checksum so it's no longer valid 
    490490       dec de 
    491491       ld (RAMChecksum),de 
    492        call ClrLCDFull 
     492TurnCalculatorOn: 
     493       ld a,lcdTurnOn 
     494       out (LCDinstPort),a 
     495       set onRunning,(iy+onFlags) 
    493496       res indicOnly,(iy+indicFlags) 
    494497       in a,(statusPort) 
     
    502505       set apdAble,(iy+apdFlags) 
    503506       set apdRunning,(iy+apdFlags) 
    504        ld hl,8000h 
    505        ld (editTop),hl 
    506        inc hl 
    507        ld (editCursor),hl 
    508        inc hl 
    509        ld (editTail),hl 
    510        inc hl 
    511        ld (editBtm),hl 
    512        ld a,' ' 
    513        ld (curUnder),a 
    514        ld hl,0 
    515        ld (curRow),hl 
    516507       ld sp,0FFF7h 
    517508       ld hl,0109h ;English 
    518509       ld (localLanguage),hl 
    519        ld hl,homescreenContextVectors 
    520        call AppInit 
    521        B_CALL ClrLCDFull 
     510       ld a,appStart 
     511       call _newContext0 
    522512       ld hl,_monErrorHandler 
    523513       call APP_PUSH_ERRORH 
    524514       ld (onSP),sp 
     515       call ResetStacks 
     516       xor a 
     517       ld (menuCurrent),a 
     518       set appTextSave,(iy+appFlags) 
    525519RestartMon: 
    526520_Mon:  xor a 
     
    581575       ret 
    582576differentContext: 
     577       ld b,a 
     578       in a,(memPageAPort) 
     579       push af 
     580       ld a,b 
     581 
    583582       push bc 
    584        push af 
    585        sub appStart 
    586        call GetContextStartRoutine 
    587        pop af 
    588        push hl 
    589        push af 
    590        res curLock,(iy+curFlags) 
    591        call CallcxPPutAwayRoutine 
    592        pop af 
    593        push af 
    594        call CallcxPutAwayRoutine 
    595        call IsExternalApp 
    596        call z,SetFastSpeed 
    597        ld a,(cxCurApp) 
    598        pop bc 
    599        push af 
    600        push bc 
    601        ld hl,cxMain 
    602        ld de,cxPrev 
    603        ld bc,14 
    604        ldir 
    605        ld a,(flags+appFlags) 
    606        ld (de),a 
    607        pop af 
    608        push af 
    609        pop af 
    610        pop bc 
    611        pop hl 
    612        ld (cxCurApp),a 
    613        pop af 
    614 CallContextStartRoutine: 
     583        push af 
     584         sub appStart 
     585         call GetContextStartRoutine 
     586         out (memPageAPort),a 
     587        pop af 
     588        push hl 
     589         push af 
     590          res curLock,(iy+curFlags) 
     591;          call CallcxPPutAwayRoutine 
     592         pop af 
     593         push af 
     594;          call CallcxPutAwayRoutine 
     595          call IsExternalApp 
     596          call z,SetFastSpeed 
     597          ld a,(cxCurApp) 
     598         pop bc 
     599         push af 
     600          push bc 
     601           ld hl,cxMain 
     602           ld de,cxPrev 
     603           ld bc,14 
     604           ldir 
     605           ld a,(flags+appFlags) 
     606           ld (de),a 
     607          pop af 
     608          push af 
     609          pop af 
     610         pop bc 
     611        pop hl 
     612        ld (cxCurApp),a 
     613       pop af 
     614;Call context start routine 
    615615       push af 
    616616       call jumpToHL 
    617617       pop bc 
     618 
     619       pop af 
     620       out (memPageAPort),a 
    618621       ret 
    619622AppInit: 
     
    663666       add hl,de 
    664667       add hl,de 
    665        jr LdHLInd 
     668       add hl,de 
     669       ld e,(hl) 
     670       inc hl 
     671       ld d,(hl) 
     672       inc hl 
     673       ld a,(hl) 
     674       ex de,hl 
     675       ret 
    666676contextStartTable: 
    667        DW 0000h 
     677       DW InitHomescreenContext 
     678       DB 00h 
    668679 
    669680CheckForBootLoader: 
  • trunk/page00/home.asm

    r47 r48  
    44 include "includes\os2.inc" 
    55 
    6  PUBLIC homescreenContextVectors 
    7  EXTERN DispHexA,DispHexHL,GetHexA,GetHexHL 
     6 PUBLIC homescreenContextVectors,InitHomescreenContext 
     7 EXTERN DispHexA,DispHexHL,GetHexA,GetHexHL,AppInit 
     8 
     9InitHomescreenContext: 
     10       ld hl,8000h 
     11       ld (editTop),hl 
     12       inc hl 
     13       ld (editCursor),hl 
     14       inc hl 
     15       ld (editTail),hl 
     16       inc hl 
     17       ld (editBtm),hl 
     18       ld a,' ' 
     19       ld (curUnder),a 
     20       ld hl,0 
     21       ld (curRow),hl 
     22       ld hl,homescreenContextVectors 
     23       call AppInit 
     24       B_CALL ClrLCDFull 
     25       ret 
    826 
    927homescreenContextVectors: 
  • trunk/page00/menu.asm

    r47 r48  
    99;Key code is in A. Check to see if it's a menu key and back out if not, otherwise handle it. 
    1010;Return carry flag set if you want the system monitor to restart, otherwise the current cxMain handler will get called for this key. 
     11       or a 
     12       ret 
    1113 
  • trunk/page01/01base.asm

    r47 r48  
    3636       set apdRunning,(iy+apdFlags) 
    3737restartKeyLoop: 
     38       set enableHW2Timer,(iy+interruptFlags) 
    3839       bit onInterrupt,(iy+onFlags) 
    3940       res onInterrupt,(iy+onFlags) 
     
    4546       or a 
    4647       jr nz,scanCodeFound 
    47        call HandleLinkKeyActivity 
     48$$:    call HandleLinkKeyActivity 
     49       bit hw2TimerSkipped,(iy+linkKeyFlags) 
     50       jr nz,$B 
    4851       in a,(2) 
    4952       and 80h 
  • trunk/page1C/silentlink.asm

    r47 r48  
    4242       bit 5,(iy+3Dh) 
    4343       jr nz,keyscnlnkEnd 
    44        ;HACK: until I figure out where the extra zero's coming from... 
    4544       call Get3Bytes 
    4645HandleLinkPacket: 
     
    7473keyscnlnkHandler: 
    7574       di 
    76        call DisableLinkAssist 
     75;       call DisableLinkAssist 
    7776       pop af 
    7877       bit 2,a 
     
    101100       DB 06h 
    102101       DW receivedVariableHeader 
     102       DB 0C9h 
     103       DW receivedVariableRequest 
    103104       DB 0A2h 
    104105       DW receivedRequestToSend 
     
    112113       DW keyscnlnkEnd 
    113114cmdTableEnd: 
     115 
     116receivedVariableRequest: 
     117       ld hl,ioData 
     118       ld (iMathPtr5),hl 
     119       call receiveRestOfDataPacket 
     120       ld de,1 
     121       ld a,0Ch 
     122       call SendSkipExitPacket 
     123       jr keyscnlnkEnd 
    114124 
    115125memoryDumpPacket: