Make the command table read better using macros CommandName and NoMoreParameters.

No change yet, but this is a step toward someday not setting the high bits in the
command names.
This commit is contained in:
Dave Lyons
2020-08-17 01:07:52 -07:00
parent 625e78100d
commit cac960e4e4

View File

@@ -265,7 +265,8 @@ pc1: jsr cmp_cmd
jsr scanall jsr scanall
bcs huh bcs huh
; ;
; HERE IS WHERE TO DO "APPL" STUFF. ; Here is where to do "appl" stuff, such as mapping BAS files
; to automatically be launched via BASIC.SYSTEM
; ;
cmp #tDIR cmp #tDIR
beq gotoDIR beq gotoDIR
@@ -421,7 +422,7 @@ parse_exec:
execit: jsr parse_parms execit: jsr parse_parms
; ;
; expand wildcards here & call routine ; expand wildcards here & call routine
; until there are no more expandions ; until there are no more expansions
; ;
lsr some_flag lsr some_flag
jsr wild_begin jsr wild_begin
@@ -1472,10 +1473,6 @@ fudgeCR: .byte 0
; ;
;************************************** ;**************************************
; ;
; Do scan -i
;
;**************************************
;
; command table format: ; command table format:
; list of <command_entry> ; list of <command_entry>
; ;
@@ -1493,31 +1490,36 @@ fudgeCR: .byte 0
; <option_character> ; <option_character>
; <parm_type> ; <parm_type>
; ;
;************************************
.macro CommandName Arg
asc_hi Arg
.byte 0
.endmacro
.macro NoMoreParameters
.byte 0,0
.endmacro
;************************************ ;************************************
cmdtbl: cmdtbl:
asc_hi "bye" CommandName "bye"
.byte 0
.addr go_quit .addr go_quit
.byte 0,0 NoMoreParameters
asc_hi "$" CommandName "$"
.byte 0
.addr copyright .addr copyright
.byte 0,0 NoMoreParameters
asc_hi "version" CommandName "version"
.byte 0
.addr wNotQuiet .addr wNotQuiet
.byte 0,0 NoMoreParameters
asc_hi "rep" CommandName "rep"
.byte 0
.addr go_repeat .addr go_repeat
.byte 0,t_int2 .byte 0,t_int2
.byte 0,0 NoMoreParameters
asc_hi "config" CommandName "config"
.byte 0
.addr go_config .addr go_config
.byte $80+'p',t_int1 .byte $80+'p',t_int1
.byte $80+'4',t_yesno .byte $80+'4',t_yesno
@@ -1525,73 +1527,61 @@ cmdtbl:
.byte $80+'b',t_yesno .byte $80+'b',t_yesno
.byte $80+'q',t_int1 .byte $80+'q',t_int1
.byte $80+'h',t_string .byte $80+'h',t_string
.byte 0,0 NoMoreParameters
asc_hi "como" CommandName "como"
.byte 0
.addr go_como .addr go_como
.byte 0,t_wildpath .byte 0,t_wildpath
.byte 0,0 NoMoreParameters
asc_hi "exec" CommandName "exec"
.byte 0
.addr go_exec .addr go_exec
.byte 0,t_wildpath .byte 0,t_wildpath
.byte 0,0 NoMoreParameters
asc_hi "prefix" CommandName "prefix"
.byte 0
.addr go_prefix .addr go_prefix
.byte 0,t_wildpath .byte 0,t_wildpath
.byte 0,0 NoMoreParameters
asc_hi "boot" CommandName "boot"
.byte 0
.addr go_boot .addr go_boot
.byte $80+'s',t_int1 .byte $80+'s',t_int1
.byte $80+'i',t_nil ;ice cold! .byte $80+'i',t_nil ;ice cold!
.byte 0,0 NoMoreParameters
asc_hi "mon" CommandName "mon"
.byte 0
.addr go_mon .addr go_mon
.byte 0,0 NoMoreParameters
asc_hi "up" CommandName "up"
.byte 0
.addr go_up .addr go_up
.byte 0,0 NoMoreParameters
asc_hi "top" CommandName "top"
.byte 0
.addr go_top .addr go_top
.byte 0,0 NoMoreParameters
asc_hi "help" CommandName "help"
.byte 0
.addr go_help .addr go_help
.byte 0,t_string .byte 0,t_string
.byte 0,0 NoMoreParameters
asc_hi "?" CommandName "?"
.byte 0
.addr go_help .addr go_help
.byte 0,t_string .byte 0,t_string
.byte 0,0 NoMoreParameters
asc_hi "online" CommandName "online"
.byte 0
.addr go_online .addr go_online
.byte $80+'o',t_nil .byte $80+'o',t_nil
.byte 0,0 NoMoreParameters
asc_hi "cls" CommandName "cls"
.byte 0
.addr clear_sc .addr clear_sc
.byte 0,0 NoMoreParameters
asc_hi "type" CommandName "type"
.byte 0
.addr go_type .addr go_type
.byte 0,t_wildpath .byte 0,t_wildpath
.byte $80+'h',t_nil .byte $80+'h',t_nil
@@ -1600,10 +1590,9 @@ cmdtbl:
.byte $80+'l',t_nil .byte $80+'l',t_nil
.byte $80+'p',t_nil .byte $80+'p',t_nil
.byte $80+'t',t_string .byte $80+'t',t_string
.byte 0,0 NoMoreParameters
asc_hi "pg" CommandName "pg"
.byte 0
.addr go_more .addr go_more
.byte 0,t_wildpath .byte 0,t_wildpath
.byte $80+'h',t_nil .byte $80+'h',t_nil
@@ -1612,74 +1601,64 @@ cmdtbl:
.byte $80+'l',t_nil .byte $80+'l',t_nil
.byte $80+'p',t_nil .byte $80+'p',t_nil
.byte $80+'t',t_string .byte $80+'t',t_string
.byte 0,0 NoMoreParameters
asc_hi "rename" CommandName "rename"
.byte 0
.addr go_rename .addr go_rename
.byte 0,t_wildpath .byte 0,t_wildpath
.byte 0,t_path .byte 0,t_path
.byte 0,0 NoMoreParameters
asc_hi "filetype" CommandName "filetype"
.byte 0
.addr go_ctype .addr go_ctype
.byte 0,t_wildpath .byte 0,t_wildpath
.byte 0,t_ftype .byte 0,t_ftype
.byte $80+'x',t_int2 .byte $80+'x',t_int2
.byte 0,0 NoMoreParameters
asc_hi "create" CommandName "create"
.byte 0
.addr go_create .addr go_create
.byte 0,t_path .byte 0,t_path
.byte 0,0 NoMoreParameters
asc_hi "dt" CommandName "dt"
.byte 0
.addr print_time .addr print_time
.byte 0,0 NoMoreParameters
asc_hi "delete" CommandName "delete"
.byte 0
.addr go_del .addr go_del
.byte 0,t_wildpath .byte 0,t_wildpath
.byte $80+'u',t_nil .byte $80+'u',t_nil
.byte 0,0 NoMoreParameters
asc_hi "lock" CommandName "lock"
.byte 0
.addr go_lock .addr go_lock
.byte 0,t_wildpath .byte 0,t_wildpath
.byte 0,0 NoMoreParameters
asc_hi "unlock" CommandName "unlock"
.byte 0
.addr go_unlock .addr go_unlock
.byte 0,t_wildpath .byte 0,t_wildpath
.byte 0,0 NoMoreParameters
asc_hi "prot" CommandName "prot"
.byte 0
.addr go_prot .addr go_prot
.byte 0,t_wildpath .byte 0,t_wildpath
.byte $80+'r',t_nil .byte $80+'r',t_nil
.byte $80+'w',t_nil .byte $80+'w',t_nil
.byte $80+'d',t_nil .byte $80+'d',t_nil
.byte $80+'n',t_nil .byte $80+'n',t_nil
.byte 0,0 NoMoreParameters
asc_hi "scan" CommandName "scan"
.byte 0
.addr go_scan .addr go_scan
.byte $80+'a',t_string .byte $80+'a',t_string
.byte $80+'r',t_string .byte $80+'r',t_string
.byte $80+'z',t_nil .byte $80+'z',t_nil
.byte $80+'i',t_string .byte $80+'i',t_string
.byte 0,0 NoMoreParameters
asc_hi "cat" CommandName "cat"
.byte 0
.addr go_cat .addr go_cat
.byte 0,t_wildpath .byte 0,t_wildpath
.byte $80+'a',t_string .byte $80+'a',t_string
@@ -1687,10 +1666,9 @@ cmdtbl:
.byte $80+'s',t_nil .byte $80+'s',t_nil
.byte $80+'f',t_ftype .byte $80+'f',t_ftype
.byte $80+'i',t_nil .byte $80+'i',t_nil
.byte 0,0 NoMoreParameters
asc_hi "spool" CommandName "spool"
.byte 0
.addr go_spool .addr go_spool
.byte 0,t_wildpath .byte 0,t_wildpath
;dfb $80+'h',t_string ;header ;dfb $80+'h',t_string ;header
@@ -1698,137 +1676,120 @@ cmdtbl:
;dfb $80+'w',t_int1 ;page width ;dfb $80+'w',t_int1 ;page width
.byte $80+'x',t_int1 ;cancel 1 .byte $80+'x',t_int1 ;cancel 1
.byte $80+'z',t_nil ;zap (cancel all) .byte $80+'z',t_nil ;zap (cancel all)
.byte 0,0 NoMoreParameters
asc_hi "info" CommandName "info"
.byte 0
.addr go_info .addr go_info
.byte 0,t_wildpath .byte 0,t_wildpath
.byte 0,0 NoMoreParameters
asc_hi "update" CommandName "update"
.byte 0
.addr go_update .addr go_update
.byte 0,t_wildpath .byte 0,t_wildpath
.byte 0,t_wildpath .byte 0,t_wildpath
.byte $80+'f',t_nil .byte $80+'f',t_nil
.byte $80+'b',t_nil .byte $80+'b',t_nil
.byte 0,0 NoMoreParameters
asc_hi "copy" CommandName "copy"
.byte 0
.addr go_copy .addr go_copy
.byte 0,t_wildpath .byte 0,t_wildpath
.byte 0,t_wildpath .byte 0,t_wildpath
.byte $80+'d',t_nil ;delete orig .byte $80+'d',t_nil ;delete orig
.byte $80+'f',t_nil ;force delete .byte $80+'f',t_nil ;force delete
.byte $80+'b',t_nil ;clr bkup bit .byte $80+'b',t_nil ;clr bkup bit
.byte 0,0 NoMoreParameters
asc_hi "move" CommandName "move"
.byte 0
.addr go_move .addr go_move
.byte 0,t_wildpath .byte 0,t_wildpath
.byte 0,t_wildpath .byte 0,t_wildpath
.byte $80+'f',t_nil ;force delete .byte $80+'f',t_nil ;force delete
.byte 0,0 NoMoreParameters
asc_hi "touch" CommandName "touch"
.byte 0
.addr go_touch .addr go_touch
.byte 0,t_wildpath .byte 0,t_wildpath
.byte $80+'b',t_yesno .byte $80+'b',t_yesno
.byte $80+'d',t_yesno .byte $80+'d',t_yesno
.byte $80+'i',t_yesno .byte $80+'i',t_yesno
.byte 0,0 NoMoreParameters
.if IsDavex2 .if IsDavex2
asc_hi "dev" CommandName "dev"
.byte 0
.addr go_dev .addr go_dev
.byte $80+'r',t_devnum .byte $80+'r',t_devnum
.byte $80+'a',t_devnum .byte $80+'a',t_devnum
.byte $80+'z',t_nil .byte $80+'z',t_nil
.byte 0,0 NoMoreParameters
.endif .endif
asc_hi "ftype" CommandName "ftype"
.byte 0
.addr go_ftype .addr go_ftype
.byte $80+'r',t_ftype .byte $80+'r',t_ftype
.byte $80+'a',t_string .byte $80+'a',t_string
.byte $80+'v',t_ftype .byte $80+'v',t_ftype
.byte $80+'z',t_nil .byte $80+'z',t_nil
.byte 0,0 NoMoreParameters
; [TODO] what was "appl" going to do if implemented? Maybe assign filetypes to applications, ; [TODO] "appl" to associate applications with filetypes,
; so you can launch something by document path and automatically have the right app ; so you can launch something by document path and automatically have the right app
; use the document? ; use the document
;;;;; ;;;;;
; asc_hi "appl" ; CommandName "appl"
; .byte 0
; .addr go_appl ; .addr go_appl
; .byte $80+'r',t_ftype ; .byte $80+'r',t_ftype
; .byte $80+'a',t_ftype ; .byte $80+'a',t_ftype
; .byte $80+'p',t_string ; .byte $80+'p',t_string
; .byte 0,0 ; NoMoreParameters
asc_hi "err" CommandName "err"
.byte 0
.addr go_err .addr go_err
.byte 0,t_int1 .byte 0,t_int1
.byte 0,0 NoMoreParameters
asc_hi "=" CommandName "="
.byte 0
.addr go_equal .addr go_equal
.byte 0,t_wildpath .byte 0,t_wildpath
.byte 0,t_path .byte 0,t_path
.byte 0,0 NoMoreParameters
asc_hi "size" CommandName "size"
.byte 0
.addr go_size .addr go_size
.byte 0,t_wildpath .byte 0,t_wildpath
.byte 0,0 NoMoreParameters
asc_hi "echo" CommandName "echo"
.byte 0
.addr go_echo .addr go_echo
.byte 0,t_string .byte 0,t_string
.byte $80+'n',t_nil ;no CR .byte $80+'n',t_nil ;no CR
.byte 0,0 NoMoreParameters
asc_hi "eject" CommandName "eject"
.byte 0
.addr go_eject .addr go_eject
.byte 0,t_path .byte 0,t_path
.byte 0,0 NoMoreParameters
asc_hi "wait" CommandName "wait"
.byte 0
.addr go_wait .addr go_wait
.byte 0,0 NoMoreParameters
asc_hi "num" CommandName "num"
.byte 0
.addr go_num .addr go_num
.byte 0,t_int3 .byte 0,t_int3
.byte 0,0 NoMoreParameters
.if RemoteImp .if RemoteImp
asc_hi "remote" CommandName "remote"
.byte 0
.addr go_remote .addr go_remote
.byte 0,t_int1 .byte 0,t_int1
.byte 0,0 NoMoreParameters
.endif .endif
; asc_hi "mem" ; CommandName "mem" -- [TODO] dump RAM contents at address [length]
; .byte 0
; .addr go_mem ; .addr go_mem
; .byte 0,0 ; NoMoreParameters
; end of command table ; end of command table
.byte 0,0 .byte 0,0
@@ -2465,6 +2426,8 @@ protp4: pla
; scan [-a add_path] [-r remove_path] ; scan [-a add_path] [-r remove_path]
; [-z defaults] [-i insert] ; [-z defaults] [-i insert]
; ;
; [TODO] implement -i as some way to add other than at the end
;
go_scan: go_scan:
lda num_parms lda num_parms
bne scan_parms bne scan_parms