;TI-73 Replacement Boot Code BCALLs ;---------------------------------- ;To replace a boot code BCALL routine, add a label at the start ; of the code for it in the form "x_[NAME OF ENTRY POINT]:". ;The list of names is in the source for Do73Patch.exe and should ; match ti83plus.inc. ;Do not create any other labels in this format. ;This code will run from bank 1 (4000h-7FFFh) and you cannot ; reference memory here (ex. same as _PutS in Flash applications). ; Copy these things to RAM first if necessary. ;The code here should never do more than the equivalent boot code ; routine. The OS and other programs will expect you to abide by this. ;Do not include ".org" statements in this file; the process will ; add one at the beginning of this file. .nolist #include "ti83plus.inc" .list x_00WriteFlash: and 1Fh ld ix,_WriteFlash-4000h jr ExecBootEP x_WriteAByteSafe: and 1Fh ld ix,_WriteAByteSafe-4000h jr ExecBootEP x_FindGroup: and 1Fh ld ix,_FindGroup-4000h jr ExecBootEP x_FindAppHeaderSubField: and 1Fh ld ix,_FindAppHeaderSubField-4000h jr ExecBootEP x_WriteFlashUnsafe: and 1Fh ld ix,_WriteFlashUnsafe-4000h jr ExecBootEP x_EraseFlashPage: and 1Fh ld ix,_EraseFlashPage-4000h jr ExecBootEP x_FindOSHeaderSubField: and 1Fh ld ix,_FindOSHeaderSubField-4000h jr ExecBootEP x_FindSubField: and 1Fh ld ix,_FindSubField-4000h jr ExecBootEP x_GetFieldSize: and 1Fh ld ix,_GetFieldSize-4000h jr ExecBootEP x_FlashToRam2: and 1Fh ld ix,_FlashToRam2-4000h jr ExecBootEP x_LoadAIndPaged: and 1Fh ld ix,_LoadAIndPaged-4000h jr ExecBootEP x_FindGroupedField: and 1Fh ld ix,_FindGroupedField-4000h jr ExecBootEP x_EraseFlash: and 1Fh ld ix,_EraseFlash-4000h jr ExecBootEP x_WriteAByte: and 1Fh ld ix,_WriteAByte-4000h ; call ExecBootEP ; ret ExecBootEP: push hl push de push bc ld hl,_ExecBootEP ld de,ramCode+1+60h ld bc,_ExecBootEPEnd-_ExecBootEP ldir pop bc pop de pop hl ld (ramCode+60h),a in a,(6) push af ld a,1Fh push hl jp ramCode+1+60h _ExecBootEP: out (6),a ld l,(ix+0) ld h,(ix+1) push hl pop ix pop hl ld a,(ramCode+60h) call jpIX-_ExecBootEP+ramCode+1+60h ld (ramCode+60h),a ex (sp),hl ld a,l out (6),a ld a,(ramCode+60h) ex (sp),hl pop ix ret jpIX: jp (ix) _ExecBootEPEnd: x_ProdNrPart1: ld de,0004h ret x_cmpStr: xor a ret x_GetBootVer: xor a ld b,1 ret x_DispBootVer: ld hl,0 ld (curRow),hl ld hl,sBootCodeText PutS: ld a,(hl) or a ret z bcall(_PutC) inc hl jr PutS sBootCodeText: .db "BOOT Code 0.02b",0 x_Div16By8: ld d,0 x_Div16By16: ld a,d or e ret z xor a ld ix,8251h ld (ix+0),l ld (ix+1),h ld h,a ld l,a ld (ix+2),a ld b,16 div16By8Loop: sla (ix+0) rl (ix+1) rl l rl h rl (ix+2) or a sbc hl,de ld a,(ix+2) sbc a,0 ld (ix+2),a jp p,div16By8_1 add hl,de ld a,(ix+2) adc a,0 ld (ix+2),a jr div16By8_2 div16By8_1: set 0,(ix+0) div16By8_2: djnz div16By8Loop ld e,(ix+0) ld d,(ix+1) ret x_Div32By16: ld a,d or e ret z ld ix,8251h ld a,(OP1) ld (ix+3),a ld a,(OP1+1) ld (ix+2),a ld a,(OP1+2) ld (ix+1),a ld a,(OP1+3) ld (ix+0),a xor a ld (OP1),a ld (OP1+1),a ld (OP1+2),a ld (OP1+3),a ld b,32 div32Loop: sla (ix+0) rl (ix+1) rl (ix+2) rl (ix+3) ld ix,OP1 rl (ix+0) rl (ix+1) rl (ix+2) rl (ix+3) ld ix,8251h or a ld hl,(OP1) sbc hl,de ld (OP1),hl ld hl,(OP1+2) push bc ld bc,0 sbc hl,bc pop bc ld (OP1+2),hl jr nc,div32_1 or a ld hl,(OP1) adc hl,de ld (OP1),hl ld hl,(OP1+2) push bc ld bc,0 adc hl,bc ld (OP1+2),hl pop bc jr div32_2 div32_1:set 0,(ix+0) div32_2:djnz div32Loop ld ix,OP1 ld h,(ix+2) ld l,(ix+3) ld (OP2),hl ld h,(ix+0) ld l,(ix+1) ld (OP2+2),hl ld ix,8251h ld h,(ix+2) ld l,(ix+3) ld (OP1),hl ld h,(ix+0) ld l,(ix+1) ld (OP1+2),hl ret .end end