; blink.asm -- resident blink hooked on the display interrupt via the firmware's ; own RAM trampoline at bit 00000DB0h (RLONG(0xFFFFFEA0) = 00000DB0h). ; ; `install` (called by rdebug `jump`, returns) rewrites the 6-byte ; `JA 3F7146D0h` stub to `JA handler`. `handler` runs on every display ; interrupt, toggles a 64x64 box on the Terminal Manager's white body every ; 0600h invocations, then tail-jumps to the stock OS display handler. ; ; This is the "draw before the OS handler" variant. If the OS handler repaints ; afterwards, the box will not survive; that is what the frames decide. ; ; Linked at bit 01840000h by dwt/visual/build.sh. .text _start: pushst dint setf 32, 0, 0 movi handler, a0, L move a0, @00000DC0h, 0 ; stub target setf 16, 0, 0 movi 0C080h, a0, L move a0, @00000DB0h, 0 ; JA opcode sub a0, a0 move a0, @0186F000h, 0 ; counter move a0, @0186F002h, 0 ; state (0 = black) popst rets handler: mmtm sp, a0,a1,a2,a3,a4,a5 setf 16, 0, 0 setf 32, 0, 1 move @0186F000h, a0, 0 inc a0 move a0, @0186F000h, 0 cmpi 0600h, a0 jrne draw sub a0, a0 move a0, @0186F000h, 0 move @0186F002h, a1, 0 cmpi 0, a1 jrne was_white movk 1, a1 jruc set_state was_white: sub a1, a1 set_state: move a1, @0186F002h, 0 draw: move @0186F002h, a1, 0 cmpi 0, a1 jrne pat_white sub a2, a2 jruc pat_ready pat_white: movi 0FFFFh, a2, L pat_ready: movi 04064100h, a3, L ; 04000000h + 400*1024 + 256 movi 64, a4, L movi 4, a5, L drow: move a5, a1 dword: move a2, *a3+, 0 dsjs a1, dword addi 03C0h, a3 dsjs a4, drow mmfm sp, a0,a1,a2,a3,a4,a5 jauc 3F7146D0h ; stock OS display handler .end