#include "asm86.h" #include "ti86abs.inc" #include "ti86asm.inc" .org _asm_exec_ram xor a ld (cur_group),a ld hl,pointers_into_vat ld (cur_program),hl ld (selected_item),hl redo_the_info: ld a,$47 out (6),a set 1,(iy+5) call $49DC call _runindicoff ld hl,$BFFF ld bc,pointers_into_vat travel_vat_loop: ld a,(hl) ld de,-5 add hl,de cp $12 ;see if its a program jr nz,travel_vat inc hl ld d,(hl) dec hl ld a,(cur_group) cp d jr z,group_okay_to_show cp 4 jr nz,travel_vat ld a,d cp 5 jr c,travel_vat group_okay_to_show: dec hl ld a,(hl) inc hl cp 'A' jr c,travel_vat call compare_op1_ jr z,travel_vat ld de,peng_var call compare_op1 jr z,travel_vat ld de,icon_var call compare_op1 jr z,travel_vat ld a,l ld (bc),a inc bc ld a,h ld (bc),a inc bc travel_vat: ld a,(hl) cpl ld e,a ld d,$FF add hl,de ld de,($D298) push hl or a sbc hl,de pop hl jr nz,travel_vat_loop ld (num_programs),bc ld hl,(selected_item) or a sbc hl,bc jr nz,redisplay ld d,b ld e,c ld (selected_item),de ld hl,pointers_into_vat or a sbc hl,de jr nc,redisplay ld (selected_item),hl ;this is the main shell loop (display up to 24 names) redisplay: ld hl,$FC00 ld de,$F600 ld bc,$0400 ldir halt ld a,$76 out (0),a call _clrlcd ld hl,$FC00 ld a,$80 call fill_column ld hl,$FC0F ld a,$01 call fill_column ld hl,$FF80 ld b,16 fill_the_row: ld (hl),$FF inc hl djnz fill_the_row set 3,(iy+5) ld hl,$0001 ld (_penCol),hl ld hl,title_str call _vputs res 3,(iy+5) ld a,$39 ld (_penRow),a ld b,5 ld hl,group_str show_group_names: ld a,(hl) inc hl ld (_penCol),a call _vputs djnz show_group_names ld a,(cur_group) ld b,a add a,a add a,b add a,$90 ld h,$FF ld l,a ld bc,$0307 ld de,13 invert_pixel: ld a,$FF xor (hl) ld (hl),a inc hl djnz invert_pixel ld b,3 add hl,de dec c jr nz,invert_pixel ld de,(cur_program) ld c,24 ld hl,(num_programs) or a sbc hl,de jr nz,show_this_screen ld hl,$1F21 ld (_penCol),hl ld hl,no_programs_str call _vputs jr show_back_time show_this_screen: ld hl,(_penCol) push hl ld a,(de) ld l,a inc de ld a,(de) ld h,a inc de push de dec de call show_select_var_ pop de pop hl ld hl,(num_programs) or a sbc hl,de jr z,show_back_time dec c jr nz,show_this_screen show_back_time: set 3,(iy+5) call show_select_var res 3,(iy+5) halt ld a,$7C out (0),a we_are_done: ld bc,$2800 wait_for_key: halt push bc call _getky pop bc cp K_ALPHA jr z,power_off cp K_RIGHT jp z,go_right cp K_UP jp z,go_up cp K_DOWN jp z,go_down cp K_LEFT jp z,go_left cp K_EXIT jp z,exit_routine cp K_SECOND jp z,execute_program cp K_PLUS jr z,contrast_up cp K_MINUS jr z,contrast_down cp K_STO jr z,store_to_group cp K_DEL jr z,delete_this sub K_F5 ;must be last tested key jp nc,change_group dec bc ld a,b or c jr nz,wait_for_key power_off: ld a,1 out (3),a halt ld a,11 out (3),a jr we_are_done store_to_group: halt call _getky or a jr z,store_to_group sub K_F5 jp c,we_are_done sub 5 jp nc,we_are_done cpl ld c,a store_to_group_: ld de,(selected_item) ld hl,(num_programs) or a sbc hl,de jp z,we_are_done ld a,(de) ld l,a inc de ld a,(de) ld h,a inc hl ld (hl),c jp redo_the_info change_group: sub 5 jp nc,wait_for_key cpl ld (cur_group),a ld hl,pointers_into_vat ld (selected_item),hl jp redo_the_info contrast_up: ld hl,$c008 ld a,(hl) cp $1f jp z,we_are_done inc a ld (hl),a out (2),a jp we_are_done contrast_down: ld hl,$c008 ld a,(hl) or a jp z,we_are_done dec a ld (hl),a out (2),a jp we_are_done delete_this: ld e,4 ld a,(cur_group) cp 4 jr c,store_to_group_ ld de,(selected_item) ld hl,(num_programs) or a sbc hl,de jp z,we_are_done ld a,(de) ld l,a inc de ld a,(de) ld h,a ld de,_OP1+1 ld b,(hl) inc b delete_copy: ld a,(hl) ld (de),a inc de dec hl djnz delete_copy rst 10h call _delvar pop de jp redo_the_info execute_program: ld hl,(selected_item) push hl ld hl,(cur_program) push hl ld a,(cur_group) push af res onInterrupt,(iy+onflags) ld hl,(num_programs) ld de,(selected_item) or a sbc hl,de jp z,we_are_done ld a,(de) ld l,a inc de ld a,(de) ld h,a push hl ld de,_OP1+1 ld b,(hl) inc b execute_copy: ld a,(hl) ld (de),a dec hl inc de djnz execute_copy res 1,(iy+5) pop hl inc hl inc hl ld a,(hl) inc hl ld d,(hl) inc hl ld l,(hl) ld h,d call $521D call $46AF bit 0,c jr nz,exec_basic call _exec_assembly jr continue_recovery exec_basic: call _clrscrn call _homeup ld hl,compiling_str call _puts call _runindicon call $4C47 continue_recovery: pop af ld (cur_group),a pop hl ld (cur_program),hl pop hl ld (selected_item),hl ei jp redo_the_info go_right: ld de,(selected_item) ld hl,17 add hl,de ex de,hl jr forward_commons go_down: ld de,(selected_item) inc de inc de inc de forward_commons: ld hl,(num_programs) or a sbc hl,de jp c,we_are_done ld hl,(cur_program) ld bc,48 add hl,bc sbc hl,de jr nc,no_scroll_forward ld hl,(cur_program) ld bc,16 add hl,bc ld (cur_program),hl dec de ld (selected_item),de jp redisplay no_scroll_forward: dec de push de call show_select_var pop de ld (selected_item),de jp show_back_time go_up: ld de,(selected_item) dec de jr backward_commons go_left: ld hl,(selected_item) ld de,-15 add hl,de ex de,hl backward_commons: ld hl,pointers_into_vat or a sbc hl,de jp nc,we_are_done ld hl,(cur_program) or a sbc hl,de jr c,no_scroll_forward ld hl,(cur_program) ld bc,-16 add hl,bc ld (cur_program),hl dec de ld (selected_item),de jp redisplay exit_routine: call _clrscrn res 1,(iy+5) res 5,(iy) res onInterrupt,(iy+onflags) jp _homeup compare_op1_: push hl push bc ld de,this_var+1 ld a,(hl) cp 5 jr nz,bad_value dec hl ld a,(hl) and %11011111 cp 'B' jr nz,bad_value dec hl ld b,4 jr compare_op1__ compare_op1: push hl push bc dec hl ld a,(de) ld b,a compare_op1__: inc de ld a,(de) cp (hl) jr nz,bad_value dec hl djnz compare_op1__ bad_value: pop bc pop hl ret show_select_var: ld de,(selected_item) ld hl,(num_programs) or a sbc hl,de ret z ld a,(de) ld l,a inc de ld a,(de) ld h,a show_select_var_: dec de push hl ex de,hl ld de,(cur_program) or a sbc hl,de ld a,l and %00001110 ld d,a add a,a add a,a add a,7 sub d ld d,a ld a,l and %11110000 rrca ld b,a add a,a ;*16 add a,a ;*32 add a,b ;*40 inc a ld e,a ld (_penCol),de pop hl ld b,(hl) dec hl ld a,' ' call _vputmap show_it_loop: ld a,(hl) call _vputmap dec hl djnz show_it_loop ret fill_column: ld b,56 ld de,16 fill_column_loop: ld (hl),a add hl,de djnz fill_column_loop ret title_str: .db " Byronic Shell v0.3" .db " (C) Kirk " .db "Meyer ",0 group_str: .db 6,"Fun",0 ;6 .db 28,"Math",0 ;3 .db 53,"Utils",0 ;4 .db 77,"Misc",0 ;4 .db 99,"Trash",0 ;2 no_programs_str: .db "NO PROGRAMS HERE",0 compiling_str: .db "Preparing program... ",0 this_var: .db 5,"byron" peng_var: .db 5,"ZPWLD" icon_var: .db 4,"icon" ;use the empty space to store info cur_program = $ selected_item = $ + 2 num_programs = $ + 4 cur_group = $ + 6 pointers_into_vat = $ + 7 .end