;--------------->Plasma<------------------ ;Version 1.0 ; ;The source code to Plasma is freely available. ;(This includes plasma.asm, gui.asm and load.asm. [It does not include ;ionlibs.asm this code was written by Joe Wingbermuehle and ;used with permission. If you would like to use it in your code ;you must contact Joe Wingbermuehle ;and get his permission.]) ;The source must be packaged with the compiled binaries. ;Any one can modify, recompile, then distribute the source code. ;The source must be released on the modified version and must ;carry this copy right at the top of the source files. ;Before releasing the program a ;e-mails explaining what kind of program the code was used for ;should be sent to the following people: ;Joe Flint ;Brandon Engelberth ;This is so we know if the code is ever actualy used. If you optimize ;or fix a bug it would be very much appreciated if you would email ;it to the above people. This way they can be included in the official ;releases of Plasma. ;Authors: ;Joe Flint - GUI ;JoeFlint@calc.org ; ;Brandon Engelberth - CORE, LOADER ;reddwarf_lester@yahoo.com ; ;Enjoy! GDown .equ 01h GLeft .equ 02h GRight .equ 03h GUp .equ 04h GMode .equ 37h GAlpha .equ 30h G2nd .equ 36h GEnter .equ 09h GF1 .equ 35h progx = gui numback = gui+2 count = gui+3 startgui: bcall(_indicatoroff) bcall(_cleargbuf) ld a,8 ld (progx),a xor a ld (barup),a ld (numback),a ld hl,0 ld (count),hl call drawscreen call drawprogtext1 call drawrect call fastcopy keyloop: bcall(_getcsc) cp 0 call nz,resetcount cp GDown call z,movedown cp GUP call z,moveup cp GMODE jp z,exit cp Galpha call z,showbar cp Genter call z,runprog cp gf1 call z,runprog cp g2nd call z,runprog cp Gright call z,pagedown cp gleft call z,pageup in a,(0) cp 3 jp nz,exit ld hl,(count) inc hl ld (count),hl ld de,40000 bcall(_cphlde) jp z,exit jp keyloop resetcount: ld hl,0 ld (count),hl ret runprog: bcall(_cleargbuf) call exec_prog bcall(_cleargbuf) call redrawt call drawscreen call drawrect jp fastcopy redrawt: ld a,(numback) ld b,a ;inc b or a call nz,jump_prev_b_progs call drawprogtext1 ld a,(numback) ld b,a or a ret z call jump_next_b_progs ret drawscreen: ld d,0 ld e,6 ld c,1 ld b,96 call H_line ld e,5 ld b,95 call H_line ld e,1 ld b,6 call V_line ld d,37 call V_line ld a,1 ld (pencol),a ld a,0 ld (penrow),a ld hl,plasmatxt SET textwrite, (IY+sgrflags) set textInverse, (iy+textflags) ; Sets inverse. bcall(_vputs) res textInverse, (iy+textflags) ; Sets inverse. res textwrite, (iy+sgrflags) ret barup: .db 0 exittxt: .db "Plasma 1.0",0 exit: bcall(_clrscrf) bcall(_homeup) bcall(_cleargbuf) ld hl,exittxt bcall(_puts) ret drawprogtext1: SET textwrite, (IY+sgrflags) xor a ld (pencol),a ld a,8 ld (penrow),a ld e,0 ld b,9 drawprogtext: push bc push de ld hl,Data_Prog_Desc bcall(_vputs) xor a ld (pencol),a call next_prog or a jp z,nomoreprogs pop de inc e ld a,(penrow) add a,6 ld (penrow),a pop bc djnz drawprogtext ld a,56 ld (mstop+1),a backtothis: ld a,e ld b,e or a call nz,jump_prev_b_progs res textwrite, (IY+sgrflags) ret nomoreprogs: pop de pop bc ld a,(penrow) ld (mstop+1),a jp backtothis movedown: ld a,(barup) dec a call z,fixtext ld a,(progx) mstop: cp 56 jp z,newprogdown ld b,6 movedownl: push bc call drawrect ld a,(progx) inc a ld (progx),a call drawrect call FastCopy pop bc djnz movedownl xor a ld (barup),a ld a,(numback) inc a ld (numback),a jp next_prog moveup: ld a,(barup) dec a call z,fixtext ld a,(progx) cp 8 jp z,newprogup ld b,6 moveupl: push bc call drawrect ld a,(progx) dec a ld (progx),a call drawrect call FastCopy pop bc djnz moveupl xor a ld (barup),a ld a,(numback) dec a ld (numback),a jp prev_prog dispsize: ld a,(progx) ld (penrow),a ld a,40 ld (pencol),a ld hl,(Data_Prog_Size) bcall(_setxxxxop2) bcall(_op2toop1) ld a,5 bcall(_dispop1a) ret pageup: ;ld b,9 pageup1: ;push bc ;call moveup ;pop bc ;djnz pageup1 ;ret ld b,9 call jump_prev_b_progs cp 9 jp nz,fix2 ld a,(numback) ld b,a or a call nz,jump_prev_b_progs bcall(_cleargbuf) call drawscreen call drawprogtext1 ld a,(numback) ld b,a or a call nz,jump_next_b_progs call drawrect call fastcopy ret pagedown: ;ld b,9 pagedown1: xor a ld (pencol),a ld (penrow),a ;push bc ;call movedown ;pop bc ;djnz pagedown1 ;ret ld a,(numback) ld b,a or a call nz,jump_prev_b_progs ld b,9 call jump_next_b_progs cp 9 jp z,godraw nogo: ld b,a or a call nz,jump_prev_b_progs ld a,(numback) ld b,a or a call nz,jump_next_b_progs xor a ;Yes i'm cheating, so what ret godraw: bcall(_cleargbuf) call drawscreen call drawprogtext1 ld a,(numback) ld b,a or a call nz,jump_next_b_progs ld (numback),a ld a,(mstop+1) ld b,a ld a,(progx) cp b call p,nomore call drawrect call fastcopy ret fix2: ld b,a or a call nz,jump_next_b_progs ret nomore: ld a,(mstop+1) ld (progx),a ret newprogdown: call next_prog or a ret z ld a,(numback) ld b,a call jump_prev_b_progs ld a,(progx) sub 6 ld (progx),a bcall(_cleargbuf) call drawscreen call drawprogtext1 ld a,(numback) dec a ld b,a call jump_next_b_progs call drawrect ld a,(numback) dec a ld (numback),a jp movedown ret newprogup: call prev_prog or a ret z ld a,(progx) add a,6 ld (progx),a bcall(_cleargbuf) call drawscreen call drawprogtext1 call next_prog call drawrect ld a,(numback) inc a ld (numback),a jp moveup ret showbar: ld c,1 ld b,96 ld d,0 ld a,(progx) ld e,a call h_line inc e call h_line inc e call h_line inc e call h_line inc e call h_line inc e call h_line inc e call h_line ld a,(progx) ld (penrow),a xor a ld (pencol),a set textInverse, (iy+textflags) ; Sets inverse. set textwrite, (IY+sgrflags) ld a,(Data_Flash_off_set) cp 0 jp z,inram ld hl,ast bcall(_vputs) inram: ld hl,Data_Prog_Name bcall(_vputs) call dispsize res textwrite, (IY+sgrflags) res textInverse, (iy+textflags) ; Sets inverse. call FastCopy ld a,1 ld (barup),a ret drawrect: ld c,2 ld b,96 ld d,0 ld a,(progx) ld e,a call h_line inc e call h_line inc e call h_line inc e call h_line inc e call h_line inc e call h_line inc e call h_line ret ast: .db "*",0 fixtext: ld c,1 ld b,96 ld d,0 ld a,(progx) ld e,a call h_line inc e call h_line inc e call h_line inc e call h_line inc e call h_line inc e call h_line inc e call h_line ld a,(progx) ld (penrow),a xor a ld (pencol),a ld hl,Data_Prog_Desc set textInverse, (iy+textflags) ; Sets inverse. set textwrite, (IY+sgrflags) bcall(_vputs) res textwrite, (IY+sgrflags) res textInverse, (iy+textflags) ; Sets inverse. ret Plasmatxt: .db " Plasma 1.0",0 SampleProg: .db "A program",0 Getpix: ld d, 0 ld h, d ld l, e add hl, de add hl, de add hl, hl add hl, hl ld de, Plotsscreen add hl, de Getbit: ld b, 0 ld c, a and %00000111 srl c srl c srl c add hl, bc ld b, a inc b ld a, %00000001 GBLoop: RRCA djnz GBLoop ret V_Line: push de push hl push bc ld a, d call Getpix pop bc push bc ld d, c ld c, a ld a, d ld de, 12 or a call z, V_White_Line dec a call z, V_Black_Line dec a call z, V_XORed_Line pop bc pop hl pop de ret V_White_Line: ld a, c CPL ld c, a V_White_Line_2: ld a, (hl) and c ld (hl), a add hl, de DJNZ V_White_Line_2 xor a ret V_Black_Line: ld a, (hl) or c ld (hl), a add hl, de DJNZ V_Black_Line xor a ret V_XORed_Line: ld a, (hl) xor c ld (hl), a add hl, de DJNZ V_XORed_Line ret H_Line: push de push hl push bc ld a, d call Getpix pop bc push bc ld d, c ld c, a ld a, d or a call z, H_White_Line dec a call z, H_Black_Line dec a call z, H_XORed_Line pop bc pop hl pop de ret H_White_Line: ld a, c CPL ld c, a H_White_Line_2: ld a, (hl) and c ld (hl), a RR c jr c, Cont_H_White_Line inc hl RR c Cont_H_White_Line: DJNZ H_White_Line xor a ret H_Black_Line: ld a, (hl) or c ld (hl), a RR c jr nc, Cont_H_Black_Line inc hl RR c Cont_H_Black_Line: DJNZ H_Black_Line xor a ret H_XORed_Line: ld a, (hl) xor c ld (hl), a RR c jr nc, Cont_H_XORed_Line inc hl RR c Cont_H_XORed_Line: DJNZ H_XORed_Line ret .end