├── Bugs Blooper ├── Weirdbug.mp4 ├── bugequ.png ├── bugscreen.png ├── bugscreen2.png ├── bugscreen3.png └── bugscreen4.png ├── HowToUse.mp4 ├── LICENSE ├── PHASM.8XP ├── PHASM.8xg ├── PHASM.gif ├── README.MD └── SRC ├── PHASM.8XG ├── Group.z80 ├── InstantGoto.z80 ├── editMem.z80 ├── editor.z80 ├── executor.z80 └── parserHook.z80 └── PHASM.8XP ├── AppVar.z80 └── PHASM.z80 /Bugs Blooper/Weirdbug.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MathisLav/PHASM/4e8d83bb1169497cecae81ffd8e2b3ace01f63a7/Bugs Blooper/Weirdbug.mp4 -------------------------------------------------------------------------------- /Bugs Blooper/bugequ.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MathisLav/PHASM/4e8d83bb1169497cecae81ffd8e2b3ace01f63a7/Bugs Blooper/bugequ.png -------------------------------------------------------------------------------- /Bugs Blooper/bugscreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MathisLav/PHASM/4e8d83bb1169497cecae81ffd8e2b3ace01f63a7/Bugs Blooper/bugscreen.png -------------------------------------------------------------------------------- /Bugs Blooper/bugscreen2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MathisLav/PHASM/4e8d83bb1169497cecae81ffd8e2b3ace01f63a7/Bugs Blooper/bugscreen2.png -------------------------------------------------------------------------------- /Bugs Blooper/bugscreen3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MathisLav/PHASM/4e8d83bb1169497cecae81ffd8e2b3ace01f63a7/Bugs Blooper/bugscreen3.png -------------------------------------------------------------------------------- /Bugs Blooper/bugscreen4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MathisLav/PHASM/4e8d83bb1169497cecae81ffd8e2b3ace01f63a7/Bugs Blooper/bugscreen4.png -------------------------------------------------------------------------------- /HowToUse.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MathisLav/PHASM/4e8d83bb1169497cecae81ffd8e2b3ace01f63a7/HowToUse.mp4 -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 2 | Version 2, December 2004 3 | 4 | Copyright (C) 2004 Sam Hocevar 5 | 6 | Everyone is permitted to copy and distribute verbatim or modified 7 | copies of this license document, and changing it is allowed as long 8 | as the name is changed. 9 | 10 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 11 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 12 | 13 | 0. You just DO WHAT THE FUCK YOU WANT TO. 14 | -------------------------------------------------------------------------------- /PHASM.8XP: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MathisLav/PHASM/4e8d83bb1169497cecae81ffd8e2b3ace01f63a7/PHASM.8XP -------------------------------------------------------------------------------- /PHASM.8xg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MathisLav/PHASM/4e8d83bb1169497cecae81ffd8e2b3ace01f63a7/PHASM.8xg -------------------------------------------------------------------------------- /PHASM.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MathisLav/PHASM/4e8d83bb1169497cecae81ffd8e2b3ace01f63a7/PHASM.gif -------------------------------------------------------------------------------- /README.MD: -------------------------------------------------------------------------------- 1 | # PHASM 2 | 3 | ### Features: 4 | * Works on the TI-84+CE and TI-83 Premium CE 5 | * Executes archived (sub-)programs 6 | * Executes assembly (sub-)programs (without the `Asm(` prefix) 7 | * Allows you to jump to any Lbl you want by pressing `[Alpha]`+`[X,T,O,n]` in the program editor 8 | * Allows you to edit archived programs 9 | * Built-in Memory Editor: just press `[Alpha]`+`[VARS]` to edit an AppVar or the raw memory (PLEASE READ THE MEMEDIT-README) 10 | * Languages available: English and French. Feel free to ask if you want another one! 11 | 12 | ### Setup: 13 | To use PHASM, send PHASM.8XG and PHASM.8XP to your calculator, with TI-Connect CE for instance. You don't need to ungroup PHASM.8XG. 14 | Then, run `Asm(prgmPHASM)` and that's all there is to it! 15 | To uninstall PHASM, just run prgmPHASM. 16 | _/!\\ Do not delete or archive the AppVar created during the installation. It will trigger an error each time you will need it /!\\_ 17 | 18 | ## New: 19 | * You'll not see anymore some weird programs like `prgmTTEMP` in your Program List! 20 | * If you choose to set your calculator to French, PHASM will detect it and display French texts 21 | * Several bugs fixed (TXTLIB bug, memory leaks, vars corruption) 22 | * Added a Memory Editor 23 | * ERRORS: You can now choose "GoTo" at an error screen even if the program you want to edit is archived 24 | * Optimizations... 25 | 26 | Have fun! 27 | 28 | 29 | ------------------ 30 | 31 | # MEMORY EDITOR 32 | The Memory Editor allows you to edit the memory of your calculator easily. 33 | To display the menu which will enable you to edit AppVars (archived or not) or to begin the edition wherever you want, you just have to press `[Alpha]`+`[VARS]`. 34 | 35 | ### Keys (in the editor) : 36 | * **Up**/**Down**/**Left**/**Right**: moves the cursor 37 | * **Alpha** + **up**/**down**: scrolls faster 38 | * **1**/**2**/**6**/**3**/**4**/**5**/**6**/**7**/**8**/**9**/**0**/**A**/**B**/**C**/**D**/**E**/**F** : inserts a number at the cursor location 39 | 40 | 41 | BE AWARE THAT THE AUTHOR IS NOT RESPONSIBLE IN CASE OF LOSS OF MEMORY DUE TO THE WAY YOU USE THIS PROGRAM. So be careful when editing Flags, VAT or Memory-Mapped ports. 42 | 43 | This program is licensed under [the WTFPL](LICENSE). 44 | -------------------------------------------------------------------------------- /SRC/PHASM.8XG/Group.z80: -------------------------------------------------------------------------------- 1 | .nolist 2 | #include "ti84pce.inc" 3 | #macro bcall(x) 4 | call x 5 | #endmacro 6 | #DEFINE sizeHomeScreenHook 853 7 | #DEFINE sizeInstantGoto 1214 8 | #DEFINE AppvarSize 4158 9 | #DEFINE editArchivedProgFlag 7 10 | .list 11 | 12 | ret 13 | #include "executor.z80" 14 | #include "editor.z80" 15 | #include "InstantGoto.z80" 16 | #include "parserHook.z80" 17 | 18 | .echo "HomescreenHook Group : ", endHSHook - beginHomescreenHook, " bytes" 19 | .echo "MenuHook Group : ", endMenuHook - beginMenuHook, " bytes" 20 | .echo "GetCSCHook Group : ", endGetkeyHook - beginGetkeyHook, " bytes" 21 | .echo "ParserHook Group : ", endParserHook - beginParserHook, " bytes\n" 22 | .end -------------------------------------------------------------------------------- /SRC/PHASM.8XG/InstantGoto.z80: -------------------------------------------------------------------------------- 1 | ; ***************************** Instant GoTo ***************************** ; 2 | ; It displays a menu which allows you to jump to the label you want if [Alpha] + [X,T,O,N] are pressed 3 | 4 | 5 | beginGetkeyHook: 6 | .db 83h ; All hooks begin with .db 83h 7 | cp 1Bh ; we check if the OS called the hook because a key has been pressed 8 | ret nz 9 | 10 | ld a,b ; A = key 11 | cp skVars 12 | jr nz,notVarsKey 13 | ld hl,sizeHomeScreenHook+sizeInstantGoto + 2 14 | ld bc,AppvarSize-sizeHomeScreenHook-sizeInstantGoto 15 | jr jumpToAppVar 16 | notVarsKey: 17 | cp skGraphvar 18 | ret nz 19 | ld hl,sizeHomeScreenHook + 2 ; addr after Homescreen Hook (2 = size bytes) 20 | ld bc,sizeInstantGoto 21 | 22 | jumpToAppVar: 23 | bit shiftAlpha, (iy+shiftFlags) 24 | jr z,quitGKHook+1 25 | res shiftAlpha, (iy+shiftFlags) 26 | push bc 27 | push hl 28 | call _op1ToOp5 ; Saving the name of the program edited (for Instant Goto) 29 | call _zeroop1 30 | ld a,AppVarObj ; We obtain the address of the code (in PH AppVar) 31 | ld (OP1),a 32 | ld a,'P' 33 | ld (OP1+1),a 34 | ld a,'H' 35 | ld (OP1+2),a 36 | call _ChkFindSym 37 | pop hl 38 | jr c,quitGKHook 39 | call _chkinram 40 | jr nz,quitGKHook 41 | add hl,de 42 | push hl 43 | call _op5toOp1 44 | 45 | pop hl 46 | ld de,$D052C6+4000 47 | pop bc 48 | ldir 49 | ld hl,$D052C6+4000 50 | jp (hl) 51 | 52 | quitGKHook: 53 | pop bc 54 | and a 55 | ret 56 | endGetkeyHook: -------------------------------------------------------------------------------- /SRC/PHASM.8XG/editMem.z80: -------------------------------------------------------------------------------- 1 | .org $D052C6+4000 2 | menuAPPVAR: 3 | xor a 4 | ld (wintop),a 5 | ld (nbrAVIgnore),a 6 | ld hl,$000101 7 | ld (currentItemNum),hl 8 | dec h 9 | dec l 10 | ld (drawFGColor),hl 11 | 12 | call _cursorOff 13 | call _clrlcdfull 14 | call _homeup 15 | ld hl,AV_HEADER 16 | set textInverse, (IY+textFlags) 17 | call _puts 18 | res textInverse, (IY+textFlags) 19 | call _puts 20 | call _puts 21 | 22 | storeAppVarsNames: 23 | ld hl,(progPtr) 24 | ld de,namesBuf 25 | push de 26 | loopNextAppV: 27 | ex de,hl 28 | ld hl,(OPBase) 29 | or a 30 | sbc hl,de 31 | jr nc,lastElement 32 | ex de,hl 33 | 34 | ld a,(hl) 35 | ld de,-6 36 | add hl,de 37 | cp AppVarObj 38 | jr z,AppVarFound 39 | ld a,(hl) 40 | inc a 41 | ld de,0 42 | ld e,a 43 | or a 44 | sbc hl,de 45 | jr loopNextAppV 46 | AppVarFound: 47 | pop de 48 | push de 49 | ld a,8 50 | ld (de),a 51 | ld b,(hl) 52 | push bc 53 | inc de 54 | dec hl 55 | cpyNameToBuf: 56 | ld a,(hl) 57 | ld (de),a 58 | inc de 59 | dec hl 60 | djnz cpyNameToBuf 61 | ld a,' ' 62 | ld (de),a 63 | pop bc 64 | ld a,8 65 | sub a,b 66 | push hl 67 | push de 68 | pop hl 69 | inc de 70 | ldir 71 | pop de 72 | 73 | pop hl 74 | ld bc,9 75 | add hl,bc 76 | push hl 77 | ld hl,nbrElements 78 | inc (hl) 79 | ex de,hl 80 | jr loopNextAppV 81 | lastElement: 82 | pop hl 83 | set emptyMenu, (IY+asm_flag3) 84 | ld a,(nbrElements) 85 | or a 86 | jr z,mainloop 87 | res emptyMenu, (IY+asm_flag3) 88 | 89 | dispAppVarsNames: 90 | call _homeup 91 | ld hl,namesBuf 92 | ld a,(nbrAVIgnore) 93 | ld c,a 94 | ld e,'0' 95 | add a,e 96 | ld e,a 97 | ld b,9 98 | mlt bc 99 | add hl,bc 100 | ld a,(nbrElements) 101 | cp 10 102 | jr c,lessThan9El 103 | ld a,9 104 | lessThan9El: 105 | ld b,a 106 | ld a,e 107 | listAppVars: 108 | push hl 109 | call _newline 110 | inc a 111 | ld e,a 112 | ld c,30h 113 | sub a,c 114 | ld d,a 115 | ld a,(currentItemNum) 116 | cp d 117 | jr nz,notCurrentItem 118 | set textInverse, (IY+textFlags) 119 | notCurrentItem: 120 | ld a,e 121 | push af 122 | cp '9'+1 123 | jr c,dispNum 124 | ld a,' ' 125 | dispNum: 126 | call _putC 127 | ld a,':' 128 | call _putC 129 | res textInverse, (IY+textFlags) 130 | push bc 131 | call _putPS 132 | pop bc 133 | pop af 134 | pop hl 135 | ld de,9 136 | add hl,de 137 | djnz listAppVars 138 | 139 | mainloop: 140 | call _getkey 141 | bit emptyMenu, (IY+asm_flag3) 142 | jr nz,noItem 143 | cp kDown 144 | jr z,menuDown 145 | cp kUp 146 | jr z,menuUp 147 | cp kAlphaDown 148 | jr z,menuDown 149 | cp kAlphaUp 150 | jr z,menuUp 151 | cp kEnter 152 | jp z,EditMemory 153 | cp k1 154 | jr nc,selectItemNum 155 | noItem: 156 | cp kLeft 157 | jp z,editByAddress 158 | cp kRight 159 | jp z,editByAddress 160 | cp kQuit 161 | jr z,quitMemEdit 162 | cp kClear 163 | jr nz,mainloop 164 | quitMemEdit: 165 | call _setupHome 166 | jp _JForceCMDNoChar 167 | 168 | selectItemNum: 169 | cp k9+1 170 | jr nc,mainloop 171 | ld b,8Eh 172 | sub a,b 173 | ld hl,(nbrElements) 174 | inc l 175 | cp l 176 | jr nc,mainloop 177 | ld (currentItemNum),a 178 | jp EditMemory 179 | 180 | menuDown: 181 | ld hl,currentItemNum 182 | ld a,(nbrElements) 183 | cp (hl) 184 | jr z,mainloop 185 | inc (hl) 186 | ld a,(nbrAVIgnore) 187 | ld b,10 188 | add a,b 189 | cp (hl) 190 | jr nz,drawNums 191 | ld hl,nbrAVIgnore 192 | inc (hl) 193 | jp dispAppVarsNames 194 | menuUp: 195 | ld hl,currentItemNum 196 | ld a,(hl) 197 | cp 1 198 | jp z,mainloop 199 | dec (hl) 200 | ld a,(nbrAVIgnore) 201 | cp (hl) 202 | jr nz,drawNums 203 | ld hl,nbrAVIgnore 204 | dec (hl) 205 | jp dispAppVarsNames 206 | drawNums: 207 | call _homeup 208 | ld a,(nbrElements) 209 | cp 10 210 | jr c,lessThan9El2 211 | ld a,9 212 | lessThan9El2: 213 | ld b,a 214 | ld c,'0' 215 | ld a,(nbrAVIgnore) 216 | add a,c 217 | push af 218 | set textEraseBelow, (IY+textFlags) 219 | drawNumsLoop: 220 | call _newline 221 | pop af 222 | inc a 223 | push af 224 | ld c,a 225 | ld e,30h 226 | sub a,e 227 | cp (hl) 228 | jr nz,notCurrent 229 | set textInverse, (IY+textFlags) 230 | notCurrent: 231 | ld a,c 232 | cp '9'+1 233 | jr c,dispNum2 234 | ld a,' ' 235 | dispNum2: 236 | set 0,(iy+$08) 237 | call _putC 238 | ld a,':' 239 | call _putC 240 | res textInverse, (IY+textFlags) 241 | djnz drawNumsLoop 242 | pop af 243 | jp mainloop 244 | 245 | editByAddress: 246 | call _clrlcdfull 247 | call _homeup 248 | ld hl,AV_HEADER 249 | call _puts 250 | call _puts 251 | set textInverse, (IY+textFlags) 252 | call _puts 253 | res textInverse, (IY+textFlags) 254 | 255 | call _newline 256 | ld hl,(localLanguage) 257 | ld de,$02010C ; if French 258 | or a 259 | sbc hl,de 260 | ld hl,ENTER_address 261 | jr nz,ADDRisEN 262 | ld hl,ENTER_addressFR 263 | ADDRisEN: 264 | call _puts 265 | set fracDrawLFont, (iy+fontFlags) 266 | call INPUT_addr 267 | jp z,menuAPPVAR 268 | set baseADDR, (iy+asm_flag3) 269 | res archivedAV, (iy+asm_flag3) 270 | call _clrlcdfull 271 | ld hl,0 272 | ld (currow),hl 273 | ld hl,ADDR_txt 274 | call _puts 275 | ld a,':' 276 | call _putC 277 | ld hl,BufAddrASCII 278 | call _puts 279 | jp dispBody 280 | 281 | INPUT_addr: 282 | ; INPUT : 283 | ; - fstElWin and BufAddrASCII must be 0 284 | ; OUPUT : 285 | ; - fstElWin and BufAddrASCII are the address 286 | ld hl,0 287 | ld (fstElWin),hl 288 | ld hl,BufAddrASCII 289 | push hl 290 | ld (hl),'0' 291 | ld de,BufAddrASCII+1 292 | ld bc,5 293 | ldir 294 | pop hl 295 | call _putS 296 | ld a,10 297 | ld (curcol),a 298 | ld bc,BufAddrASCII 299 | ld de,fstElWin+2 300 | INPUT_loop: 301 | call _getcsc 302 | cp skLeft 303 | ret z 304 | cp skRight 305 | ret z 306 | cp skDel 307 | jr z,INPUT_del 308 | cp 12h 309 | jr nc,INPUT_put 310 | cp skEnter 311 | jr z,INPUT_end 312 | cp skClear 313 | jr nz,INPUT_loop 314 | ; quit the menu 315 | pop ix 316 | jp quitMemEdit 317 | INPUT_end: 318 | or a 319 | ret 320 | 321 | INPUT_del: 322 | ; INPUT : 323 | ; - (BC) = address to delete the ASCII number 324 | ; - (DE) = address to delete the 4bits number 325 | ; - Flag secNibble = MSB=1 / LSB=0 326 | ; OUPUT : 327 | ; - Flag secNibble inverted 328 | ; - DE decremented if secNibble=1 329 | ; - BC incremented 330 | ; - screen updated 331 | ld hl,curcol 332 | ld a,10 333 | cp (hl) 334 | jr z,INPUT_loop 335 | dec (hl) 336 | dec bc 337 | ld a,'0' 338 | ld (bc),a 339 | call _putMap 340 | bit secNibble, (iy+asm_flag3) 341 | jr z,INPUT_decAddr 342 | res secNibble, (iy+asm_flag3) 343 | ld a,(de) 344 | and %00001111 345 | ld (de),a 346 | jr INPUT_loop 347 | INPUT_decAddr: 348 | set secNibble, (iy+asm_flag3) 349 | inc de 350 | ld a,(de) 351 | and %11110000 352 | ld (de),a 353 | jr INPUT_loop 354 | 355 | INPUT_put: 356 | ; INPUT : 357 | ; - A = key 358 | ; - (DE) = address to insert 4bits number 359 | ; - BC = address to store the ASCII number 360 | ; - Flag secNibble = MSB=1 / LSB=0 361 | ; OUPUT : 362 | ; - Flag secNibble inverted 363 | ; - DE decremented if secNibble=1 364 | ; - BC incremented 365 | cp 30h 366 | jr nc,INPUT_loop 367 | ld hl,fstElWin-1 368 | or a 369 | sbc hl,de 370 | jr z,INPUT_loop 371 | ld l,12h 372 | sub a,l 373 | ld hl,LUT_keyToVal 374 | push de 375 | ld de,0 376 | ld e,a 377 | add hl,de 378 | pop de 379 | ld a,(hl) 380 | cp -1 381 | jr z,INPUT_loop 382 | push af 383 | 384 | ld l,a 385 | ld a,%11110000 386 | bit secNibble, (IY+asm_flag3) 387 | jr nz,INPUT_changeLSBs 388 | ld a,%00001111 389 | sla l 390 | sla l 391 | sla l 392 | sla l 393 | INPUT_changeLSBs: 394 | ex de,hl 395 | and (hl) 396 | or e 397 | ld (hl),a 398 | ex de,hl 399 | 400 | pop af 401 | ld l,30h 402 | add a,l 403 | cp 3Ah 404 | jr c,INPUT_NaL ; not a letter 405 | ld l,7 406 | add a,l 407 | INPUT_NaL: 408 | ld (bc),a 409 | inc bc 410 | call _putC 411 | bit secNibble, (iy+asm_flag3) 412 | jr z,INPUT_fstNibble 413 | res secNibble, (iy+asm_flag3) 414 | dec de 415 | jp INPUT_loop 416 | INPUT_fstNibble: 417 | set secNibble, (iy+asm_flag3) 418 | jp INPUT_loop 419 | 420 | 421 | EditMemory: 422 | ; INPUT : 423 | ; - AppVar to edit = (currentItemNum)*9+namesBuf 424 | ; OUTPUT : 425 | ; - Memory edited 426 | res baseADDR, (iy+asm_flag3) 427 | ld a,(currentItemNum) 428 | dec a 429 | ld hl,0 430 | ld l,a 431 | ld h,9 432 | mlt hl 433 | ld de,namesBuf 434 | add hl,de 435 | ld a,AppVarObj 436 | ld (OP1),a 437 | ld de,OP1+1 438 | ld bc,8 439 | inc hl 440 | ldir 441 | ld hl,OP1 442 | findEndName: 443 | inc hl 444 | ld a,(hl) 445 | cp ' ' 446 | jr nz,findEndName 447 | ld (hl),0 448 | ld a,b 449 | cp 16 450 | jr c,not8CharNm 451 | ld a,15 452 | not8CharNm: 453 | 454 | call _op1toop6 455 | res archivedAV, (IY+asm_flag3) 456 | call _chkfindsym 457 | call _chkInRam 458 | jr z,AVinRam 459 | call _ARC_UNARC 460 | set archivedAV, (IY+asm_flag3) 461 | AVinRam: 462 | inc de 463 | inc de 464 | ld (fstElWin),de 465 | 466 | call _clrScrn 467 | call _homeup 468 | ld hl,AV_TITLE 469 | call _puts 470 | xor a 471 | ld (OP1+9),a 472 | ld hl,OP1+1 473 | call _puts 474 | dispBody: 475 | ; We check the type of calculator (there's some differences concerning outputs of getkey) 476 | res isTi84CE, (iy+asm_flag3) 477 | call _boot_GetCertCalcString 478 | inc hl 479 | inc hl 480 | inc hl 481 | inc hl 482 | ld a,(hl) 483 | cp '3' 484 | jr z,is83PCE 485 | set isTi84CE, (iy+asm_flag3) 486 | is83PCE: 487 | ld hl,0 488 | ld (cursorDataX),hl 489 | ld (fillRectColor),hl 490 | ld hl,22 491 | ld de,25 492 | ld bc,$40E7 493 | call _FillRect 494 | ld hl,188 495 | ld de,191 496 | call _FillRect 497 | ld hl,300 498 | ld de,303 499 | call _FillRect 500 | res secNibble, (IY+asm_flag3) 501 | 502 | dispData: 503 | res textEraseBelow, (IY+textFlags) 504 | set fracDrawLFont, (IY+fontFlags) 505 | ld de,(fstElWin) 506 | ld a,$44 507 | ld (penrow),a 508 | ld b,7 509 | loopDispRows: 510 | push bc 511 | ld hl,38 512 | ld (pencol),hl 513 | ld b,4 514 | push de 515 | loopDispHexaColumn: 516 | push bc 517 | ld a,(de) 518 | ld hl,OP1 519 | call decToHexaToHL 520 | xor a 521 | ld (OP1+2),a 522 | dec hl 523 | res textEraseBelow, (IY+textFlags) 524 | call _vputs 525 | ld hl,(pencol) 526 | ld bc,14 527 | add hl,bc 528 | ld (pencol),hl 529 | inc de 530 | pop bc 531 | djnz loopDispHexaColumn 532 | 533 | ld a,205 534 | ld (pencol),a 535 | pop de 536 | ld hl,BufDispASCII 537 | push hl 538 | ld b,4 539 | dispACSII: 540 | inc hl 541 | ld a,(de) 542 | ld (hl),a 543 | inc de 544 | inc hl 545 | djnz dispACSII 546 | pop hl 547 | call _vputPS 548 | 549 | ld a,(penrow) 550 | ld b,24 551 | add a,b 552 | ld (penrow),a 553 | pop bc 554 | djnz loopDispRows 555 | 556 | ld de,$000000 557 | call dispEraseCursor 558 | 559 | dispADDR: 560 | res fracDrawLFont, (IY+fontFlags) 561 | ld hl,253 562 | ld (pencol),hl 563 | ld a,40 564 | ld (penrow),a 565 | ld a,'$' 566 | call _vputMap 567 | 568 | ld a,(cursorDataY) 569 | sla a 570 | sla a 571 | ld hl,cursorDataX 572 | add a,(hl) 573 | ld de,0 574 | ld e,a 575 | ld hl,(fstElWin) 576 | add hl,de 577 | call _setAToHLU 578 | ex de,hl 579 | ld hl,OP1 580 | push hl 581 | call decToHexaToHL 582 | ld a,d 583 | inc hl 584 | call decToHexaToHL 585 | ld a,e 586 | inc hl 587 | call decToHexaToHL 588 | inc hl 589 | ld (hl),0 590 | 591 | pop hl 592 | call _vputs 593 | set fracDrawLFont, (IY+fontFlags) 594 | 595 | loopEdit: 596 | call _getkey 597 | or a 598 | jr z,loopEdit 599 | cp kDown 600 | jp z,editDown 601 | cp kUp 602 | jp z,editUp 603 | cp kAlphaDown 604 | jp z,jumpDown 605 | cp kAlphaUp 606 | jp z,jumpUp 607 | cp kLeft 608 | jp z,editLeft 609 | cp kRight 610 | jp z,editRight 611 | cp kEnter 612 | jp z,editRight 613 | 614 | cp k0 615 | jr c,lessThanK0 616 | cp kCapF+1 617 | jp c,editPut 618 | lessThanK0: 619 | ld b,0 620 | cp kSpace 621 | jp z,PUT_suit 622 | inc b 623 | cp kCapY 624 | jr z,PUT_suit 625 | inc b 626 | cp kCapZ 627 | jr z,PUT_suit 628 | inc b 629 | cp kTheta 630 | jr z,PUT_suit 631 | inc b 632 | cp kCapT 633 | jr z,PUT_suit 634 | inc b 635 | cp kCapU 636 | jr z,PUT_suit 637 | inc b 638 | cp kCapV 639 | jr z,PUT_suit 640 | inc b 641 | cp kCapO 642 | jr z,PUT_suit 643 | inc b 644 | cp kCapP 645 | jr z,PUT_suit 646 | inc b 647 | cp kCapQ 648 | jr z,PUT_suit 649 | inc b 650 | cp kMath 651 | jr z,PUT_suit 652 | inc b 653 | 654 | bit isTi84CE, (iy+asm_flag3) 655 | jp z,LOOP_is83PCE 656 | cp kAppsMenu 657 | jr z,PUT_suit 658 | inc b 659 | cp kPrgm 660 | jr z,PUT_suit 661 | inc b 662 | cp kInv 663 | jr z,PUT_suit 664 | inc b 665 | cp kSin 666 | jr z,PUT_suit 667 | inc b 668 | cp kCos 669 | jr z,PUT_suit 670 | 671 | LOOP_suit: 672 | cp kQuit 673 | jr z,LOOP_end 674 | cp kClear 675 | jp nz,loopEdit 676 | LOOP_end: 677 | bit archivedAV, (IY+asm_flag3) 678 | jr z,AVnotInArc 679 | call _op6toop1 680 | call _ARC_UNARC 681 | AVnotInArc: 682 | jp quitMemEdit 683 | 684 | editPut: 685 | cp kEE 686 | jr z,lessThanK0 687 | cp kSpace 688 | jr z,lessThanK0 689 | ld b,k0 690 | sub a,b 691 | cp 10 692 | jr c,notALtr 693 | dec a 694 | dec a 695 | notALtr: 696 | ld b,a 697 | PUT_suit: 698 | ; INPUT : 699 | ; - B = 4bits number to insert [0-F] 700 | ; - (fstElWin) = address to inset B[0-3] 701 | ; - Flag secNibble = MSB=1 / LSB=0 702 | ; OUPUT : 703 | ; - (fstElWin) = b[0-3] 704 | ; - Flag secNibble inverted 705 | push bc 706 | ld hl,(fstElWin) 707 | ld a,(cursorDataY) 708 | sla a 709 | sla a 710 | ld de,0 711 | ld e,a 712 | ld a,(cursorDataX) 713 | add a,e 714 | ld e,a 715 | add hl,de 716 | call _setAToHLU 717 | cp $D0 718 | jp c,loopEdit 719 | ; b=num 720 | ld a,%11110000 721 | bit secNibble, (IY+asm_flag3) 722 | jr nz,changeLSBs 723 | ld a,%00001111 724 | sla b 725 | sla b 726 | sla b 727 | sla b 728 | changeLSBs: 729 | and (hl) 730 | or b 731 | ld (hl),a 732 | 733 | pop af 734 | ld b,30h 735 | add a,b 736 | cp 3Ah 737 | jr c,NaL ; not a letter 738 | ld b,7 739 | add a,b 740 | NaL: 741 | 742 | ld c,a ; save a 743 | ld a,(cursorDataY) 744 | ld e,a 745 | ld d,24 746 | mlt de 747 | ld a,$44 748 | add a,e 749 | ld (penrow),a 750 | ld a,(cursorDataX) 751 | ld e,a 752 | ld d,38 753 | mlt de 754 | 755 | ld a,38 756 | bit secNibble, (IY+asm_flag3) 757 | jr z,fstNibble 758 | ld a,38+12 759 | fstNibble: 760 | add a,e 761 | ld e,a 762 | ld (pencol),de 763 | ld a,c ; restore a 764 | call _vPutMap 765 | 766 | bit secNibble, (IY+asm_flag3) 767 | jp nz,editRight 768 | set secNibble, (IY+asm_flag3) 769 | jp loopEdit 770 | 771 | LOOP_is83PCE: ; ti83pce 772 | cp kMatrix 773 | jp z,PUT_suit 774 | inc b 775 | cp kPrgm 776 | jp z,PUT_suit 777 | inc b 778 | ld e,a 779 | ld a,(keyExtend) 780 | cp 18 781 | jp z,PUT_suit 782 | inc b 783 | cp 17 784 | jp z,PUT_suit 785 | inc b 786 | cp 20 787 | jp z,PUT_suit 788 | ld a,e 789 | jp LOOP_suit 790 | 791 | editDown: 792 | ld de,$FFFFFF 793 | call dispEraseCursor 794 | ld hl,cursorDataY 795 | ld a,6 796 | cp (hl) 797 | jr z,downOverflow 798 | inc (hl) 799 | inc de 800 | call dispEraseCursor 801 | jp dispADDR 802 | downOverflow: 803 | ld hl,(fstElWin) 804 | inc hl 805 | inc hl 806 | inc hl 807 | inc hl 808 | ld (fstElWin),hl 809 | jp dispData 810 | 811 | jumpDown: 812 | ld hl,(fstElWin) 813 | ld de,7*4 814 | add hl,de 815 | ld (fstElWin),hl 816 | jp dispData 817 | 818 | editUp: 819 | ld de,$FFFFFF 820 | call dispEraseCursor 821 | ld hl,cursorDataY 822 | xor a 823 | cp (hl) 824 | jr z,upOverflow 825 | dec (hl) 826 | inc de 827 | call dispEraseCursor 828 | jp dispADDR 829 | upOverflow: 830 | ld hl,(fstElWin) 831 | dec hl 832 | dec hl 833 | dec hl 834 | dec hl 835 | ld (fstElWin),hl 836 | jp dispData 837 | 838 | jumpUp: 839 | ld hl,(fstElWin) 840 | ld de,-(7*4) 841 | add hl,de 842 | ld (fstElWin),hl 843 | jp dispData 844 | 845 | editLeft: 846 | ld de,$FFFFFF 847 | call dispEraseCursor 848 | ld hl,cursorDataX 849 | xor a 850 | cp (hl) 851 | jr z,leftOverflow 852 | dec (hl) 853 | inc de 854 | call dispEraseCursor 855 | jp dispADDR 856 | leftOverflow: 857 | ld (hl),3 858 | ld a,(cursorDataY) 859 | or a 860 | jr z,upOverflow 861 | dec a 862 | ld (cursorDataY),a 863 | inc de 864 | call dispEraseCursor 865 | jp dispADDR 866 | 867 | editRight: 868 | ld de,$FFFFFF 869 | call dispEraseCursor 870 | ld hl,cursorDataX 871 | ld a,3 872 | cp (hl) 873 | jr z,rightOverflow 874 | inc (hl) 875 | inc de 876 | call dispEraseCursor 877 | jp dispADDR 878 | rightOverflow: 879 | ld (hl),0 880 | ld a,(cursorDataY) 881 | cp 6 882 | jp z,downOverflow 883 | inc a 884 | ld (cursorDataY),a 885 | inc de 886 | call dispEraseCursor 887 | jp dispADDR 888 | 889 | dispEraseCursor: 890 | ; INPUT : 891 | ; - DE = color of the cursor 892 | ; - (cursorDataX/Y) = position of the cursor 893 | ; OUTPUT : 894 | ; - cursor displayed 895 | ; - B = 0 896 | bit secNibble, (IY+asm_flag3) 897 | jr z,noChange 898 | ld hl,(cursorDataX) 899 | ld h,24 900 | mlt hl 901 | ld bc,205 902 | add hl,bc 903 | ld (pencol),hl 904 | ld hl,(fstElWin) 905 | ld a,(cursorDataY) 906 | sla a 907 | sla a 908 | ld c,a 909 | ld a,(cursorDataX) 910 | add a,c 911 | ld c,a 912 | add hl,bc 913 | ld a,(hl) 914 | ex de,hl 915 | call _vPutMap 916 | ex de,hl 917 | res secNibble, (IY+asm_flag3) 918 | noChange: 919 | ld a,(cursorDataY) 920 | ld hl,POSY_LUT 921 | ld bc,0 922 | ld b,3 923 | ld c,a 924 | mlt bc 925 | add hl,bc 926 | ld bc,(hl) 927 | suitCursor: 928 | ld a,(cursorDataX) 929 | ld hl,0 930 | ld h,38*2 931 | ld l,a 932 | mlt hl 933 | add hl,bc 934 | ld bc,40 935 | or a 936 | sbc hl,bc 937 | ld b,3 938 | dispCursorLoopY: 939 | push bc 940 | ld b,14 941 | dispCursorLoopX: 942 | ld (hl),de 943 | inc hl 944 | inc hl 945 | inc hl 946 | djnz dispCursorLoopX 947 | ld (hl),de 948 | inc hl 949 | ld (hl),de 950 | ld bc,(320*2)-43 951 | add hl,bc 952 | pop bc 953 | djnz dispCursorLoopY 954 | ret 955 | 956 | decToHexaToHL: 957 | ; INPUT : 958 | ; - A = decimal 959 | ; OUPUT : 960 | ; - (HL) = String of the converted number 961 | push af 962 | srl a 963 | srl a 964 | srl a 965 | srl a 966 | push af 967 | ld b,30h 968 | add a,b 969 | cp 3Ah 970 | jr c,numChar1 971 | ld b,7 972 | add a,b 973 | numChar1: 974 | ld (hl),a 975 | inc hl 976 | 977 | pop bc 978 | pop af 979 | sla b 980 | sla b 981 | sla b 982 | sla b 983 | sub a,b 984 | ld b,30h 985 | add a,b 986 | cp 3Ah 987 | jr c,numChar2 988 | ld b,7 989 | add a,b 990 | numChar2: 991 | ld (hl),a 992 | ret 993 | 994 | AV_HEADER: 995 | .db "EDIT",0 996 | .db " ",0 997 | ADDR_txt: 998 | .db "ADDR",0 999 | ENTER_address: 1000 | .db "Address : ",0 1001 | ENTER_addressFR: 1002 | .db "Adresse : ",0 1003 | AV_TITLE: 1004 | .db "APPVAR:",0 1005 | currentItemNum: 1006 | .db 1 1007 | currentSubmenuNum: 1008 | .db 1 1009 | nbrElements: 1010 | .db 0 1011 | BufDispASCII: ; used for displaying ASCII line in the editor 1012 | .db 7,0,$20,0,$20,0,$20,0 1013 | BufAddrASCII: ; used in INPUT_'s routine 1014 | .db '0','0','0','0','0','0',0 1015 | LUT_keyToVal: ; used with getCSC 1016 | .db $03,$06,$09,$FF,$FF,$FF,$FF,$FF ; 3 6 9 * * * * * 1017 | .db $02,$05,$08,$FF,$0F,$0C,$FF ; 2 5 8 * F C * 1018 | .db $00,$01,$04,$07,$FF,$0E,0Bh ; 0 1 4 7 * E B 1019 | .db $FF,$FF,$FF,$FF,$FF,$FF,$0D,0Ah ; * * * * * * D A 1020 | POSY_LUT: ; Ypos of the cursor 1021 | .dl vRam+(((084*320)+58)*2) 1022 | .dl vRam+(((108*320)+58)*2) 1023 | .dl vRam+(((132*320)+58)*2) 1024 | .dl vRam+(((156*320)+58)*2) 1025 | .dl vRam+(((180*320)+58)*2) 1026 | .dl vRam+(((204*320)+58)*2) 1027 | .dl vRam+(((228*320)+58)*2) 1028 | endMemoryEditor: -------------------------------------------------------------------------------- /SRC/PHASM.8XG/editor.z80: -------------------------------------------------------------------------------- 1 | beginMenuHook: 2 | .db 83h 3 | cp 4 4 | jr nz,notFirstEvent 5 | 6 | bit editArchivedProgFlag, (IY+asm_Flag3) 7 | jr z,notFirstEvent 8 | push af 9 | push hl 10 | ld a,b 11 | cp mProgramHome 12 | ld a,$FF 13 | jr z,bridgeJR 14 | 15 | ld a,b 16 | cp 33 17 | ld a,$FF 18 | jr z,bridgeJR 19 | pop hl 20 | pop af 21 | 22 | notFirstEvent: 23 | cp 3 24 | jr nz,quitMenuHook 25 | ld a,(menuCurrent) 26 | cp mProgramHome 27 | jr nz,quitMenuHook 28 | ld a,(menuCurrent+1) 29 | cp mPrgm_Edit 30 | jr nz,quitMenuHook 31 | ld a,b 32 | cp cxPrgmEdit 33 | jr nz,quitMenuHook 34 | 35 | push bc 36 | push de 37 | call _releaseBuffer 38 | call _PPutAway 39 | call _zeroop1 40 | ld a,AppVarObj 41 | ld (OP1),a 42 | ld a,'P' 43 | ld (OP1+1),a 44 | ld a,'H' 45 | ld (OP1+2),a 46 | call _chkfindsym 47 | jr c,AppVarIssue 48 | call _chkInRam 49 | jr nz,AppVarIssue 50 | ex de,hl 51 | pop de 52 | push hl 53 | 54 | ld hl,-9 55 | add hl,de 56 | call _Mov9ToOp1 57 | ld a,progObj 58 | ld (OP1),a 59 | call _Op1ToOp6 60 | call _chkfindsym 61 | call _chkInRam 62 | pop ix 63 | jr z,InRam 64 | push ix 65 | 66 | call _ARC_UNARC 67 | pop de 68 | inc de 69 | inc de 70 | ld hl,OP6 71 | ld bc,9 72 | ldir 73 | set editArchivedProgFlag, (IY+asm_Flag3) 74 | 75 | InRam: 76 | pop bc 77 | quitMenuHook: 78 | cp a 79 | ret 80 | 81 | AppVarIssue: 82 | pop de 83 | pop bc 84 | jr quitMenuHook 85 | endMenuHook: 86 | .end -------------------------------------------------------------------------------- /SRC/PHASM.8XG/executor.z80: -------------------------------------------------------------------------------- 1 | ; See InstantGoto for the comments : we do the same thing 2 | beginHomescreenHook: 3 | .db 83h 4 | bit parserHookActive, (iy+hookflags4) 5 | jr nz,parserActive 6 | ; If another program has removed the parserHook... 7 | call _zeroop1 8 | ld a,AppVarObj ; We want the address of the code (in PH AppVar) 9 | ld (OP1),a 10 | ld a,'P' 11 | ld (OP1+1),a 12 | ld a,'H' 13 | ld (OP1+2),a 14 | call _ChkFindSym 15 | ld de,endHSHook-beginHomescreenHook + endMenuHook-beginMenuHook + endGetkeyHook-beginGetkeyHook + 2 16 | add hl,de 17 | call _setParserHook 18 | parserActive: 19 | bit editArchivedProgFlag, (iy+asm_Flag3) 20 | jr z,noProgramToArchive 21 | 22 | 23 | ArchiveEditedProgram: 24 | ; The following code archives an unarchived program which has been edited thanks to PHASM 25 | push bc 26 | push af 27 | call _pushrealo1 28 | 29 | res editArchivedProgFlag, (IY+asm_Flag3) 30 | call _zeroop1 31 | ld a,AppVarObj ; We want the address of the code (in PH AppVar) 32 | ld (OP1),a 33 | ld a,'P' 34 | ld (OP1+1),a 35 | ld a,'H' 36 | ld (OP1+2),a 37 | call _ChkFindSym 38 | jr c,endArchiveEditedProgram 39 | call _chkinram 40 | jr nz,endArchiveEditedProgram 41 | inc de 42 | inc de 43 | ex de,hl 44 | push hl 45 | call _Mov9ToOp1 46 | call _ChkFindSym 47 | pop ix 48 | jr c,endArchiveEditedProgram 49 | push ix 50 | call _ARC_UNARC 51 | pop de 52 | ld h,d 53 | ld l,e 54 | ld (hl),0 55 | inc de 56 | ld bc,8 57 | ldir 58 | 59 | endArchiveEditedProgram: 60 | call _poprealo1 61 | pop af 62 | pop bc 63 | cp $FF 64 | jr nz,noProgramToArchive 65 | jr notFirstEvent-2 66 | 67 | bridgeJR: ; To have only relative jumps 68 | jr ArchiveEditedProgram 69 | 70 | noProgramToArchive: 71 | cp 2 72 | jr nz,ErrorMissing 73 | 74 | call _zeroop1 75 | ld a,AppVarObj 76 | ld (OP1),a 77 | ld a,'P' 78 | ld (OP1+1),a 79 | ld a,'H' 80 | ld (OP1+2),a 81 | call _ChkFindSym 82 | jr c,ErrorMissing 83 | call _chkinram 84 | jr nz,ErrorMissing 85 | ld hl,11 86 | add hl,de 87 | ld de,$D052C6+4000 88 | ld bc,AppvarSize 89 | ldir 90 | ld hl,$D052C6+4004 91 | jp (hl) 92 | 93 | 94 | ErrorMissing: 95 | cp a 96 | ret 97 | EndHSHook: -------------------------------------------------------------------------------- /SRC/PHASM.8XG/parserHook.z80: -------------------------------------------------------------------------------- 1 | beginParserHook: 2 | .db 83h 3 | or a 4 | ret z 5 | push bc 6 | push af 7 | push de 8 | push hl 9 | ld hl,(curPC) 10 | ld a,(hl) 11 | cp tStop 12 | jr z,stopDetected 13 | pop hl 14 | pop de 15 | pop af 16 | pop bc 17 | cp a 18 | ret 19 | 20 | stopDetected: 21 | inc hl 22 | ld a,(hl) 23 | cp tEnter 24 | jr z,normalStop 25 | cp tColon 26 | jr nz,unusualUseDetected 27 | 28 | normalStop: 29 | pop hl 30 | pop de 31 | pop af 32 | pop bc 33 | cp a 34 | ret 35 | 36 | unusualUseDetected: 37 | dec hl 38 | call _Mov9ToOP1 39 | ld a,tEnter 40 | ld (OP1+9),a 41 | ld a,ProgObj 42 | ld (OP1),a 43 | ld hl,OP1+1 44 | ld de,0 45 | delimitNameProgLoop: 46 | inc de 47 | inc hl 48 | ld a,(hl) 49 | cp tEnter 50 | jr z,delimitNameProgEnd 51 | cp tColon 52 | jr nz,delimitNameProgLoop 53 | delimitNameProgEnd: 54 | push de 55 | ld (hl),0 56 | call _op1toop5 57 | call _zeroop1 58 | ld a,AppVarObj 59 | ld (OP1),a 60 | ld a,'P' 61 | ld (OP1+1),a 62 | ld a,'H' 63 | ld (OP1+2),a 64 | call _chkfindsym 65 | jp c,_ErrSyntax 66 | call _chkInRam 67 | jp c,_ErrSyntax 68 | inc de 69 | inc de 70 | push de 71 | ex de,hl 72 | call _pushreal 73 | call _pushrealo5 74 | call _pushrealo5 75 | pop de 76 | call _popreal 77 | call _CpyTo1FPST 78 | call _ChkFindSym 79 | jp c,_ErrUndefined 80 | call _chkInRam 81 | push af 82 | call nz,_ARC_UNARC 83 | push de 84 | 85 | call _zeroop1 86 | ld hl,OP1 87 | ld (hl),TempProgObj 88 | inc hl 89 | ld de,$525453 ; STR 90 | ld (hl),de 91 | call _chkfindsym 92 | inc de 93 | inc de 94 | push de 95 | inc de 96 | inc de 97 | ex de,hl 98 | inc (hl) 99 | pop hl 100 | call _Mov9ToOP1 101 | 102 | pop de 103 | ld hl,0 104 | ld a,(de) 105 | ld l,a 106 | inc de 107 | ld a,(de) 108 | ld h,a 109 | inc de 110 | push hl 111 | push hl 112 | push de 113 | inc hl 114 | inc hl 115 | ld a,TempProgObj 116 | call _createVar 117 | inc de 118 | inc de 119 | pop hl 120 | pop bc 121 | inc bc 122 | ldir 123 | ex de,hl 124 | ld (hl),tEnter ; it fixes a bug (wrong ERR:UNDEFINED)... I don't know why x) 125 | dec hl 126 | ld (hl),tEnter 127 | 128 | call _poprealo1 129 | call _pushrealo4 130 | pop hl 131 | pop af 132 | push hl 133 | call nz,_ARC_UNARC 134 | call _CpyTo1FPST 135 | call _ChkFindSym 136 | inc de 137 | inc de 138 | pop bc 139 | ld a,(de) 140 | cp tExtTok 141 | jr nz,transformPrgmTokenIntoArchiveToken 142 | inc de 143 | ld a,(de) 144 | dec de 145 | cp tAsm84CeCmp 146 | jr z,bridgeASMProg 147 | transformPrgmTokenIntoArchiveToken: 148 | ld a,(de) 149 | cp tProg 150 | jr nz,transformLoopSuit 151 | ld a,tStop 152 | ld (de),a 153 | transformLoopSuit: 154 | cp t2ByteTok 155 | jr nz,noAsmToken 156 | inc de 157 | ld a,(de) 158 | dec de 159 | cp tAsm 160 | jr nz,noAsmToken 161 | inc de 162 | ld a,tEnter 163 | ld (de),a 164 | dec de 165 | ld (de),a 166 | noAsmToken: 167 | dec bc 168 | inc de 169 | ld a,c 170 | or a 171 | jr nz,transformPrgmTokenIntoArchiveToken 172 | ld a,b 173 | or a 174 | jr nz,transformPrgmTokenIntoArchiveToken 175 | 176 | jr afterASMBridge 177 | bridgeASMProg: 178 | jr executeAsmSbPrgm 179 | afterASMBridge: 180 | 181 | call _poprealo1 182 | call _parseInp 183 | 184 | call _zeroop1 185 | ld hl,OP1 186 | ld (hl),TempProgObj 187 | inc hl 188 | ld de,$525453 ; STR 189 | ld (hl),de 190 | call _chkfindsym 191 | inc de 192 | inc de 193 | push de 194 | ex de,hl 195 | call _Mov9ToOP1 196 | call _chkfindsym 197 | call nc,_DELVAR 198 | pop hl 199 | inc hl 200 | inc hl 201 | dec (hl) 202 | 203 | call _zeroop1 204 | ld a,AppVarObj 205 | ld (OP1),a 206 | ld a,'P' 207 | ld (OP1+1),a 208 | ld a,'H' 209 | ld (OP1+2),a 210 | call _ChkFindSym 211 | jp c,_ErrUndefined 212 | inc de 213 | inc de 214 | call _popreal 215 | 216 | ld hl,(curPC) 217 | pop de 218 | add hl,de 219 | ld (curPC),hl 220 | 221 | pop hl 222 | pop de 223 | pop af 224 | pop bc 225 | or 1 226 | ret 227 | 228 | executeAsmSbPrgm: 229 | ; When we jump here : 230 | ; OP1 = name Prog 231 | ; DE = ADDR Prog 232 | ; BC = Size Prog 233 | ; HL = VAT Entry 234 | call _executePrgm 235 | 236 | call _poprealo1 237 | call _chkfindsym 238 | call nc,_DELVAR 239 | 240 | call _zeroop1 241 | ld a,AppVarObj 242 | ld (OP1),a 243 | ld a,'P' 244 | ld (OP1+1),a 245 | ld a,'H' 246 | ld (OP1+2),a 247 | call _ChkFindSym 248 | jp c,_ErrUndefined 249 | inc de 250 | inc de 251 | call _popreal 252 | 253 | call _zeroop1 254 | ld hl,OP1 255 | ld (hl),TempProgObj 256 | inc hl 257 | ld de,$525453 ; STR 258 | ld (hl),de 259 | call _chkfindsym 260 | inc de 261 | inc de 262 | ex de,hl 263 | inc hl 264 | inc hl 265 | dec (hl) 266 | 267 | ld hl,(curPC) 268 | pop de 269 | add hl,de 270 | ld (curPC),hl 271 | 272 | pop hl 273 | pop de 274 | pop af 275 | pop bc 276 | or 1 277 | ret 278 | endParserHook: -------------------------------------------------------------------------------- /SRC/PHASM.8XP/AppVar.z80: -------------------------------------------------------------------------------- 1 | TempBuf: 2 | .db 0,0,0,0,0,0,0,0,0 3 | InPS2: 4 | .org $D052C6+4000 5 | cpyInRAM: 6 | .db progobj,"#",0,0 7 | 8 | ld hl,cpyInRAM 9 | call _Mov9ToOP1 10 | call _chkfindsym 11 | ret c 12 | push de 13 | call _zeroop1 14 | pop hl 15 | ld bc,0 16 | ld c,(hl) 17 | inc hl 18 | inc hl 19 | ld a,(hl) 20 | cp tProg 21 | jp nz,QuitHook 22 | push bc 23 | 24 | ld de,OP1 25 | ldir 26 | ld a,ProgObj 27 | ld (OP1),a 28 | call _chkfindsym 29 | jr nc,progExists 30 | pop hl 31 | cp a 32 | ret 33 | progExists: 34 | call _ChkInRam 35 | jp z,executeRAMProgram 36 | res archivedBasic, (iy+asm_Flag3) 37 | ArchivedProgram: 38 | res isProtected, (iy+asm_Flag3) 39 | ld a,(hl) 40 | cp 6 41 | jr nz,notProtected 42 | set isProtected, (iy+asm_Flag3) 43 | notProtected: 44 | call _pushrealo1 45 | bit archivedBasic, (iy+asm_Flag3) 46 | call z,_ARC_UNARC 47 | call _CpyTo1FPST 48 | call _pushrealo1 49 | call _chkfindsym 50 | push de 51 | ld hl,AppVarName 52 | call _Mov9ToOP1 53 | call _chkfindsym 54 | inc de 55 | inc de 56 | call _popreal 57 | pop de 58 | 59 | ex de,hl 60 | ld bc,0 61 | ld c,(hl) 62 | inc hl 63 | ld b,(hl) 64 | inc hl 65 | push hl 66 | inc hl 67 | ld a,(hl) 68 | push af 69 | push bc 70 | 71 | ld hl,TEMPname 72 | call _Mov9ToOP1 73 | call _chkfindsym 74 | call nc,_DELVAR 75 | pop hl ; HL = program's size 76 | push hl 77 | ld a,TempProgObj 78 | call _createVar 79 | inc de 80 | inc de 81 | pop bc ; BC = program's size 82 | ld hl,0 83 | or a 84 | sbc hl,bc 85 | jr z,zeroByteProg 86 | pop af ; AF = tAsm84CeCmp if assembly 87 | pop hl ; HL = content 88 | push bc 89 | push af 90 | ldir ; prgmTTEMP = content 91 | zeroByteProg: 92 | call _poprealo1 93 | call _op1ToOp5 94 | bit archivedBasic, (iy+asm_Flag3) 95 | call z,_ARC_UNARC 96 | 97 | call _op4toOP1 98 | pop af 99 | pop bc 100 | pop hl 101 | ld hl,6 102 | cp tAsm84CeCmp 103 | jr nz,executesArchivedBasicProgram 104 | push bc 105 | push hl 106 | call _pushrealo5 107 | pop hl 108 | xor a 109 | jp executesArchivedAsmProgram 110 | 111 | QuitHook: 112 | cp a 113 | ret 114 | 115 | executesArchivedBasicProgram: 116 | call prepareToExecuteSubprograms 117 | ld hl,errorHandler 118 | call _PushErrorHandler 119 | set 0,(iy+3) 120 | set 1,(iy+8) 121 | set 6,(iy+12) 122 | call _parseInp 123 | res 6,(iy+12) 124 | res 1,(iy+8) 125 | res 0,(iy+3) 126 | call _popErrorHandler 127 | ld a,1 128 | deleteTemp: 129 | res 6,(iy+33h) 130 | push af 131 | call _DeleteTempPrograms 132 | pop af 133 | or a 134 | ret nz 135 | 136 | ld hl,AppVarName 137 | call _Mov9ToOP1 138 | call _chkfindsym 139 | inc de 140 | inc de 141 | push de 142 | ex de,hl 143 | ld de,basic_prog 144 | call _Mov9b 145 | pop hl 146 | call _Mov9ToOP1 147 | call _chkfindsym 148 | call _ChkInRam 149 | jp z,_JErrorNo 150 | 151 | call _ARC_UNARC 152 | set editArchivedProg, (iy+asm_Flag3) 153 | jp _JErrorNo 154 | 155 | errorHandler: 156 | xor a 157 | jr deleteTemp 158 | 159 | 160 | prepareToExecuteSubprograms: 161 | call _OP1ToOP5 162 | call _chkfindsym 163 | push de 164 | ex de,hl 165 | ld de,(hl) 166 | inc de 167 | inc de 168 | ld (hl),de 169 | ex de,hl 170 | call _SetHLUto0 171 | push hl 172 | add hl,de 173 | ld de,2 174 | ex de,hl 175 | call _InsertMEM 176 | ex de,hl 177 | ld (hl),tEnter ; it fixes a bug (wrong ERR:UNDEFINED)... I don't know why x) 178 | inc hl 179 | ld (hl),tEnter 180 | 181 | pop bc 182 | pop de 183 | inc de 184 | inc de 185 | transformPrgmTokenIntoArchiveToken: 186 | ld a,(de) 187 | cp tProg 188 | jr nz,transformLoopSuit 189 | ld a,tStop 190 | ld (de),a 191 | transformLoopSuit: 192 | cp t2ByteTok 193 | jr nz,noAsmToken 194 | inc de 195 | ld a,(de) 196 | dec de 197 | cp tAsm 198 | jr nz,noAsmToken 199 | inc de 200 | ld a,tColon 201 | ld (de),a 202 | dec de 203 | ld (de),a 204 | noAsmToken: 205 | dec bc 206 | inc de 207 | ld a,c 208 | or a 209 | jr nz,transformPrgmTokenIntoArchiveToken 210 | ld a,b 211 | or a 212 | jr nz,transformPrgmTokenIntoArchiveToken 213 | ld hl,TempProgName 214 | call _Mov9ToOP1 215 | call _chkfindsym 216 | call nc,_DELVAR 217 | ld hl,4 218 | ld a,TempProgObj 219 | call _createVar 220 | ex de,hl 221 | inc hl 222 | inc hl 223 | ld (hl),TempProgObj 224 | inc hl 225 | ld (hl),'T' ; Temp progs begin with T 226 | inc hl 227 | ld (hl),0 228 | inc hl 229 | ld (hl),0 230 | call _OP5ToOP1 231 | ret 232 | 233 | executeBasicRAMProgram: 234 | pop ix 235 | set archivedBasic, (iy+asm_Flag3) 236 | jp ArchivedProgram 237 | 238 | executeRAMProgram: 239 | inc de 240 | inc de 241 | ld a,(de) 242 | cp tExtTok 243 | jr nz,executeBasicRAMProgram 244 | inc de 245 | ld a,(de) 246 | cp tAsm84CeCmp 247 | jp nz,executeBasicRAMProgram 248 | call _pushrealo1 249 | pop hl 250 | executesArchivedAsmProgram: 251 | push af 252 | push hl 253 | ld a,tProg 254 | ld (OP1),a 255 | call _OP1ToOP6 256 | 257 | ld hl,BASICname 258 | call _Mov9ToOP1 259 | ld a,TempProgObj 260 | ld (OP1),a 261 | call _chkfindsym 262 | call nc,_DELVAR 263 | pop bc 264 | push bc 265 | ld hl,14 266 | add hl,bc 267 | ld a,TempProgObj 268 | call _createVar 269 | inc de 270 | inc de 271 | ld hl,BASICcontent 272 | ld bc,2 273 | ldir 274 | ld hl,OP6 275 | pop bc 276 | ldir 277 | ld bc,12 278 | ld hl,BASICcontent+2 279 | ldir 280 | call _pushrealo4 281 | 282 | ld hl,BASICcontent+5 283 | call _Mov9ToOP1 284 | call _chkfindsym 285 | call nc,_DELVAR 286 | ld hl,endHomescreenHook-cpyInRAM + BASICcontent-RESTOREcontent 287 | ld a,TempProgObj 288 | call _createVar 289 | inc de 290 | inc de 291 | ld hl,RESTOREcontent 292 | ld bc,BASICcontent-RESTOREcontent 293 | ldir 294 | ld hl,cpyInRAM 295 | ld bc,endHomescreenHook-cpyInRAM 296 | ldir 297 | 298 | call _poprealo1 299 | ld hl,errorAsm 300 | call _PushErrorHandler 301 | set 0,(iy+3) 302 | set 1,(iy+8) 303 | set 6,(iy+12) 304 | call _parseInp 305 | res 6,(iy+12) 306 | res 1,(iy+8) 307 | res 0,(iy+3) 308 | call _popErrorHandler 309 | xor a 310 | ld (bugOccured),a 311 | 312 | AfterExecution: 313 | res editArchivedProg, (IY+asm_Flag3) 314 | call _Clrtxtshd 315 | pop af 316 | or a 317 | jr z,UpdateStatus 318 | 319 | call _DeleteTempPrograms 320 | call _poprealo1 321 | ld a,(bugOccured) 322 | cp 1 323 | ret nz 324 | jp _JErrorNo 325 | 326 | ; We update the program status 327 | UpdateStatus: 328 | ld hl,TEMPname 329 | call _Mov9ToOP1 330 | call _chkfindsym 331 | inc de 332 | inc de 333 | pop bc 334 | push de 335 | push bc 336 | call _poprealo1 337 | call _chkfindsym 338 | call nc,_DELVARARC 339 | pop hl 340 | push hl 341 | bit isProtected, (iy+asm_Flag3) 342 | jr nz,protectedProgram 343 | call _createprog 344 | suitProtectedProgram: 345 | inc de 346 | inc de 347 | pop bc 348 | pop hl 349 | ldir 350 | call _op4toOP1 351 | call _ARC_UNARC 352 | 353 | call _DeleteTempPrograms 354 | ld a,(bugOccured) 355 | cp 1 356 | ret nz 357 | jp _JErrorNo 358 | 359 | ProtectedProgram: 360 | call _createProtProg 361 | jr suitProtectedProgram 362 | 363 | errorAsm: 364 | ld a,1 365 | ld (bugOccured),a 366 | jp AfterExecution 367 | 368 | RESTOREcontent: 369 | .db tExtTok,tAsm84CeCmp 370 | ld bc,endHomescreenHook - cpyInRAM 371 | ld hl,userMem-2 + BASICcontent - RESTOREcontent 372 | ld de,$D052C6+4000 373 | ldir 374 | ret 375 | BASICcontent: 376 | .db $BB,$6A,tenter,$BB,$6A,tProg,"RRESTORE" 377 | BASICname: 378 | .db TempProgObj,"PPHASM",0 379 | TEMPname: 380 | .db TempProgObj,"TTEMP",0 381 | TempProgName: 382 | .db TempProgObj,"STR",0 383 | AppVarName: 384 | .db AppVarObj,"PH",0 385 | 386 | 387 | InGetCSC: 388 | .org $D052C6+4000 389 | cpyInRAMGetCSC: 390 | ld hl,(editCursor) 391 | push hl 392 | ld hl,(editTail) 393 | push hl 394 | call _bufToTop 395 | checkContext: 396 | call _BufRight 397 | jr nz,suit 398 | pop hl 399 | ld (editTail),hl 400 | pop hl 401 | ld (editCursor),hl 402 | xor a 403 | ret 404 | suit: 405 | ld a,e 406 | cp tEnter 407 | jr nz,checkContext 408 | 409 | call _cursorOff 410 | call _clrlcdfull 411 | xor a ; Put 0 to the lastLblDisplayed flag 412 | ld (lastLblDisplayed),a 413 | ld hl,40 ; position of the first Lbl displayed 414 | ld (penrow),hl 415 | ld hl,25 416 | ld (pencol),hl 417 | ld hl,1 418 | ld bc,0 419 | call RT_displayLbl ; routine which displays the Lbls 420 | ld hl,(nbrLbls) 421 | ld de,0 422 | sbc hl,de 423 | pop hl 424 | pop de 425 | ret z 426 | push de 427 | push hl 428 | 429 | LblsDisplayed: 430 | ld hl,40 ; position of the cursor 431 | ld (penrow),hl 432 | ld hl,10 433 | ld (pencol),hl 434 | ld de,1 435 | push de ; the last (or first) number on the stack will be the number of the Lbl ahead the cursor 436 | loop: 437 | ld a,'>' 438 | ld bc,(pencol) 439 | call _VPutMap ; Displaying of the cursor 440 | ld (pencol),bc 441 | call _getcsc ; we're waiting for a key 442 | cp skClear 443 | jp z,restoreEditor 444 | 445 | ld hl,(pencol) 446 | ld bc,60 447 | cp skLeft 448 | jp z,CurLeft 449 | cp skRight 450 | jp z,CurRight 451 | horizontal: 452 | ld (pencol),hl 453 | 454 | ld hl,(penrow) 455 | ld bc,20 456 | cp skUp 457 | jp z,CurUp 458 | cp skDown 459 | jp z,CurDown 460 | vertical: 461 | ld (penrow),hl 462 | cp skEnter 463 | jr nz,loop 464 | 465 | call _clrlcdfull 466 | call _Clrtxtshd 467 | xor a ; Displaying of "PROGRAM:XXXX" 468 | ld (curcol),a 469 | ld (currow),a 470 | ld hl,TEXTProgram 471 | call _puts 472 | ld hl,progToEdit 473 | call _puts 474 | 475 | call _bufToTop ; The routine will jump to the (HL) Lbl 476 | pop hl 477 | push hl 478 | ld de,1 479 | sbc hl,de 480 | pop hl 481 | pop de ; We're removing editTail and editCursor from the stack (initial values) 482 | pop de 483 | jr nz,checkGoDown 484 | 485 | call _newline 486 | ld a,':' 487 | call _PutMap 488 | ld a,1 489 | ld (curcol),a 490 | call _DispEOW 491 | xor a 492 | ret 493 | 494 | checkGoDown: 495 | ld de,(nbrLbls) 496 | push hl 497 | or a 498 | sbc hl,de 499 | pop hl 500 | dec hl 501 | jr nz,jumpToTheLblSelected 502 | bit GoDownDisplayed, (IY+asm_Flag3) 503 | jr z,jumpToTheLblSelected 504 | call _bufToBtm 505 | ld b,9 506 | updateScreen2: 507 | call _BufLeft 508 | jr z,BeginingProg 509 | ld a,e 510 | cp tEnter 511 | jr nz,updateScreen2 512 | djnz updateScreen2 513 | dispTailNQuit: 514 | call _dispTail 515 | xor a 516 | ret 517 | 518 | BeginingProg: 519 | call _newline 520 | ld a,':' 521 | call _PutMap 522 | ld a,1 523 | ld (curcol),a 524 | jr dispTailNQuit 525 | 526 | jumpToTheLblSelected: 527 | push hl 528 | call _BufRight 529 | pop hl 530 | ld a,e 531 | cp tLbl 532 | jr nz,jumpToTheLblSelected 533 | dec hl 534 | push hl 535 | ld de,0 ; We check if HL = 0 536 | or a 537 | sbc hl,de 538 | pop hl 539 | jr nz,jumpToTheLblSelected 540 | 541 | call _BufLeft 542 | 543 | ld b,4 ; Thanks to updateScreen and moveToLbl, we center the Lbl 544 | updateScreen: 545 | call _BufLeft 546 | jr z,tooHigh 547 | ld a,e 548 | cp tEnter 549 | jr nz,updateScreen 550 | djnz updateScreen 551 | call _DispEOW ; updates screen 552 | 553 | ld b,4 554 | moveToLbl: 555 | call _BufRight 556 | ret z 557 | ld c,e 558 | push bc 559 | call _putTokString 560 | pop bc 561 | ld a,c 562 | cp tEnter 563 | jr nz,moveToLbl 564 | djnz moveToLbl 565 | 566 | xor a 567 | ret 568 | 569 | tooHigh: 570 | push bc 571 | call _newline 572 | ld a,':' 573 | call _PutMap 574 | ld a,1 575 | ld (curcol),a 576 | call _DispEOW 577 | pop bc 578 | ld a,4 579 | sub b 580 | or a 581 | ret z 582 | ld b,a 583 | jr moveToLbl 584 | 585 | restoreEditor: 586 | pop de 587 | call _clrlcdfull 588 | call _Clrtxtshd 589 | 590 | pop hl 591 | ld (editTail),hl 592 | pop hl 593 | ld (editCursor),hl 594 | 595 | ld a,(curcol) 596 | ld e,a 597 | ld a,(currow) 598 | ld b,a 599 | xor a ; Displaying of "PROGRAM:XXXX" 600 | ld (curcol),a 601 | ld (currow),a 602 | ld hl,TEXTProgram 603 | call _puts 604 | ld hl,progToEdit 605 | call _puts 606 | jp updateScreen-2 607 | 608 | CurLeft: 609 | call erasePrint ; Erasing the cursor 610 | 611 | pop de ; DE = number of the Lbl ahead the cursor 612 | push de 613 | push hl ; HL = position X of the cursor 614 | 615 | ld hl,9 ; We check if we can move left 616 | ex de,hl 617 | or a 618 | sbc hl,de 619 | ex de,hl 620 | pop hl 621 | jp p,LEFT_suit 622 | ;pop de ; If we are pressing the right key as we are on first column, then, reset cursor at first Lbl (commented) 623 | ;ld de,1 624 | ;push de 625 | ;ld a,40 626 | ;ld (penrow),a 627 | ;xor a 628 | ;jp horizontal 629 | jp loop 630 | LEFT_suit: 631 | pop ix 632 | push de 633 | ld a,(pencol) 634 | cp 10 ; Must we scroll to see the other Lbls? 635 | jp z,RT_Refresh ; Routine wich scrolls 636 | 637 | sbc hl,bc ; we move the cursor position 638 | xor a 639 | jp horizontal 640 | 641 | 642 | CurRight: 643 | call erasePrint ; Erasing the cursor 644 | 645 | pop de ; DE = number of the Lbl ahead the cursor 646 | push de 647 | 648 | ld a,(pencol) 649 | cp 250 ; We check if we can move right without any scroll 650 | jr nz,noScroll 651 | ld a,(lastLblDisplayed) ; Last Lbl has been displayed? 652 | or a 653 | jp nz,loop 654 | 655 | ld hl,9 ; We're Updating the number of the Lbl ahead the cursor 656 | add hl,de 657 | pop de 658 | push hl 659 | ld de,36 660 | sbc hl,de 661 | ex de,hl ; DE is the number of the first Lbl wich must be displayed 662 | jp RT_Refresh 663 | 664 | noScroll: 665 | push hl 666 | ld hl,9 ; We're Updating the number of the Lbl ahead the cursor 667 | add hl,de 668 | 669 | push hl 670 | ld de,(nbrLbls) ; We will be too far? 671 | or a 672 | sbc hl,de 673 | pop de 674 | jp m,NotAtTheEnd 675 | jp z,NotAtTheEnd 676 | 677 | ld a,9 ; If so, we adjust the position Y of the cursor (must be in front of the last Lbl) 678 | ld hl,(nbrLbls) 679 | dec hl 680 | call _DivHLByA 681 | sla a 682 | sla a 683 | ld e,a 684 | sla a 685 | sla a 686 | add a,e 687 | ld e,40 688 | add a,e 689 | ld (penrow),a 690 | 691 | ex de,hl 692 | pop ix 693 | ld (mn),ix 694 | pop hl 695 | ld ix,(nbrLbls) 696 | push ix 697 | ld a,9 698 | dec hl 699 | call _DivHLByA ; Does the last Lbl is on the same line as we were? 700 | or a 701 | sbc hl,de 702 | jp z,loop 703 | ld hl,(mn) 704 | add hl,bc 705 | xor a 706 | jp horizontal 707 | 708 | NotAtTheEnd: 709 | pop hl 710 | pop ix 711 | push de 712 | 713 | add hl,bc 714 | xor a 715 | jp horizontal 716 | 717 | CurUp: 718 | call erasePrint ; Erasing the cursor 719 | 720 | pop de ; DE = number of the Lbl ahead the cursor 721 | push de 722 | push hl 723 | ld hl,1 724 | ex de,hl 725 | or a 726 | sbc hl,de ; We check if we can move up 727 | ex de,hl 728 | pop hl 729 | jp z,loop 730 | ld a,(penrow) 731 | cp 40 732 | jp z,loop 733 | 734 | pop ix ; If yes we update cursor position and the number of the Lbl ahead the cursor 735 | push de 736 | or a 737 | sbc hl,bc 738 | xor a 739 | jp vertical 740 | 741 | 742 | CurDown: 743 | call erasePrint ; Erasing the cursor 744 | 745 | pop de ; DE = number of the Lbl ahead the cursor 746 | push de 747 | push hl 748 | ld hl,(nbrLbls) 749 | ex de,hl 750 | or a 751 | sbc hl,de ; We check if we can move down 752 | pop hl 753 | jp z,loop 754 | ld a,(penrow) 755 | cp 200 756 | jp z,loop 757 | 758 | pop de ; If yes we update cursor position and the number of the Lbl ahead the cursor 759 | inc de 760 | push de 761 | add hl,bc 762 | xor a 763 | jp vertical 764 | 765 | 766 | erasePrint: ; I think it is clear enough :p 767 | push bc 768 | ld bc,(pencol) 769 | ld a,' ' 770 | call _VPutMap 771 | ld a,' ' 772 | call _VPutMap 773 | ld a,' ' 774 | call _VPutMap 775 | ld (pencol),bc 776 | pop bc 777 | ret 778 | 779 | RT_Refresh: ; It displays the Lbls 780 | xor a ; we Initialize the flag 781 | ld (lastLblDisplayed),a 782 | res GoUpDisplayed, (iy+asm_Flag3) 783 | res GoDownDisplayed, (iy+asm_Flag3) 784 | push de 785 | call _clrlcdfull 786 | pop de 787 | ld hl,(penrow) ; saving of the cursor position 788 | push hl 789 | ld hl,(pencol) 790 | push hl 791 | ld hl,40 ; It's where the first Lbl will be displayed (top left corner) 792 | ld (penrow),hl 793 | ld hl,25 794 | ld (pencol),hl 795 | 796 | ex de,hl ; HL = first Lbl wich must be displayed 797 | dec hl 798 | ld a,9 799 | call _DivHLByA ; We put in HL the number of Lbls to ignore 800 | push hl 801 | pop de 802 | sla l 803 | rl h 804 | sla l 805 | rl h 806 | sla l 807 | rl h 808 | add hl,de 809 | inc hl 810 | call RT_displayLbl 811 | 812 | pop hl ; restoring of the cursor position 813 | ld (pencol),hl 814 | pop hl 815 | ld (penrow),hl 816 | pop hl 817 | push hl 818 | ld de,(nbrLbls) 819 | or a ; We have been too far? (after the last Lbl) 820 | sbc hl,de 821 | jp m,loop 822 | jp z,loop 823 | tooFar: 824 | pop hl 825 | push de 826 | ex de,hl 827 | ld a,9 828 | call _DivHLByA ; We calculate the position Y of the last Lbl 829 | sla a 830 | sla a 831 | ld b,a 832 | sla a 833 | sla a 834 | add a,b 835 | ld b,20 836 | add a,b 837 | ld (penrow),a 838 | jp loop 839 | 840 | RT_displayLbl: 841 | ; INPUTS 842 | ; HL : Nbr of Lbls to ignore 843 | ; PENCOL/PENROW : Position first lbl 844 | ; OUTPUTS 845 | ; nbrLbls : number of Lbls 846 | ; lastLblDisplayed : 1 = YES, 0 = NO 847 | ; Lbls displayed 848 | push hl 849 | call _bufToTop 850 | pop hl 851 | ld de,1 ; If there's no Lbl to Ignore 852 | or a 853 | sbc hl,de 854 | jr z,dispGoUp 855 | dec hl 856 | push hl 857 | pop bc 858 | 859 | lblsToIgnore: ; We pass (HL) Lbls 860 | push hl 861 | call _BufRight 862 | pop hl 863 | ld a,e 864 | cp tLbl 865 | jr nz,lblsToIgnore 866 | 867 | dec hl 868 | ld de,0 869 | push hl 870 | or a 871 | sbc hl,de 872 | pop hl 873 | jr nz,lblsToIgnore 874 | jr displayLbl 875 | 876 | dispGoUp: 877 | ld hl,(localLanguage) 878 | ld de,$02010C ; if French 879 | or a 880 | sbc hl,de 881 | ld hl,TEXTGoUp 882 | jr nz,UPisEN 883 | ld hl,TEXTGoUpFR 884 | UPisEN: 885 | call _vputs 886 | ld a,60 887 | ld (penrow),a 888 | ld hl,25 889 | ld (pencol),hl 890 | set GoUpDisplayed, (iy+asm_Flag3) 891 | ld bc,1 892 | 893 | displayLbl: 894 | ld a,e ; E = token under the current cursor position 895 | push bc ; BC = number of Lbls met 896 | cp tLbl 897 | jr nz,notALbl 898 | pop bc 899 | inc bc 900 | push bc 901 | ld bc,pixelshadow 902 | storeNmLbl: ; We put the name of the Lbl in pixelshadow to display it 903 | call _BufRight 904 | ld a,e 905 | ld (bc),a 906 | inc bc 907 | jr z,EndLbl 908 | cp tColon 909 | jr z,EndLbl 910 | cp tEnter 911 | jr nz,storeNmLbl 912 | EndLbl: 913 | xor a 914 | dec bc 915 | ld (bc),a 916 | ld bc,(pencol) 917 | ld hl,pixelshadow 918 | call _vputs ; Displaying of the Lbl 919 | ld (pencol),bc 920 | 921 | ld a,(penrow) ; we calculate the new coordinates 922 | ld l,20 923 | add a,l 924 | ld (penrow),a 925 | cp 220 926 | jr nz,notALbl 927 | 928 | ld bc,60 929 | ld hl,(pencol) 930 | add hl,bc 931 | ld a,l 932 | cp 69 933 | jr z,fullScreen ; If the screen has been filled 934 | ld (pencol),hl 935 | 936 | ld a,40 937 | ld (penrow),a 938 | notALbl: 939 | call _BufRight 940 | pop bc 941 | jr nz,displayLbl ; If we are at the end of the program 942 | 943 | push bc 944 | pop hl 945 | ld (nbrLbls),hl 946 | jr checksIfItWasTheLastLbl 947 | 948 | fullScreen: 949 | pop hl 950 | ld (nbrLbls),hl 951 | 952 | checksIfItWasTheLastLbl: ; read the name of the Lbl to understand :p 953 | call _BufRight 954 | jr z,ItIs 955 | ld a,e 956 | cp tLbl 957 | jr nz,checksIfItWasTheLastLbl 958 | ret 959 | 960 | ItIs: 961 | ld a,(penrow) 962 | cp 220 963 | jr nz,dispGoDown 964 | ld a,(pencol) 965 | cp 9 966 | ret z 967 | dispGoDown: 968 | ld a,1 969 | ld (lastLblDisplayed),a 970 | 971 | ld hl,(localLanguage) 972 | ld de,$02010C ; if French 973 | or a 974 | sbc hl,de 975 | ld hl,TEXTGoDown 976 | jr nz,DOWNisEN 977 | ld hl,TEXTGoDownFR 978 | DOWNisEN: 979 | call _vputs 980 | set GoDownDisplayed, (iy+asm_Flag3) 981 | ld hl,nbrLbls 982 | inc (hl) 983 | bit GoUpDisplayed, (IY+asm_Flag3) 984 | ret nz 985 | inc (hl) 986 | ret 987 | 988 | TEXTProgram: 989 | .db "PROGRAM:",0 990 | TEXTGoUp: 991 | .db "Top",0 992 | TEXTGoDown: 993 | .db "Btm",0 994 | TEXTGoUpFR: 995 | .db "Haut",0 996 | TEXTGoDownFR: 997 | .db "Bas",0 998 | endInstantGoto: 999 | #include "editMem.z80" 1000 | endHomescreenHook: -------------------------------------------------------------------------------- /SRC/PHASM.8XP/PHASM.z80: -------------------------------------------------------------------------------- 1 | .nolist 2 | #include "ti84pce.inc" 3 | #macro bcall(x) 4 | call x 5 | #endmacro 6 | #DEFINE AppVarSize InPS2-TempBuf + InGetCSC-cpyInRAM + endInstantGoto-cpyInRAMGetCSC + endMemoryEditor-menuAppVar 7 | #DEFINE editArchivedProg 7 ; flag 8 | #DEFINE isProtected 6 ; flag 9 | #DEFINE GoUpDisplayed 5 ; flag 10 | #DEFINE GoDownDisplayed 4 ; flag 11 | #DEFINE archivedBasic 3 ; flag 12 | #DEFINE bugOccured pixelShadow 13 | #DEFINE nbrLbls pixelshadow2 14 | #DEFINE lastLblDisplayed pixelshadow2+3 15 | #DEFINE mn pixelshadow2+6 ; used as register 16 | #DEFINE nbrPrgmUnarc pixelshadow2+9 17 | ; Memory Editor Feature 18 | #DEFINE nbrAVIgnore pixelshadow2 ; MENU : displays AppVars from (nbrAVIgnore) to (nbrAVIgnore)+9 19 | #DEFINE namesBuf pixelshadow2+1 ; MENU : stores AV names 20 | #DEFINE cursorDataX pixelshadow2 ; EDIT : Horiz Pos of cursor [0-3] 21 | #DEFINE cursorDataY pixelshadow2+1 ; EDIT : Verti Pos of cursor [0-6] 22 | #DEFINE fstElWin pixelshadow2+3 ; MENU+EDIT : current address in the editor (First Element in Window) 23 | ; Flags of Memory Editor Feature 24 | #DEFINE baseADDR 2 ; AppVar = 0 / raw addr = 1 25 | #DEFINE emptyMenu 1 ; menu does not contain any Appvar = 1 26 | #DEFINE secNibble 2 ; edting MSB of (fstElWin) = 1 / edting LSB of (fstElWin) = 0 27 | #DEFINE archivedAV 1 ; AV that's being edited is located in Archive 28 | #DEFINE isTi84CE 3 ; The calculator is a TI-84+CE = 1 / The calculator is a TI-83PCE = 0 29 | .list 30 | .org userMem-2 31 | .db tExtTok,tAsm84CeCmp 32 | 33 | call _clrlcdfull 34 | bit homescreenHookActive, (IY+hookFlags2) 35 | jp nz,uninstallPHASM 36 | res editArchivedProg, (IY+asm_Flag3) 37 | 38 | ld hl,Group 39 | call _mov9ToOp1 40 | call _chkfindsym 41 | 42 | jp c,doesNotExist 43 | ld hl,32 44 | add hl,de 45 | call _setHomescreenHook 46 | ld de,200 47 | add hl,de 48 | call _setMenuHook 49 | ld de,162 50 | add hl,de 51 | call _setGetCSCHook 52 | ld de,103 53 | add hl,de 54 | call _setParserHook 55 | 56 | ld hl,AppVar 57 | call _Mov9ToOP1 58 | call _chkfindsym 59 | call nc,_DELVARARC 60 | ld hl,AppVarSize 61 | push hl 62 | call _createAppVar 63 | inc de 64 | inc de 65 | ld hl,TempBuf 66 | pop bc 67 | ldir 68 | 69 | ld hl,(localLanguage) 70 | ld de,$02010C ; if French 71 | or a 72 | sbc hl,de 73 | ld hl,installed 74 | jr nz,INSisEN 75 | ld hl,installedFR 76 | INSisEN: 77 | ld a,3 78 | ld (curcol),a 79 | ld (currow),a 80 | call _puts 81 | jp Quit 82 | 83 | 84 | uninstallPHASM: 85 | res homescreenHookActive, (IY+hookFlags2) 86 | res getCSCHookActive, (IY+hookFlags2) 87 | res MenuHookActive, (IY+hookFlags2) 88 | res ParserHookActive, (IY+hookFlags2) 89 | 90 | ld hl,AppVar 91 | call _Mov9ToOP1 92 | call _chkfindsym 93 | call nc,_DELVARARC 94 | 95 | ld hl,(localLanguage) 96 | ld de,$02010C ; if French 97 | or a 98 | sbc hl,de 99 | ld hl,uninstalled 100 | jr nz,UNisEN 101 | ld hl,uninstalledFR 102 | UNisEN: 103 | ld a,3 104 | ld (curcol),a 105 | ld (currow),a 106 | call _puts 107 | jr Quit 108 | 109 | 110 | doesNotExist: 111 | ld hl,(localLanguage) 112 | ld de,$02010C ; if French 113 | or a 114 | sbc hl,de 115 | ld hl,doesNotExistText 116 | jr nz,MISisEN 117 | ld hl,nexistePas 118 | MISisEN: 119 | ld a,4 120 | ld (curcol),a 121 | ld a,1 122 | ld (currow),a 123 | call _puts 124 | ld a,6 125 | ld (curcol),a 126 | ld a,2 127 | ld (currow),a 128 | call _puts 129 | push hl 130 | ld hl,2 131 | ld (curcol),hl 132 | ld a,5 133 | ld (currow),a 134 | pop hl 135 | call _puts 136 | ld a,2 137 | ld (curcol),a 138 | ld a,6 139 | ld (currow),a 140 | call _puts 141 | 142 | Quit: 143 | res editArchivedProg, (IY+asm_Flag3) 144 | call _getkey 145 | call _Clrtxtshd 146 | call _clrlcdfull 147 | call _homeup 148 | ret 149 | 150 | Group: 151 | .db GroupObj,"PHASM",0 152 | AppVar: 153 | .db AppVarObj,"PH",0 154 | doesNotExistText: 155 | .db "The PHASM Group is",0," missing.",0 156 | .db "Please transfer it and",0,"run this program again.",0 157 | nexistePas: 158 | .db " Le Groupe PHASM",0,"n'existe pas...",0 159 | .db "Veuillez le transf",LeAcute,"rer",0," et re-ex",LeAcute,"cuter PHASM",0 160 | installed: 161 | .db "PHASM is now online!",0 162 | uninstalled: 163 | .db "PHASM is now offline.",0 164 | installedFR: 165 | .db "PHASM a ",LeAcute,"t",LeAcute," activ",LeAcute," !",0 166 | uninstalledFR: 167 | .db "PHASM a ",LeAcute,"t",LeAcute," d",LeAcute,"sactiv",LeAcute,0 168 | 169 | 170 | #include "AppVar.z80" 171 | .echo InPS2 - TempBuf + InGetCSC - cpyInRAM 172 | .echo endInstantGoto-cpyInRAMGetCSC 173 | .echo AppVarSize 174 | .end --------------------------------------------------------------------------------