restructured commands

This commit is contained in:
Stephen Toth 2018-06-28 23:22:27 -04:00
parent 9aed40be6f
commit 753a4747dd
5 changed files with 41 additions and 29 deletions

View File

@ -12,8 +12,8 @@ Setup:
CALL fshvarreset CALL fshvarreset
Input: Input:
LD C, $00 LD A, $00
CALL fshcmdfill CALL commandfill
LD HL, PS1 LD HL, PS1
CALL printprompt CALL printprompt
@ -27,7 +27,7 @@ Input:
Decode: Decode:
LD HL, FshCmd LD HL, FshCmd
LD DE, FshCmdOP LD DE, FshCmdOP
CALL fshcmddecode CALL commanddecode
Route: Route:
LD HL, FshCmdOP LD HL, FshCmdOP
@ -59,7 +59,7 @@ FshFlags: .DB %00000000
#include "includes/Cursor.asm" #include "includes/Cursor.asm"
#include "includes/Print.asm" #include "includes/Print.asm"
#include "includes/FshCmd.asm" #include "includes/Command.asm"
#include "includes/Err.asm" #include "includes/Err.asm"
#include "includes/String.asm" #include "includes/String.asm"

Binary file not shown.

36
includes/Command.asm Normal file
View File

@ -0,0 +1,36 @@
;;Commanddecode
;;Decodes all commands.
;;Inputs:
;; HL: Cmd String mem loc
;; DE: Op code mem loc
;;Output:
;; Sets (DE) with command op code
commanddecode:
;add more
call fshcmddecode
ret
; commandfill
;; fills command mem with byte a
commandfill:
push hl
push bc
push de
ld b, 0
ld de, 0
ld c, a
ld hl, FshCmd
commandfillLoop:
ld (hl), c
inc hl
inc b
inc de
ld a, b
cp FshCmdSize
jr c, commandfillLoop
pop de
pop bc
pop hl
ret
#include "includes/FshCmd.asm"

View File

@ -98,28 +98,4 @@ fshcmdroute:
ld (hl), $01 ld (hl), $01
jp Err jp Err
; fshvarfill #include "includes/FshCommands/FshCommands.inc"
;; fills fshcmd with byte
;; Inputs:
;; C: byte
fshcmdfill:
push hl
push bc
push de
ld b, 0
ld de, 0
ld hl, FshCmd
fshcmdfillLoop:
ld (hl), c
inc hl
inc b
inc de
ld a, b
cp FshCmdSize
jr c, fshcmdfillLoop
pop de
pop bc
pop hl
ret
#include "includes/FshCommands.inc"