;---------------------; ;asapasm.asm ; ;by Stephen Hicks ; ;shicks@mindspring.com; ;---------------------; #include "asm86.h" #include "ti86asm.inc" #include "ti86math.inc" #include "ti86ops.inc" #include "ti86abs.inc" #define ProgTitle "asapasm v0.9B",0 _DisplayOP1 .equ $515B _flushallmenus .equ $49DC _custom5 .equ $D1CD _mMath_asap3 .equ $D65E _eostbl_asap3 .equ $D716 _numtok_asap3 .equ $D710 _tokspell_asap3 .equ $D70A _asap_nl3 .equ $D6EA _homeUp .equ $4A95 tokspell_start .equ $f3f8 asapasm_flags .equ $2A asapasm_installed .equ 7 .org _asm_exec_ram Start: call _clrLCD call _flushallmenus call _homeUp ld hl,message1 call WriteS ld hl,message2 call WriteS ld hl,message3 call WriteS ld hl,message4 call WriteS ld hl,message5 call WriteS ld hl,message6 call WriteS ld hl,cont_exit_msg call WriteS getkeyloop: call _getkey or a jr z,getkeyloop cp kF5 jr nz,noexit call _newline ret noexit: cp kF1 jr nz,getkeyloop ld a,(_numtok_asap3) or a jr z,install call _clrLCD call _homeUp ld hl,w_message1 call WriteS ld hl,w_message2 call WriteS ld hl,w_message3 call WriteS ld hl,$0A02 ld (_curRow),hl ld hl,_asap_nl3 call _putps ld hl,w_message4 call WriteS ld hl,w_message5 call WriteS ld hl,w_message6 call WriteS ld hl,cont_exit_msg call WriteS w_getkeyloop: call _getkey or a jr z,w_getkeyloop cp kF5 jr nz,w_noexit call _newline ret w_noexit: cp kF1 jr nz,w_getkeyloop install: ld a,1 ld (_numtok_asap3),a ld de,tokspell_start ld (_tokspell_asap3),de ld hl,tokspell ld bc,tokspell_end-tokspell ldir ld de,eostbl_start ld (_eostbl_asap3),de ld hl,eostbl ld bc,eostbl_end-eostbl ldir ld de,_asap_nl3 ld hl,asapname call _MOV10B ld de,custom_start ld (_custom5),de ld (_mMath_asap3),de ld hl,custom ld bc,custom_end-custom ldir set asapasm_installed,(iy+asapasm_flags) call _newline call _newline ld hl,donemsg1 call WriteS call _newline ld hl,donemsg2 call WriteS call _newline ret message1: .db 0,1,"Caution",0 message2: .db 1,0,"Any item in the 5th",0 message3: .db 2,0,"CUSTOM menu slot or",0 message4: .db 3,0,"the 9th MATH menu",0 message5: .db 4,0,"slot will be",0 message6: .db 5,0,"overwritten.",0 donemsg1: .db 7,0,ProgTitle,0 donemsg2: .db 7,0,"by Stephen Hicks",0 w_message1: .db 0,1,"WARNING",0 w_message2: .db 1,0,"Tokens already exist",0 w_message3: .db 2,0,"from prgm",0 w_message4: .db 3,0,"Installation WILL",0 w_message5: .db 4,0,"erase the previously",0 w_message6: .db 5,0,"installed tokens.",0 cont_exit_msg: .db 7,0,"Continue Exit",0 asapname: .db 7,"asapasm",0 tokspell: .dw tok_execasm-tokspell+tokspell_start tok_execasm: .db "Execasm",0 .db $01,$80 tokspell_end: eostbl: .dw code_execasm .db $03,$00 eostbl_end: custom: .db $05 ;open a menu .dw custom_sub-custom+custom_start ;at custom_sub .db "ASM",0 ;called ASM custom_sub: .db $09,2 ;new menu w/ 2 positions .dw menu_execasm-custom+custom_start .dw menu_quote-custom+custom_start menu_execasm: .db $60,"Execasm",0 menu_quote: .db $00,Lquote,0 custom_end: code_execasm: ld hl,param_var1 rst 20h rst 10h ld a,b ex de,hl call _SET_ABS_SRC_ADDR xor a ld hl,2 call _SET_MM_NUM_BYTES ld hl,string_size call _SET_ABS_DEST_ADDR call _mm_ldir xor a ld hl,_asm_exec_ram call _SET_ABS_DEST_ADDR ld hl,string_size ld e,(hl) inc hl ld d,(hl) ex de,hl ld a,h or a jr nz,size_error call _SET_MM_NUM_BYTES call _mm_ldir ld hl,string_size ld a,(hl) and %11111110 or a rra ld b,a ld hl,_asm_exec_ram ld de,_asm_exec_ram compress_loop: ld a,(hl) call cnv_a_hex or a rla rla rla rla ld c,a inc hl ld a,(hl) call cnv_a_hex add a,c ld (de),a inc hl inc de djnz compress_loop call _asm_exec_ram ld hl,_OP1 ld (hl),$12 call _DisplayOP1 jp $409C cnv_a_hex: push hl push bc sub $30 cp $16 jr nc,size_error ld hl,conv_table ld c,a ld b,0 add hl,bc ld a,(hl) cp $10 jr nc,size_error pop bc pop hl ret size_error: call _OP1SET0 call _LNX jp $409C conv_table: .db $00,$01,$02,$03,$04,$05,$06,$07,$08,$09,$FF,$FF,$FF,$FF,$FF,$FF .DB $FF,$0A,$0B,$0C,$0D,$0E,$0F,$FF string_size: .dw $0000 param_var1: .db $0C,$03,$24,$00,$00 WriteS: ld e,(hl) inc hl ld d,(hl) inc hl ld (_curRow),de call _puts ret eostbl_start .equ tokspell_start+tokspell_end-tokspell custom_start .equ tokspell_start+eostbl_end-tokspell .end