;************************************************* ;************************************************* ; ; 'alias' -- external command for Davex ; ; alias -- view and modify Davex aliases ; ; alias [-s] [-l] [-r] ; ; alias displays all aliases ; alias adds alias ; alias -r removes alias ; alias -s saves aliases to %aliases ; alias -l loads aliases from %aliases ; ;************************************************* ; ; Converted to MPW IIgs 20-Sep-92 DAL ; ; Fixed from the 1.30P version on SourceForge 26-Jul-17 MG ; ;************************************************* ;.segment "CODE_A000" OrgAdr = $A000 ;change as necessary (end below $B000) .org OrgAdr ; Makes the listing more readable, though it doesn't really org the code - the linker does that. .include "Common/2/Globals2.asm" .include "Common/2/Apple.Globals2.asm" .include "Common/2/Mli.Globals2.asm" .include "Common/Macros.asm" ;include 'm16.util2' low_cr = $0D ; MyVersion = $09 MinVersion = $12 MinVerAux = $05 ;************************************************* rts .byte $ee,$ee .byte MyVersion,MinVersion .byte %00000000 ;hardware req .addr descr .addr OrgAdr .addr start .byte MinVerAux,0,0,0 ; parameters here .byte 0,t_string .byte 0,t_string .byte $80+'r',t_nil .byte $80+'s',t_nil .byte $80+'l',t_nil .byte 0,0 descr: pstr "display or modify command aliases" ;************************************************* ; dum xczpage ;32 locations AliasPages = xczpage AliasP = AliasPages+1 AliasEnd = AliasP+2 myP = AliasEnd+2 str1 = myP+2 str2 = str1+2 char = str2+2 count = char+1 ;.res 2 ; dend ; start = * sta str1+1 sty str1 lda #1 jsr xgetparm_n sta str2+1 sty str2 ldx #1 jsr xshell_info sta AliasP+1 sty AliasP sty AliasEnd stx AliasPages txa clc adc AliasP+1 sta AliasEnd+1 lda #$80+'l' jsr xgetparm_ch bcs noLoad jsr load_aliases noLoad: jsr DoAlias lda #$80+'s' jsr xgetparm_ch bcs noSave jsr save_aliases noSave: rts ;************************************************* ; ; handle adding, removing, or showing aliases ; DoAlias: lda #$80+'r' jsr xgetparm_ch bcs noRmv jmp remove_alias noRmv: ldy #0 lda (str1),y bne doAdd lda (str2),y bne doAdd jsr xgetnump cmp #2 beq show_aliases rts doAdd: jmp add_alias ;************************************************* ; ; Display all the aliases ; show_aliases: jsr CalcUsedSize jsr xprdec_2 jsr xmess asc_hi " bytes used (of " .byte 0 lda AliasPages ldy #0 jsr xprdec_2 jsr xmess asc_hi ") to store these aliases:" .byte low_cr asc_hi " " .byte 0 ; lda AliasP+1 ldy AliasP sta myP+1 sty myP ShowA1: lda (myP),y beq ShowedA jsr NeatCout bcs ShowedA iny bne ShowA1 inc myP+1 bne ShowA1 ShowedA: rts NeatCout: ora #$80 cmp #$8d beq isCR jsr cout clc rts isCR: jsr xcheck_wait bcs isCR2 jsr crout lda #$80+' ' jsr cout jsr cout clc isCR2: rts ;************************************************* ; ; Save aliases to %aliases file ; save_aliases: lda #>AliasName ldy #AliasName ldy #