;Mini-Shell Enhanced by Chicane ;version 1.4 #include "asm86.h" #include "ti86asm.inc" #include "ti86ops.inc" _ldhlz equ $437B ;Write b zeros to hl. _load_ram_ahl equ $462F ;Converts ahl to ASIC, loads RAM page. _jforce equ $409C ;Force exit from program. _pause equ $4D43 ;Wait for keypress. _hldiv10 equ $4044 ;Divide hl by 10. _homeup equ $4A95 ;Resets _curRow to 0,0. _dispahl equ $4a33 ;Displays ahl in decimal. _get_word_ahl equ $521d ;ld de,(ahl) _pop_OP1 equ $47B7 ;Pops OP1 from the FP stack. _push_OP1 equ $4813 ;Pushes OP1 onto the FP stack. _PrevPrgm equ $514F ;Find variable alphabetically previous to OP1. _NextPrgm equ $514B ;Find variable alphabetically after OP1. _exec_basic equ $4C57 ;Execute TI-BASIC program in OP1. _exec_asm equ $5730 ;Execute z80 assembly program in OP1. _runoff equ $4AB1 ;Disable run indicator. _runon equ $4AAD ;Enable run indicator. _checkbasic equ $46AB ;Check program in OP1 for TI-BASIC. _checkasm equ $46AF ;Check program in OP1 for z80 assembly. _off equ $4101 ;Turn off calc. _getcode equ $4068 ;Get scancode, but 1000's of clocks faster than GET_KEY. .org _asm_exec_ram ASMstart: KillMSE: ld hl,VatPtr-1 ;MSE's op entry. rst 20h ;(hl) -> OP1. rst 10h ;_FINDSYM ld (hl),$0C ;Change MSE to a string (type $0C). Display: call _runoff ;Turn off the busy indicator. call _clrScrn ;Clear the screen and _textshadow. ld hl,$0001 ;First row, second column. ld (_penCol), hl ld hl,PrgmName ;Load the text offset into hl. call _vputs ;Output in vfont. ld a,$6C ld (_penCol),a call _vputs ld b,57 ;It's 57 pixels long. ld hl,$FC75 ;It's in the 5th byte of the 7th row. ld a,%01000000 ;It's the second pixel of the byte. ld de,$0010 ;We need to add $10 to hl each time. Line: ld (hl),a ;Write bit. add hl,de ;Move hl to next byte down. djnz Line ;If we're not done yet, loop. ld hl,$082B ld (_penCol),hl set 3,(iy+5) set 1,(iy+5) ld hl,Name_Str call _vputs ld hl,$162B ld (_penCol),hl ld hl,Size_Str call _vputs ld hl,$242B ld (_penCol),hl ld hl,FreeMem_Str call _vputs res 3,(iy+5) res 1,(iy+5) ld hl,$2B2B ld (_penCol),hl call _MEMCHK call DispHL ld hl,VIDEO_MEM call Invert DispSomeProgs: ld hl,AbsFirst ;Load address of the first posible program name into hl rst 20h ;Move 10 bytes at hl to OP1 xor a ld (Pos),a ld (Items),a ld b,$08 Looper: push bc xor a call _NextPrgm jr c,NoNext ld hl,Pos inc (hl) ld hl,Items inc (hl) call DisplayHandler pop bc dec b ld a,$00 cp b jr nz,Looper jr Setup NoNext: pop bc ld hl,Items xor a cp (hl) jr nz,Setup NoPrograms: call _clrScrn ;clear screen call _homeup ;reset _curRow etc RestoreMSE: call _push_OP1 ld hl,VatPtr-1 rst 20h rst 10h ld (hl),$12 call _pop_OP1 ret Setup: ld hl,AbsFirst ;Load address of the first posible program into hl. rst 20h ;(hl) -> OP1. xor a call _NextPrgm ;Get first program. ld a,$01 ;Start in position 1. ld (Pos),a call DisplayHandler call Descriptions ;Display the A86 description. call InvertCursor ;Draw the cursor bar. GetKey1: call _getcode ;much, much, much faster getkey routine, no messing with op1 cp K_EXIT jr z,Exit cp K_UP jr z,PrevProgram cp K_DOWN jp z,NextProgram cp K_CLEAR jr z,ShutOff cp K_SECOND jr z,ExecPrgm cp K_ENTER jr z,ExecPrgm cp K_PLUS jr z,ContrastUp cp K_MINUS jr z,ContrastDn jr GetKey1 ExecPrgm: call RestoreMSE rst 10h ld a,b ex de,hl call _load_ram_ahl inc hl inc hl xor a cp (hl) jr z,Chk_Hex inc hl ld a,(hl) cp $27 ;tokenized hex jr z,ExecAsm cp $29 ;protected basic jr z,ExecBasic cp $28 ;assembly jr z,ExecAsm Chk_Hex: ;If the first byte is $00 and the 5th is 'P', then it is a non-tokenized Hex program inc hl inc hl inc hl inc hl ld a,'P' ;now the 5th byte cp (hl) jr z,ExecAsm ;if it isnt an asmprgm prog, then its basic ExecBasic: call _runon call _exec_basic jp ASMstart ExecAsm: call _exec_asm jp ASMstart Exit: call RestoreMSE call _clrScrn ret ContrastDn: ld a,-1 jr ContrastMain ContrastUp: ld a,1 ContrastMain: ld hl,CONTRAST add a,(hl) and $1F ld (hl),a out (2),a jr GetKey1 ShutOff: ;shut off routine res 3,(iy+8) ;Lock the APD set 4,(iy+8) ;Expire APD call _off ;Turn It Off jr GetKey1 ;Restart ;***********************Move Up Routines************************* PrevProgram: xor a call _PrevPrgm jp c,GetKey1 MoveUp: call InvertCursor ld hl,Pos ld a,$01 cp (hl) call z,NoMoveUp dec (hl) call DisplayHandler call Descriptions call InvertCursor jp GetKey1 NoMoveUp: push hl ld hl,$FF84 ld de,$FFF4 ld c,48 ScrollScreenDn: ld b,5 LooperDn: ld a,(hl) ld (de),a dec hl dec de djnz LooperDn push de ld de,-11 add hl,de pop de push hl ld hl,-11 add hl,de ex de,hl pop hl dec c ld a,c or a jr nz,ScrollScreenDn pop hl inc (hl) ret ;**************************Move Down Routines************************** NextProgram: xor a call _NextPrgm jp c,GetKey1 MoveDown: call InvertCursor ld hl,Pos ld a,(Items) cp (hl) ld a,$01 call z,NoMoveDown inc (hl) call DisplayHandler call Descriptions call InvertCursor jp GetKey1 NoMoveDown: push hl ld hl,$FCF0 ld de,$FC80 ld c,48 ScrollScreenUp: ld b,5 LooperUp: ld a,(hl) ld (de),a inc hl inc de djnz LooperUp push de ld de,11 add hl,de pop de push hl ld hl,11 add hl,de ex de,hl pop hl dec c ld a,c or a jr nz,ScrollScreenUp pop hl dec (hl) ret DisplayHandler: ld a,(Pos) ld h,a ld l,$07 call MUL_HL ld de,$01 add hl,de ld (_penRow),hl call ClearLine ld a,$02 ld (_penCol),a ld hl,_OP1+2 call _vputs ret Descriptions: call _push_OP1 ld hl,$FCF8 ld c,$07 call ClearLines ld hl,$FCFB call ClearLines BasicProgram: ld hl,$0F2C ld (_penCol),hl rst 10h ld a,b ex de,hl call _load_ram_ahl inc hl inc hl xor a cp (hl) jr z,Chk_Basic inc hl ld a,(hl) cp $27 jr z,LD_Hex_Str cp $29 jr z,LD_ProtBasic_Str cp $28 jr z,AsmProgram Chk_Basic: inc hl inc hl inc hl inc hl ld a,'P' cp (hl) jr z,LD_Hex_Str LD_Basic_Str: ld hl,Basic_Str call _vputs jr Disp_Program_Str LD_Hex_Str: ld hl,Hex_Str call _vputs jr Disp_Program_Str LD_ProtBasic_Str: ld hl,ProtBasic_Str call _vputs jr Disp_Program_Str AsmProgram: inc hl ld a,(hl) cp $00 jr nz,RegAsm push hl ld de,$06 add hl,de ld e,(hl) inc hl ld d,(hl) ex de,hl ld de,$D748 sbc hl,de pop de add hl,de ld a,h cp $C0 jr c,DispDescription add a,-40h in a,(6) inc a out (6),a DispDescription: call _vputs jr Get_Size RegAsm: ld hl,Asm_Str call _vputs Disp_Program_Str ld hl,Program_Str call _vputs Get_Size: ld hl,$1D2C ld (_penCol),hl rst 10h ld a,b ex de,hl call _get_word_ahl ;Get program size ex de,hl xor a call DispHL ;display hl call _pop_OP1 ;recall OP1 ret InvertCursor: call Find_Vid_Addr call InvertH ret InvertH: ld c,7 InvertBar: call Inverter ld de,11 add hl,de dec c ld a,c or a jr nz,InvertBar ret Inverter: ld b,5 InvertLooper: ld a,(hl) cpl ld (hl),a inc hl djnz InvertLooper ret ClearLine: call Find_Vid_Addr ld c,$06 ClearLines: push hl call Clearer pop hl ld de,$10 add hl,de dec c ld a,c or a jr nz,ClearLines ret Clearer: ld b,$05 ClearLoop: ld (hl),$00 inc hl djnz ClearLoop ret Find_Vid_Addr: ld a,(Pos) ;load the position 1-7 ld h,a ;into h ld l,$70 ; call MUL_HL ; ld de,$FC10 ;add offset add hl,de ret ;**************************Invert 7 lines from hl by Andreas Ess**************** Invert: ld b,$70 InvertLoop: ld a,(hl) cpl ld (hl),a inc hl djnz InvertLoop ret ;********************Display HL Routine By Joshua Seagoe************** DispHL: ld de,-1 ld (_curRow),de call _dispahl dec hl call _vputs ld hl,Bytes_Str call _vputs ret ;********************Strings used in program********************* Name_Str: .db " Name: ",0 Size_Str: .db " Size: ",0 FreeMem_Str: .db " Free Mem: ",0 Asm_Str: .db "Asm",0 Basic_Str: .db "Basic",0 Hex_Str: .db "Hex",0 ProtBasic_Str: .db "Protected",0 Program_Str: .db " Program",0 AbsFirst: .db $12,$01,$00 VatPtr: .db $03,"mse" PrgmName: .db "MS-Enhanced",0 Version: .db "v1.4",0 Bytes_Str: .db " bytes ",0 ;--------------Vars used in program------> Pos: .db 0 Items: .db 0 .end