Changeset 55
- Timestamp:
- 10/11/09 23:33:32 (2 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 10 modified
-
OS2.zws (modified) (1 diff)
-
includes/os2.inc (modified) (11 diffs)
-
page00/boot.asm (modified) (5 diffs)
-
page00/display.asm (modified) (5 diffs)
-
page00/home.asm (modified) (2 diffs)
-
page00/intmisc.asm (modified) (1 diff)
-
page00/jumptable.asm (modified) (2 diffs)
-
page00/mathcore.asm (modified) (1 diff)
-
page00/menu.asm (modified) (1 diff)
-
page01/font.asm (added)
-
page01/strings.asm (added)
-
page1D/1Dbase.asm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/OS2.zws
r49 r55 49 49 SOURCE = page00\jumptable.asm 50 50 SOURCE = page01\01base.asm 51 SOURCE = page01\font.asm 52 SOURCE = page01\strings.asm 51 53 SOURCE = page02\02base.asm 52 54 SOURCE = page03\03base.asm -
trunk/includes/os2.inc
r49 r55 27 27 ;====================================================================== 28 28 _GetCSC EQU 4018h 29 _JForceCmdNoChar EQU 4027h 30 _JForceCmd EQU 402Ah 29 31 _AppInit EQU 404Bh 30 32 _PutS EQU 450Ah … … 36 38 _CursorOn EQU 45C4h 37 39 _showCursor EQU 45C7h 40 _KeyToString EQU 45CAh 38 41 _keyscnlnk EQU 4A1Ah 39 42 _GetKey EQU 4972h … … 77 80 kbdKey EQU 8444h 78 81 kbdGetKy EQU 8445h 79 ; 82 keyExtend EQU 8446h 80 83 contrast EQU 8447h 81 84 apdSubTimer EQU 8448h … … 88 91 ; 89 92 curXRow EQU 8451h 93 ; 94 lFont_record EQU 845Ah 90 95 ; 91 96 indicMem EQU 846Eh … … 118 123 textShadow EQU 8508h 119 124 ; 125 textShadCur EQU 8588h 126 textShadTop EQU 858Ah 127 textShadAlph EQU 858Bh 128 textShadIns EQU 858Ch 120 129 cxMain EQU 858Dh 121 130 cxPPutAway EQU 858Fh … … 132 141 ; 133 142 menuCurrent EQU 85DEh 143 selectedSubMenu EQU 85DFh 144 selectedMenuItem EQU 85E0h 145 numHeaders EQU 85E1h 146 numItemsForThisHeader EQU 85E2h 147 ; 148 curFlagsBackup EQU 85E4h 134 149 ; 135 150 ioFlag EQU 8670h … … 218 233 pagedBuf EQU 983Ah ;16 bytes 219 234 ; 235 topMenuRow EQU 984Ah 236 ; 220 237 appBackUpScreen EQU 9872h 221 238 ; … … 235 252 ; 236 253 nestedHookLevels EQU 9CAEh ;not sure this is of any use 254 ; 255 keyForStr EQU 9D76h 256 keyForStrRam EQU 9D77h 237 257 ; 238 258 userMem EQU 9D95h … … 294 314 batteryCheckFlags EQU 0Fh 295 315 turnOffIfLowBatteriesFound EQU 7 ;1=if low batteries detected, shut the calculator off 316 317 menuFlags EQU 11h 318 useCustomDisplay EQU 5 ;1=use custom display of menu items instead of key codes -> strings 296 319 297 320 indicFlags EQU 12h … … 434 457 speedPort EQU 20h 435 458 modelPort EQU 21h 459 460 ;====================================================================== 461 ; Menu Equates 462 ;====================================================================== 463 mConfirmation equ 01h 464 mApps equ 02h 465 mProgramHome equ 03h 466 mPrgm_Run equ 00h 467 mPrgm_Edit equ 01h 468 mPrgm_New equ 02h 469 mZoom equ 04h 470 mZoom_Zoom equ 00h 471 mZoom_Memory equ 01h 472 mDraw equ 05h 473 mDraw_Draw equ 00h 474 mDraw_Points equ 01h 475 mDraw_Store equ 02h 476 mStatPlots equ 06h 477 mStat equ 07h 478 mStat_Edit equ 00h 479 mStat_Calc equ 01h 480 mStat_Tests equ 02h 481 mMath equ 08h 482 mMath_Math equ 00h 483 mMath_Number equ 01h 484 mMath_Complex equ 02h 485 mMath_Prob equ 03h 486 mTest equ 09h 487 mTest_Test equ 00h 488 mTest_Logic equ 01h 489 mVars equ 0Ah 490 mVars_Vars equ 00h 491 mVars_YVars equ 01h 492 mMemory equ 0Ch 493 mMatrix equ 0Dh 494 mMatrix_Name equ 00h 495 mMatrix_Math equ 01h 496 mMatrix_Edit equ 02h 497 mDistr equ 0Eh 498 mDistr_Distr equ 00h 499 mDistr_Draw equ 01h 500 mAngle equ 0Fh 501 mList equ 10h 502 mList_Names equ 00h 503 mList_Ops equ 01h 504 mList_Math equ 02h 505 mCalculate equ 11h 506 mVarsWin equ 14h 507 mVarsWin_XY equ 00h 508 mVarsWin_TTh equ 01h 509 mVarsWin_UVW equ 02h 510 mVarsZoom equ 15h 511 mVarsZoom_ZXY equ 00h 512 mVarsZoom_ZT equ 01h 513 mVarsZoom_UVW equ 02h 514 mVarsGDB equ 16h 515 mVarsPics equ 17h 516 mVarsStrings equ 18h 517 mVarsStat equ 19h 518 mVarsStat_XY equ 00h 519 mVarsStat_Sigma equ 01h 520 mVarsStat_EQ equ 02h 521 mVarsStat_Test equ 03h 522 mVarsStat_Pts equ 04h 523 mVarsTable equ 1Ah 524 mVarsYEqu equ 1Bh 525 mVarsParametric equ 1Ch 526 mVarsPolar equ 1Dh 527 mVarsFnOnOff equ 1Eh 528 mMemReset equ 1Fh 529 mMemReset_RAM equ 00h 530 mMemReset_ROM equ 01h 531 mMemReset_All equ 02h 532 mMemMgmtDel equ 20h 533 mMemResetDefaults equ 21h 534 mMemResetRAMAll equ 23h 535 mMemResetROMVars equ 24h 536 mMemResetROMApps equ 25h 537 mMemResetROMAll equ 26h 538 mMemResetAll equ 27h 539 mGroup equ 28h 540 mGroup_New equ 00h 541 mGroup_Ungroup equ 01h 542 mGroupVars equ 29h 543 mProgramEdit equ 2Ah 544 mPrgmEd_Ctrl equ 00h 545 mPrgmEd_IO equ 01h 546 mPrgmEd_Exec equ 02h 547 mPrgmZoom equ 2Bh 548 mPrgmZoom_Zoom equ 00h 549 mPrgmZoom_Mem equ 01h 550 mPrgmDraw equ 2Ch 551 mPrgmDraw_Draw equ 00h 552 mPrgmDraw_Pt equ 01h 553 mPrgmDraw_Store equ 02h 554 mPrgmStatPlot equ 2Dh 555 mPrgmSP_Plots equ 00h 556 mPrgmSP_Type equ 01h 557 mPrgmSP_Mark equ 02h 558 mPrgmStat equ 2Eh 559 mPrgmStat_Edit equ 00h 560 mPrgmStat_Calc equ 01h 561 mPrgmStat_Tests equ 02h 562 mPrgmMath equ 2Fh 563 mPrgmMath_Math equ 00h 564 mPrgmMath_Num equ 01h 565 mPrgmMath_Cplx equ 02h 566 mPrgmMath_Prob equ 03h 567 mLink equ 30h 568 mLink_Send equ 00h 569 mLink_Recieve equ 01h 570 mLinkTrasmit equ 31h 571 mLinkXmit_Xmit equ 01h 572 mGarbageCollect equ 3Fh 573 mSelectGroupVars equ 40h 574 mSelGrpVars_Sel equ 00h 575 mSelGrpVars_Grp equ 01h 576 mDuplicateName equ 42h 577 mCatalog equ 45h 578 mFinance equ 22h 579 mFinance_Calc equ 00h 580 mFinance_Vars equ 01h 436 581 437 582 ;====================================================================== … … 1203 1348 ;====================================================================== 1204 1349 ; 1205 kExtendEcho2 EQU 0FCh 1350 kExtendEcho2 EQU 0FCh 1351 k2Tools EQU 4 1206 1352 ; 1207 1353 ;======================================================================; -
trunk/page00/boot.asm
r49 r55 4 4 include "includes\os2.inc" 5 5 6 PUBLIC LdHLInd,BCALLRoutine,CheckForBootLoader,OS2Marker,AppInit 6 PUBLIC LdHLInd,BCALLRoutine,CheckForBootLoader,OS2Marker,AppInit,JForceCmdNoChar,JForceCmd 7 7 EXTERN PutS,PutC,ifastcopy,CallUSBActivityHook,CheckLowBatteriesTurnOff,SaveOScreen 8 8 EXTERN RunLinkActivityHook,HandleLinkKeyActivity,ResetStacks,_LCD_DRIVERON 9 9 EXTERN _APP_PUSH_ERRORH,_APP_POP_ERRORH,FindSym,PushRealO1,Mov9ToOP1,FPAdd,OP1ToOP2,LCDDelay 10 10 EXTERN Placeholder005Fh,Placeholder0006h,Placeholder004Eh,Placeholder0003h,Placeholder0035h 11 EXTERN outputPage,NZIf83Plus,_ZERO_PORT_3,_OUT_PORT_3,AnimateRunIndicator,PowerOff 11 EXTERN outputPage,NZIf83Plus,_ZERO_PORT_3,_OUT_PORT_3,AnimateRunIndicator,PowerOff,clrTR 12 12 EXTERN DispHexA,DispHexHL,IPutC,ReadKeyboardKey,ReadKeypad,ClrLCDFull,InitHomescreenContext 13 13 EXTERN curBlink,resetAPDTimer,UpdateAPD,BCALL,BJUMP,CopyRAMToFlashPage,cphlde,CalculateOSChecksum … … 15 15 EXTERN _HandleUSBACablePluggedIn,_HandleUSBACableUnplugged,_HandleUSBBCablePluggedIn,_HandleUSBBCableUnplugged 16 16 EXTERN GetHexA,GetHexHL,CursorOff,RunIndicOn,SetFastSpeed,CanAlph,homescreenContextVectors,SetContrast,_PULLDOWNCHK 17 EXTERN savepartialWin 17 18 18 19 ;0000h: … … 494 495 ld hl,0800h 495 496 ld (winTop),hl 497 set appTextSave,(iy+appFlags) 496 498 B_CALL ClrScrnFull 497 499 ld hl,userMem … … 516 518 call APP_PUSH_ERRORH 517 519 ld (onSP),sp 520 ld a,lcdTurnOn 521 out (LCDinstPort),a 522 set onRunning,(iy+onFlags) 523 res indicOnly,(iy+indicFlags) 524 set indicRun,(iy+indicFlags) 525 set curAble,(iy+curFlags) 526 set apdAble,(iy+apdFlags) 527 set apdRunning,(iy+apdFlags) 528 xor a 529 ld (menuCurrent),a 530 ld a,appStart 531 call _newContext0 532 call ResetStacks 533 ld hl,0205h 534 ld (curRow),hl 535 res appTextSave,(iy+appFlags) 536 ld hl,sRAMCleared 537 call PutS 538 set appTextSave,(iy+appFlags) 539 call savepartialWin 540 ld hl,0 541 ld (curRow),hl 542 B_CALL GetKey 543 push af 544 B_CALL ClrLCDFull 545 pop af 546 jr _monForceKey 518 547 $$: ;Screw up the RAM checksum so it's no longer valid 548 ld de,(RAMChecksum) 519 549 dec de 520 550 ld (RAMChecksum),de … … 540 570 call ResetStacks 541 571 set appTextSave,(iy+appFlags) 572 call savepartialWin 542 573 RestartMon: 543 574 _Mon: xor a 544 575 ld (kbdKey),a 545 ld ( 8446h),a576 ld (keyExtend),a 546 577 B_CALL GetKey 547 578 _monForceKey: 548 579 ld (kbdKey),a 580 cp kQuit 581 jr z,doContextSwitch 582 push af 549 583 call CursorOff 550 584 call RunIndicOn 585 pop af 551 586 call _PULLDOWNCHK 587 jr c,RestartMon 588 call clrTR 552 589 jr c,RestartMon 553 590 call CallcxMain 554 591 jr _Mon 592 doContextSwitch: 593 call _newContext0 594 jr RestartMon 595 JForceCmdNoChar: 596 xor a 597 JForceCmd: 598 ld sp,(onSP) 599 ld a,appStart 600 call _newContext0 601 jr _Mon 602 sRAMCleared: 603 DB "RAM cleared",0 604 555 605 CallcxMain: 556 606 push hl -
trunk/page00/display.asm
r49 r55 5 5 PUBLIC _LCD_COMMAND,SetXAutoIncrementMode,SetYAutoIncrementMode,IPutSB,PutMap,ClrScrnFull,ClrTxtShd 6 6 PUBLIC saveTR,restoreTR,showCursor,CursorOff,CursorOn,hideCursor,RunIndicOn,IPutC,_LCD_DRIVERON 7 EXTERN IsAtEditTail,IsAtBtm,LCDDelay,ATimes16,NZIf83Plus 7 PUBLIC RestoreTextShadow,rstrpartialWin,savepartialWin,PutPS 8 EXTERN IsAtEditTail,IsAtBtm,LCDDelay,ATimes16,NZIf83Plus,_GetCharacterBitmap 8 9 9 10 include "includes\os2.inc" 11 12 PutPS: 13 ld b,(hl) 14 $$: inc hl 15 ld a,(hl) 16 call PutC 17 djnz $B 18 ret 19 20 RestoreTextShadow: 21 ld hl,0 22 ld (curRow),hl 23 ld hl,textShadow 24 ld b,127 25 $$: ld a,(hl) 26 inc hl 27 call IPutC 28 djnz $B 29 ld a,(hl) 30 call PutMap 31 rstrpartialWin: 32 ld hl,(textShadCur) 33 ld (curRow),hl 34 ld a,(textShadAlph) 35 ld (flags+shiftFlags),a 36 ld a,(textShadIns) 37 and 0EFh 38 ld hl,flags+textFlags 39 or (hl) 40 ld (hl),a 41 ret 42 savepartialWin: 43 ld hl,(curRow) 44 ld (textShadCur),hl 45 ld a,(winTop) 46 ld (textShadTop),a 47 ld a,(flags+shiftFlags) 48 ld (textShadAlph),a 49 ld a,(flags+textFlags) 50 and 10h 51 ld (textShadIns),a 52 ret 10 53 11 54 _LCD_DRIVERON: … … 83 126 jr endTR 84 127 85 PutMap:86 push hl87 ld hl,(curRow)88 push hl89 call PutC90 pop hl91 ld (curRow),hl92 pop hl93 ret94 95 128 restoreTR: 96 129 bit indicInUse,(iy+indicFlags) … … 255 288 256 289 EraseEOL: 257 ld hl,(curRow) 290 push af 291 push bc 292 push de 258 293 push hl 259 294 ld a,(curCol) 295 push af 296 sub 16 297 jr nc,EraseEOL_1 298 neg 260 299 ld b,a 261 ld a,16 262 sub b 263 ld b,a 264 $$: ld a,' ' 265 push bc 266 call PutC 267 pop bc 300 ld a,' ' 301 dec b 302 jr z,EraseEOL_2 303 $$: call PutC 268 304 djnz $B 269 pop hl 270 ld (curRow),hl 271 ret 272 273 ;TODO: get this using a built-in font table instead of this boot code hack 305 EraseEOL_2: 306 call PutMap 307 ; ei 308 EraseEOL_1: 309 pop af 310 ld (curCol),a 311 pop hl 312 pop de 313 pop bc 314 pop af 315 ret 316 317 newLine: 318 push af 319 ld a,(curRow) 320 inc a 321 ld (curRow),a 322 xor a 323 ld (curCol),a 324 pop af 325 ret 326 274 327 PutC: 328 push af 329 push hl 330 cp 0D6h 331 jr nz,$F 332 call EraseEOL 333 call newLine 334 ld a,(winBtm) 335 ld l,a 336 ld a,(curRow) 337 cp l 338 jr nc,PutC_Done 339 ld a,3Ah 340 $$: call PutMap 341 res 0,(iy+8) 342 ld hl,curCol 343 inc (hl) 344 ld a,(hl) 345 cp 16 346 call nc,newLine 347 PutC_Done: 348 pop hl 349 pop af 350 ret 351 352 PutMap: 275 353 push af 276 354 push bc … … 282 360 call GetTextShadowOffset 283 361 ld (hl),a 284 $$: ld b,a 362 $$: or a 363 jr z,$F 364 cp 0F5h 365 jr c,PutMap_1 366 $$: ld a,0D0h 367 PutMap_1: 368 ld l,a 369 ld h,0 370 add hl,hl 371 add hl,hl 372 add hl,hl 373 call _GetCharacterBitmap 374 push hl 375 pop ix 376 ld a,(curRow) 377 add a,a 378 add a,a 379 add a,a 380 add a,80h 381 ld (curXRow),a 382 ld a,(curCol) 383 and 1Fh 384 add a,20h 385 ld b,a 386 xor a 387 call LCDDelay 388 out (LCDinstPort),a 389 ld a,(curXRow) 390 call SetLCDRow 391 call SetXAutoIncrementMode 392 ld a,b 393 call LCDDelay 394 out (LCDinstPort),a 395 ld b,8 396 PutMap_Loop1: 397 xor a 398 dec b 399 jr z,$F 400 ld a,(ix+0) 401 inc ix 402 $$: inc b 403 sla a 404 bit textInverse,(iy+textFlags) 405 jr z,PutMap_3 406 xor 3Eh 407 PutMap_4:push af 408 ld a,(curCol) 409 and 1Fh 410 jr z,PutMap_2 411 add a,1Fh 412 call LCDDelay 413 out (LCDinstPort),a 414 call SetLCDRow_1 415 or 1 416 bit 0,(iy+8) 417 jr z,$F 418 and 3Eh 419 $$: call LCDDelay 420 out (LCDdataPort),a 421 ld a,(curCol) 422 and 1Fh 423 add a,20h 424 call LCDDelay 425 out (LCDinstPort),a 426 call SetLCDRow_2 427 PutMap_2: 428 pop af 429 jr PutMap_5 430 PutMap_3: 431 bit 0,(iy+8) 432 jr nz,PutMap_4 433 PutMap_5: 434 call LCDDelay 435 out (LCDdataPort),a 436 djnz PutMap_Loop1 437 ld a,1 438 call LCDDelay 439 out (LCDinstPort),a 440 COMMENT ~ 441 ld b,a 285 442 in a,(6) 286 443 push af … … 318 475 ld a,b 319 476 out (6),a 477 ~ 320 478 pop ix 321 479 pop hl 322 480 pop de 323 481 pop bc 482 pop af 483 ret 484 SetLCDRow_1: 485 call LCDDelay 486 in a,(LCDdataPort) 487 call LCDDelay 488 in a,(LCDdataPort) 489 SetLCDRow_2: 490 push af 491 ld a,(curXRow) 492 add a,8 493 sub b 494 call SetLCDRow 495 call SetXAutoIncrementMode 324 496 pop af 325 497 ret -
trunk/page00/home.asm
r48 r55 5 5 6 6 PUBLIC homescreenContextVectors,InitHomescreenContext 7 EXTERN DispHexA,DispHexHL,GetHexA,GetHexHL,AppInit 7 EXTERN DispHexA,DispHexHL,GetHexA,GetHexHL,AppInit,RestoreTextShadow 8 8 9 9 InitHomescreenContext: … … 22 22 ld hl,homescreenContextVectors 23 23 call AppInit 24 B_CALL ClrLCDFull 24 call RestoreTextShadow 25 set appTextSave,(iy+appFlags) 26 set curAble,(iy+curFlags) 27 set curOn,(iy+curFlags) 28 ld hl,menuCurrent 29 ld (hl),0 25 30 ret 26 31 -
trunk/page00/intmisc.asm
r47 r55 40 40 dec (hl) 41 41 ret nz 42 ld a,lcdTurnOff43 out (LCDinstPort),a44 42 call SaveOScreen 45 43 res apdRunning,(iy+apdFlags) -
trunk/page00/jumptable.asm
r32 r55 4 4 include "includes\os2.inc" 5 5 6 PUBLIC _OutputProtectedPort,Page0Call 6 PUBLIC _OutputProtectedPort,Page0Call,_GetCharacterBitmap 7 7 PUBLIC _HandleUSBACablePluggedIn,_HandleUSBBCablePluggedIn,_HandleUSBACableUnplugged,_HandleUSBBCableUnplugged 8 8 PUBLIC _HandleUSBInterruptInitialize,_HandleDefaultUSBInterrupt,_ReadUSBInterruptData 9 EXTERN OutputProtectedPort 9 EXTERN OutputProtectedPort,GetCharacterBitmap 10 10 EXTERN HandleUSBACablePluggedIn,HandleUSBBCablePluggedIn,HandleUSBACableUnplugged,HandleUSBBCableUnplugged 11 11 EXTERN HandleUSBInterruptInitialize,HandleDefaultUSBInterrupt,ReadUSBInterruptData … … 60 60 DW OutputProtectedPort 61 61 DB 7Ch 62 _GetCharacterBitmap: 63 call Page0Call 64 DW GetCharacterBitmap 65 DB 01h 62 66 _HandleUSBACablePluggedIn: 63 67 call Page0Call -
trunk/page00/mathcore.asm
r53 r55 4 4 include "includes\os2.inc" 5 5 6 PUBLIC OP1ToOP4,OP1ToOP2,MovToOP1,EquToOP1,MovFrOP1 6 PUBLIC OP1ToOP4,OP1ToOP2,MovToOP1,EquToOP1,MovFrOP1,Mov8B 7 7 8 8 OP1ToOP4: -
trunk/page00/menu.asm
r48 r55 4 4 include "includes\os2.inc" 5 5 6 PUBLIC _PULLDOWNCHK 6 PUBLIC _PULLDOWNCHK,clrTR 7 EXTERN savepartialWin,rstrpartialWin,RestoreTextShadow,PutS,LdHLInd,PutPS,EraseEOL,PutC 7 8 8 9 _PULLDOWNCHK: 9 10 ;Key code is in A. Check to see if it's a menu key and back out if not, otherwise handle it. 10 11 ;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 12 ;In other words return carry flag set if you're handling this keypress. 13 cp kInputDone 14 jr nz,$F 15 skipKey: 16 or a 17 ret 18 $$: call IsSystemMenuKey 19 jr c,HandleSystemMenuKey 20 call IsInCatalogMenu 21 jr z,skipKey 22 call IsInMenu 23 jr nz,HandleMenuOpenKey 24 MenuCatCommon: 25 cp appStart 26 jr c,skipKey 27 ; cp echoStart1 28 ; call c,RestoreOldContext 29 cp kQuit 30 jr z,skipKey 31 or a 32 ret 33 HandleSystemMenuKey: 34 ; call IsInMenu 35 ; jr nz,keyHandled 36 ld c,(iy+menuFlags) 37 res useCustomDisplay,(iy+menuFlags) 38 cp kExtendEcho 39 jr nz,$F 40 ld b,a 41 ld a,(keyExtend) 42 cp k2Tools 43 ld a,b 44 jr z,SetupMenuCustom 45 jr skipKey 46 $$: cp kAppsMenu 47 jr z,SetupMenu 48 skipSystemKey: 49 ld (iy+menuFlags),c 50 or a 51 ret 52 xor a 53 SetupMenuCustom: 54 set useCustomDisplay,(iy+menuFlags) 55 SetupMenu: 56 push af 57 ld a,(flags+curFlags) 58 ld (curFlagsBackup),a 59 res appTextSave,(iy+appFlags) 60 res curAble,(iy+curFlags) 61 res curOn,(iy+curFlags) 62 ld a,(menuCurrent) 63 or a 64 call z,savepartialWin 65 pop af 66 cp kExtendEcho 67 jr nz,$F 68 ld a,(keyExtend) 69 jr hsmk1 70 $$: sub 2Ah ;menuStart-1 71 hsmk1: ld (menuCurrent),a 72 ld hl,0 73 ld (menuCurrent+1),hl 74 B_CALL ClrLCDFull 75 ld hl,0 76 ld (curRow),hl 77 call GetMenuPointer 78 ld a,(hl) 79 ld (numHeaders),a 80 ld a,(menuCurrent+1) 81 ld b,a 82 inc b 83 $$: inc hl 84 djnz $B 85 ld a,(hl) 86 ld (numItemsForThisHeader),a 87 xor a 88 ld (menuCurrent+2),a 89 call DisplayMenu 90 keyHandled: 91 scf 92 ret 93 HandleMenuOpenKey: 94 cp kLeft 95 jr nz,notLeft 96 call DisplayMenu 97 jr keyHandled 98 notLeft: 99 cp kRight 100 jr nz,notRight 101 call DisplayMenu 102 jr keyHandled 103 notRight: 104 cp kUp 105 jr nz,notUp 106 call DisplayMenu 107 jr keyHandled 108 notUp: cp kDown 109 jr nz,notDown 110 call DisplayMenu 111 jr keyHandled 112 notDown: 113 cp kEnter 114 jr nz,notEnter 115 ld a,(menuCurrent+2) 116 push af 117 call GetCurrentMenuPointer 118 pop bc 119 ld a,b 120 inc hl 121 or a 122 jr z,$F 123 enterLoop: 124 inc hl 125 inc hl 126 djnz enterLoop 127 $$: bit useCustomDisplay,(iy+menuFlags) 128 jr z,$F 129 ld d,(hl) 130 dec hl 131 ld e,(hl) 132 ex de,hl 133 ld c,(hl) 134 ld b,0 135 add hl,bc 136 inc hl 137 push hl 138 set appTextSave,(iy+appFlags) 139 ld hl,menuCurrent 140 ld (hl),0 141 pop hl 142 jp (hl) 143 $$: ld b,(hl) 144 dec hl 145 ld a,(hl) 146 ld (keyExtend),a 147 or a 148 ld a,b 149 jr z,$F 150 ld a,(keyExtend) 151 ld c,a 152 ld a,b 153 ld (keyExtend),a 154 ld a,c 155 cp 83h 156 jr nz,$F 157 ld a,kExtendEcho 158 jr HandleSystemMenuKey 159 $$: push af 160 call RestoreTextShadow 161 ld a,(curFlagsBackup) 162 ld (flags+curFlags),a 163 set appTextSave,(iy+appFlags) 164 ld hl,menuCurrent 165 ld (hl),0 166 pop af 167 or a 168 ret 169 notEnter: 170 cp kClear 171 jr nz,keyHandled 172 call RestoreTextShadow 173 ld a,(curFlagsBackup) 174 ld (flags+curFlags),a 175 set appTextSave,(iy+appFlags) 176 ld hl,menuCurrent 177 ld (hl),0 178 jr keyHandled 179 IsSystemMenuKey: 180 ;HACK: until we get all the menus between menuStart and menuEnd implemented, we have to hard-code 181 ; which menu keys we support, which for now is just APPS. 182 cp kAppsMenu 183 scf 184 ret z 185 or a 186 ret 187 cp menuEnd+1 188 ret nc 189 cp menuStart 190 ccf 191 ret 192 DisplayMenu: 193 ld a,(menuCurrent+2) 194 ld c,a 195 push bc 196 ld a,1 197 ld (topMenuRow),a 198 B_CALL ClrLCDFull 199 ld hl,0 200 ld (curRow),hl 201 call EraseEOL 202 call DisplayMenuHeader 203 call GetCurrentMenuPointer 204 pop bc 205 ld a,(numItemsForThisHeader) 206 or a 207 jr z,noItems 208 ld a,c 209 sla a 210 ld e,a 211 ld d,0 212 add hl,de 213 call DispMenuChoices 214 ld a,(topMenuRow) 215 jr $F 216 noItems: 217 ld a,1 218 $$: ld (curRow),a 219 ret 220 DispMenuChoices: 221 ld a,(topMenuRow) 222 DispMenuChoicesLoop: 223 ld (curRow),a 224 call DisplayCurMenuNumColonArrow 225 ld d,(hl) 226 inc hl 227 ld e,(hl) 228 inc hl 229 push hl 230 push bc 231 call DisplayMenuItem 232 pop bc 233 pop hl 234 inc c 235 ld a,(numItemsForThisHeader) 236 cp c 237 ret z 238 ret c 239 ld a,(curRow) 240 cp 7 241 ret z 242 inc a 243 jr DispMenuChoicesLoop 244 DisplayMenuItem: 245 bit useCustomDisplay,(iy+menuFlags) 246 jr z,$F 247 ld h,e 248 ld l,d 249 jr dmiDisplay 250 $$: B_CALL KeyToString 251 dmiDisplay: 252 call PutPS 253 ld a,(curCol) 254 cp 15 255 call c,EraseEOL 256 ret 257 DisplayCurMenuNumColonArrow: 258 xor a 259 ld (curCol),a 260 ld a,(menuCurrent+2) 261 cp c 262 jr nz,$F 263 DisplayMenuNumColonArow: 264 set textInverse,(iy+textFlags) 265 $$: ld b,'1' 266 ld a,c 267 ld e,a 268 cp 9 269 jr c,dispLessThan9 270 jr nz,dispHigherThan10 271 ld a,'0' 272 jr displayMenuIndexChar 273 dispSpace: 274 ld a,' ' 275 jr displayMenuIndexChar 276 dispTheta: 277 ld a,5Bh 278 jr displayMenuIndexChar 279 dispHigherThan10: 280 ld a,(menuCurrent) 281 cp 3 282 jr z,dispSpace 283 cp 28h 284 jr z,dispSpace 285 cp 2 286 jr z,dispSpace 287 cp 16 288 jr nz,$F 289 ld a,(menuCurrent+1) 290 or a 291 jr z,dispSpace 292 jr notProgEdit 293 $$: cp 2Ah 294 jr nz,notProgEdit 295 ld a,(menuCurrent+1) 296 cp 2 297 jr z,dispSpace 298 notProgEdit: 299 ld a,e 300 ld b,'7' 301 cp 36 302 jr z,dispTheta 303 jr nc,dispSpace 304 dispLessThan9: 305 add a,b 306 displayMenuIndexChar: 307 call PutC 308 push bc 309 ld a,(topMenuRow) 310 ld b,a 311 ld a,(curRow) 312 cp b 313 pop bc 314 jr nz,$F 315 ld a,e 316 or a 317 jr z,dispColon 318 ld a,1Eh 319 jr dispArrowColon 320 $$: cp 7 321 jr nz,dispColon 322 ld a,(numItemsForThisHeader) 323 dec a 324 cp e 325 ld a,1Fh 326 jr z,dispColon 327 jr nc,dispArrowColon 328 dispColon: 329 ld a,':' 330 dispArrowColon: 331 call PutC 332 res textInverse,(iy+textFlags) 333 ret 334 GetCurrentMenuPointer: 335 call GetMenuPointer 336 ld a,(menuCurrent+1) 337 or a 338 ld b,a 339 ld a,(hl) 340 ld c,a 341 jr z,$F 342 push hl 343 gcmpLoop: 344 inc hl 345 add a,(hl) 346 djnz gcmpLoop 347 pop hl 348 $$: sla a 349 sub c 350 add a,(hl) 351 inc hl 352 ld e,a 353 ld d,0 354 add hl,de 355 ret 356 DisplayMenuHeader: 357 call GetMenuPointer 358 ld a,(hl) 359 ld b,a 360 inc hl 361 inc hl 362 ld a,(hl) 363 ;A is the string index for the header 364 set textInverse,(iy+textFlags) 365 call GetBuiltInString 366 call PutPS 367 res textInverse,(iy+textFlags) 368 ret 369 GetMenuPointer: 370 ld a,(menuCurrent) 371 ld h,0 372 ld l,a 373 add hl,hl 374 ld de,menuTables-2 375 add hl,de 376 jr LdHLInd 377 GetBuiltInString: 378 ld h,0 379 ld l,a 380 add hl,hl 381 ld de,ptrStrings-2 382 add hl,de 383 jr LdHLInd 384 menuTables: 385 DW 0000h 386 DW mntApps 387 DW mntPrograms 388 DW mntTools 389 ;Each table has the following: 390 ; DB bNumberOfHeaders 391 ; DB bNumberOfChoices1 392 ; DB bHeaderStringIndex 393 ; DB keyExtend1,keyCode1 394 ;Custom menu entries also hvae: 395 ; DW wJumpAddress 396 mntPrograms: 397 mntApps: 398 DB 1 399 DB 1 400 DB 01h 401 DB 83h,k2Tools 402 mntTools: 403 DB 1 404 DB 1 405 DB 02h 406 DW HexEditor 407 ptrStrings: 408 DW sApplications 409 DW sTools 410 sApplications: 411 DB sTools-$F 412 $$: DB "APPLICATIONS" 413 sTools: 414 DB sEnd-$F 415 $$: DB "TOOLS" 416 sEnd: 13 417 418 HexEditor: 419 DB $F-HexEditor-1 420 DB "Hex Editor" 421 $$: res curAble,(iy+curFlags) 422 res curOn,(iy+curFlags) 423 res appTextSave,(iy+appFlags) 424 B_CALL ClrLCDFull 425 ld hl,0 426 ld (curRow),hl 427 ld hl,sWelcome 428 call PutS 429 B_CALL GetKey 430 B_JUMP JForceCmdNoChar 431 sWelcome: 432 DB "Welcome to the " 433 DB "hex editor!",0 434 435 clrTR: 436 cp kCatalog 437 jr z,clrTRCatalogPressed 438 call IsInCatalogMenu 439 jr z,DoCatalogKeyPress 440 jr MenuCatCommon 441 clrTRCatalogPressed: 442 DoCatalogKeyPress: 443 scf 444 ret 445 IsInCatalogMenu: 446 ld b,a 447 ld a,(menuCurrent) 448 cp mCatalog 449 ld a,b 450 ret 451 IsInMenu: 452 ld b,a 453 ld a,(menuCurrent) 454 or a 455 ld a,b 456 ret 457 -
trunk/page1D/1Dbase.asm
r47 r55 4 4 PUBLIC _JErrorNo,_UnlockFlash,_GetKey 5 5 EXTERN JErrorNo,UnlockFlash,GetKey,keyscnlnk,Rec1stByteNC,RecAByteIO,MemClear,ClrTxtShd 6 EXTERN ClrLCDFull,PutS,GetCSC,CursorOff,CursorOn,hideCursor,showCursor,ClrScrnFull 6 EXTERN ClrLCDFull,PutS,GetCSC,CursorOff,CursorOn,hideCursor,showCursor,ClrScrnFull,KeyToString 7 EXTERN JForceCmdNoChar,JForceCmd 7 8 8 9 ;4000h: … … 47 48 DW 0000h 48 49 DB 00h 49 ;_JForceCmdNoChar equ 4027h 50 DW 0000h51 DB 00h 52 ;_JForceCmd equ 402Ah ; 53 DW 0000h50 _JForceCmdNoChar: 51 DW JForceCmdNoChar 52 DB 00h 53 _JForceCmd: 54 DW JForceCmd 54 55 DB 00h 55 56 ;_sysErrHandler equ 402Dh ;loads error context? sp=(onSP) … … 1491 1492 DW showCursor 1492 1493 DB 00h 1493 ;_KeyToString equ 45CAh 1494 DW 0000h1495 DB 0 0h1494 _KeyToString: 1495 DW KeyToString 1496 DB 01h 1496 1497 ;_PULLDOWNCHK equ 45CDh ;something wrong here 1497 1498 DW 0000h
