Estex-DSS/SHELL/Procedures/parsers.asm
2023-11-28 06:04:19 +10:00

135 lines
2.0 KiB
NASM
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

////////////////////////////////////////////////////////////////////////
; ‚室: hl - ᯨ᮪ ª®¬ ­¤ ä®à¬ â : "áâப ",0,cmd_addr
; de - áâப  á ª®¬ ­¤®©
; c - ¤«¨­  áâப¨
; ‚ë室: CF=1 - ¢ HL  ¤à¥á ª®¬ ­¤ë ­  ¨á¯®«­¥­¨¥
; CF=0 - ­¥â ®¯®§­ ­®© ª®¬ ­¤ë
RUN_COMMAND:
push bc
push de
;
.loop: ld a,(de)
cp "a"
jr c,.skip
cp "z"+1
jr nc,.skip
and %0101'1111 ; a..z -> A..Z
.skip: cp (hl)
jr nz,.not_cmd ; ­¥ ª®¬ ­¤ 
inc hl
inc de
dec c
jr nz,.loop
;
xor a
cp (hl)
jr nz,.not_cmd
pop bc
pop bc
ld a,(de)
cp " "
jr nz,.no_sp
inc de
.no_sp: inc hl
ld a,(hl)
inc hl
ld h,(hl)
ld l,a
scf ; ¬ àª¥à ®¯®§­ ­®© ª®¬ ­¤ë
ret
;jp (hl) ; ­  á®®â¢. ®¡à ¡®â稪 ª®¬ ­¤ë
.not_cmd:
xor a
LD C,A
CPIR
inc hl
inc hl
pop de
pop bc
ld a,(hl)
or a
jr nz,RUN_COMMAND ; ­ § ¤ ¢ 横«, ¥é¥ ­¥ ¤®è«¨ ª®­æ  ᯨ᪠ ¤ª®¬ ­¤
ret
;
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
; ‚室: hl - ᯨ᮪ ª«î祩 ä®à¬ â : "áâப ",cmd_addr
; de - áâப  á ª®¬ ­¤®©
; c - ¤«¨­  áâப¨ á ª®¬ ­¤®©
; ‚ë室: CF=1 - ¢ HL  ¤à¥á ª«îç  ­  ¨á¯®«­¥­¨¥
; CF=0 - ­¥â ®¯®§­ ­®£® ª«îç 
; !FIXIT ¯¥à¥¤¥« âì íâã å७ì
RUN_OPTION:
.cont: EX DE,HL
LD B,C
.loop: LD A,(HL)
CP '/' ;
INC HL
JR Z,.got
AND A
RET Z
DJNZ .loop
; not found key
AND A
RET
;
.got: LD C,B
INC HL
LD A,(HL)
DEC C
CP ' '
JR Z,.good
AND A
JR NZ,RUN_OPTION.loop
;LD C,1
;
.good: dec hl
push hl
ld b,cmd_dir_options.Size ;!HARDCODE
ex de,hl
ld a,(de)
OR %0010'0000
ld de,cmd_dir_options.paramLength ;!HARDCODE
;
.find: cp (hl)
jr z,.found
add hl,de
djnz .find
; not found
pop hl
jr RUN_OPTION
; found
.found: ; § â¨à ¥¬ ­ ©¤¥­ë© ª«îç
pop de
ex de,hl
ld (hl),' '
dec hl
ld (hl),' '
inc hl
inc hl
inc hl
ex de,hl
;ld A,'/'
;ex de,hl
;ld bc,4
;CPDR
;inc hl
;ld (hl),' '
;inc hl
;ld (hl),' '
;inc hl
;ex de,hl
;
LD B,C
inc hl
ld a,(hl)
inc hl
ld h,(hl)
ld l,a
scf ; ¬ àª¥à ®¯®§­ ­®© ®¯æ¨¨
ret
////////////////////////////////////////////////////////////////////////