|
2 | 2 |
|
3 | 3 | .assume adl = 1 |
4 | 4 |
|
5 | | - .set ti.mpTmr1Counter, 0x0F20000 |
6 | | - .set ti.mpTmrCtrl, 0x0F20030 |
| 5 | + .equ ti.mpTmr1Counter, 0x0F20000 |
| 6 | + .equ ti.mpTmrCtrl, 0x0F20030 |
7 | 7 |
|
8 | | - .set ti.bTmr1Enable, 0 |
9 | | - .set ti.bTmr1Crystal, 1 |
10 | | - .set ti.bTmr1Overflow, 2 |
11 | | - .set ti.bTmr1CountUp, 9 |
| 8 | + .equ ti.bTmr1Enable, 0 |
| 9 | + .equ ti.bTmr1Crystal, 1 |
| 10 | + .equ ti.bTmr1Overflow, 2 |
| 11 | + .equ ti.bTmr1CountUp, 9 |
12 | 12 |
|
13 | | - .set ti.Arc_Unarc, 0x021448 |
14 | | - .set ti.usb_ResetTimer, 0x00004F0 |
15 | | - .set ti.usb_DisableTimer, 0x00004F4 |
16 | | - .set ti.HomeUp, 0x020828 |
17 | | - .set ti.DrawStatusBar, 0x021A3C |
18 | | - .set ti.ChkFindSym, 0x02050C |
19 | | - .set ti.Mov9ToOP1, 0x020320 |
20 | | - .set ti.PutS, 0x0207C0 |
21 | | - .set ti.ChkInRam, 0x021F98 |
22 | | - .set ti.OP1, 0xD005F8 |
23 | | - .set ti.OP3, 0xD0060E |
24 | | - .set ti.AppVarObj, 0x15 |
25 | | - .set ti.ClrScrn, 0x020814 |
26 | | - .set ti.NewLine, 0x0207F0 |
27 | | - .set ti.GetKey, 0x020D8C |
28 | | - .set ti.flags, 0xD00080 |
29 | | - .set ti.RunIndicOff, 0x020848 |
30 | | - .set ti.PushRealO1, 0x020614 |
31 | | - .set ti.Mov8b, 0x020304 |
32 | | - .set ti.AnsName, 0x020FF4 |
33 | | - .set ti.FindSym, 0x020510 |
34 | | - .set ti.StrngObj, 4 |
35 | | - .set ti.Get_Tok_Strng, 0x020870 |
36 | | - .set ti.Isa2ByteTok, 0x0204AC |
37 | | - .set ti.PopRealO1, 0x0205DC |
38 | | - .set ti.MovFrOP1, 0x02032C |
39 | | - .set ti.ClrLCDFull, 0x020808 |
| 13 | + .equ ti.Arc_Unarc, 0x021448 |
| 14 | + .equ ti.usb_ResetTimer, 0x00004F0 |
| 15 | + .equ ti.usb_DisableTimer, 0x00004F4 |
| 16 | + .equ ti.HomeUp, 0x020828 |
| 17 | + .equ ti.DrawStatusBar, 0x021A3C |
| 18 | + .equ ti.ChkFindSym, 0x02050C |
| 19 | + .equ ti.Mov9ToOP1, 0x020320 |
| 20 | + .equ ti.PutS, 0x0207C0 |
| 21 | + .equ ti.ChkInRam, 0x021F98 |
| 22 | + .equ ti.OP1, 0xD005F8 |
| 23 | + .equ ti.OP3, 0xD0060E |
| 24 | + .equ ti.AppVarObj, 0x15 |
| 25 | + .equ ti.ClrScrn, 0x020814 |
| 26 | + .equ ti.NewLine, 0x0207F0 |
| 27 | + .equ ti.GetKey, 0x020D8C |
| 28 | + .equ ti.flags, 0xD00080 |
| 29 | + .equ ti.RunIndicOff, 0x020848 |
| 30 | + .equ ti.PushRealO1, 0x020614 |
| 31 | + .equ ti.Mov8b, 0x020304 |
| 32 | + .equ ti.AnsName, 0x020FF4 |
| 33 | + .equ ti.FindSym, 0x020510 |
| 34 | + .equ ti.StrngObj, 4 |
| 35 | + .equ ti.Get_Tok_Strng, 0x020870 |
| 36 | + .equ ti.Isa2ByteTok, 0x0204AC |
| 37 | + .equ ti.PopRealO1, 0x0205DC |
| 38 | + .equ ti.MovFrOP1, 0x02032C |
| 39 | + .equ ti.ClrLCDFull, 0x020808 |
40 | 40 |
|
| 41 | +#if !HAS_APPLICATION |
41 | 42 | .section .header,"ax",@progbits |
42 | 43 |
|
43 | 44 | .local __header |
44 | 45 | __header: |
45 | 46 | .db 0xEF, 0x7B, 0x00 ; 0x00 is signifier for C programs |
| 47 | +#endif |
46 | 48 |
|
47 | 49 | .section .init,"ax",@progbits |
48 | 50 |
|
| 51 | +#if HAS_APPLICATION |
| 52 | + .equ ti.onSP, 0xD007FA |
| 53 | + .equ ti.ResetStacks, 0x02103C |
| 54 | + .equ ti.asm_prgm_size, 0xD0118C |
| 55 | + .equ ti.JForceCmd, 0x020164 |
| 56 | + .equ ti.kClear, 0x09 |
| 57 | + .equ ti.DelMem, 0x020590 |
| 58 | + .equ ti.userMem, 0xD1A881 |
| 59 | + .equ ti.pixelShadow, 0xD031F6 |
| 60 | + .equ ti.textShadow, 0xD006C0 |
| 61 | + .equ ti.cmdShadow, 0xD0232D |
| 62 | + .equ ti.MemClear, 0x0210DC |
| 63 | + .equ ti.ClrTxtShd, 0x020818 |
| 64 | + |
| 65 | + ld iy, ti.flags |
| 66 | + ld sp, (ti.onSP) ; reset stacks |
| 67 | + call ti.ResetStacks |
| 68 | + ld hl, ___data_lma |
| 69 | + ld de, ___data_vma |
| 70 | + ld bc, ___data_len |
| 71 | + ldir ; there is always .data, no need for zero check |
| 72 | + call __start |
| 73 | + ld de, (ti.asm_prgm_size) |
| 74 | + ld hl, ti.userMem |
| 75 | + call ti.DelMem |
| 76 | + or a,a |
| 77 | + sbc hl,hl |
| 78 | + ld (ti.asm_prgm_size),hl |
| 79 | + ld hl, ti.pixelShadow |
| 80 | + ld bc, 8400 * 3 |
| 81 | + call ti.MemClear |
| 82 | + call ti.ClrTxtShd |
| 83 | + ld hl, ti.textShadow |
| 84 | + ld de, ti.cmdShadow |
| 85 | + ld bc, $104 |
| 86 | + ldir |
| 87 | + ld a, ti.kClear |
| 88 | + jp ti.JForceCmd |
| 89 | +#endif |
| 90 | + |
49 | 91 | .global __start |
50 | 92 | __start: |
51 | 93 | ld iy, ti.flags |
@@ -107,8 +149,10 @@ __start: |
107 | 149 | call ti.PutS |
108 | 150 | jp ti.GetKey |
109 | 151 |
|
| 152 | +#if !HAS_APPLICATION |
110 | 153 | ___libload_libs: |
111 | 154 | LIBLOAD_LIBS ; autogenerated by cedev-obj |
| 155 | +#endif |
112 | 156 | #endif |
113 | 157 |
|
114 | 158 | call ti.RunIndicOff ; assumes iy = flags |
@@ -336,14 +380,22 @@ _abort: |
336 | 380 | ld hl, 6 ; SIGABRT |
337 | 381 | .L.skip._abort: |
338 | 382 | #endif |
339 | | - ld sp,0 |
| 383 | +#if HAS_APPLICATION |
| 384 | + ld sp, (_exit.sp) |
| 385 | +#else |
| 386 | + ld sp, 0 |
340 | 387 | .global _exit.sp |
341 | 388 | .equ _exit.sp, $ - 3 |
| 389 | +#endif |
342 | 390 | push hl |
343 | 391 | ld iy, ti.flags |
| 392 | +#if HAS_APPLICATION |
| 393 | + ld a, (_exit.flash_wait_states) |
| 394 | +#else |
344 | 395 | ld a, 0 |
345 | 396 | .local _exit.flash_wait_states |
346 | 397 | .equ _exit.flash_wait_states, $ - 1 |
| 398 | +#endif |
347 | 399 | ld (0xE00305), a |
348 | 400 | call ti.usb_ResetTimer |
349 | 401 | ld a, 1 |
@@ -389,6 +441,19 @@ __webaddress: |
389 | 441 | .db "http://tiny.cc/clibs",0 |
390 | 442 | #endif |
391 | 443 |
|
| 444 | +#if HAS_APPLICATION |
| 445 | + .section .bss |
| 446 | + .global _exit.sp |
| 447 | +_exit.sp: |
| 448 | + .d24 0 |
| 449 | +_exit.flash_wait_states: |
| 450 | + .db 0 |
| 451 | + |
| 452 | + .section .data |
| 453 | +___libload_libs: |
| 454 | + LIBLOAD_LIBS ; autogenerated by cedev-obj |
| 455 | +#endif |
| 456 | + |
392 | 457 | #if HAS_MAIN_ARGC_ARGV |
393 | 458 | .extern ___main_argc_argv |
394 | 459 | #else |
|
0 commit comments