fsh-shell/includes/FshCmd.asm

104 lines
1.3 KiB
NASM

;;fshcmddecode
;;Decodes all commands.
;;Inputs:
;; HL: Cmd String mem loc
;; DE: Op code mem loc
;;Output:
;; Sets (DE) with command op code
fshcmddecode:
push hl
push de
ld de, fshcmdEXIT
call strcmp
ld hl, fshcmdEXITo
pop de
call z, bytecpy
pop hl
push hl
push de
ld de, fshcmdSET
call strcmp
ld hl, fshcmdSETo
pop de
call z, bytecpy
pop hl
push hl
push de
ld de, fshcmdVARS
call strcmp
ld hl, fshcmdVARSo
pop de
call z, bytecpy
pop hl
push hl
push de
ld de, fshcmdCLS
call strcmp
ld hl, fshcmdCLSo
pop de
call z, bytecpy
pop hl
ret
;;fshcmdroute
;;Routes all commamds.
;;Inputs:
;; HL: Op code mem loc
;;Outputs:
;; Jp to loc for cmd func
;; ult go to Fin
fshcmdroute:
ld de, fshcmdEXITo
call bytecmp
jp z, fshcmdEXITf
ld de, fshcmdSETo
call bytecmp
jp z, fshcmdSETf
ld de, fshcmdVARSo
call bytecmp
jp z, fshcmdVARSf
ld de, fshcmdCLSo
call bytecmp
jp z, fshcmdCLSf
jp Fin
; fshcmdfill
;; fills fshvars with word
;; Inputs:
;; HL: 16b
fshcmdfill:
push hl
push de
ld d, h
ld e, l
ld hl, FshCmdArg0
ld (hl), e
inc hl
ld (hl), d
inc hl
ld (hl), e
inc hl
ld (hl), d
inc hl
ld (hl), e
inc hl
ld (hl), d
inc hl
ld (hl), e
inc hl
ld (hl), d
pop de
pop hl
ret
#include "includes/commands.inc"