diff --git a/FSHa.asm b/FSHa.asm index f840b55..07010e9 100644 --- a/FSHa.asm +++ b/FSHa.asm @@ -6,15 +6,15 @@ .DB tExtTok,tAsm84CeCmp Setup: - CALL _homeup ;Put up home - CALL _ClrLCDFull ;Clear screen + CALL _homeup + CALL _ClrLCDFull LD HL, $00 CALL fshvarfill Input: - LD HL, $00 ; fill fshcmd with $00 + LD C, $00 CALL fshcmdfill XOR A @@ -30,10 +30,6 @@ Input: CALL _NewLine Decode: - LD HL, FshCmdOP ; resets op to 0, TEMP - LD A, $00 - LD (HL), A - LD HL, FshCmd LD DE, FshCmdOP CALL fshcmddecode @@ -46,8 +42,7 @@ Fin: JP Input Err: -;TODO: Err Handler - JP ErrDefault + JP ErrRoute Cleanup: SET graphdraw,(IY+graphflags) @@ -60,7 +55,7 @@ Exit: PS1: .DB "FSH> ",0 FshFlags: .DB %00000000 ; 0: Debug Flag -; 1: Error Flag +; 1: Error Flag (Unused) ; 2: Program Flag diff --git a/bin/FSHa.8xp b/bin/FSHa.8xp index dddae35..9a96b84 100644 Binary files a/bin/FSHa.8xp and b/bin/FSHa.8xp differ diff --git a/includes/Err.asm b/includes/Err.asm index d905463..fa3fe2f 100644 --- a/includes/Err.asm +++ b/includes/Err.asm @@ -1,6 +1,29 @@ +;;ErrRoute +;;Routes err codes. +;;Outputs: +;; Jp to loc for err func +ErrRoute: + ld hl, FshCmdErrCode + + ld de, ErrCmdNotFoundo + call bytecmp + jp z, ErrCmdNotFoundf + + jp ErrDefault + + +ErrCmdNotFoundo: .db $01 +ErrCmdNotFoundf: + ld hl, ErrCmdNotFoundt + call _PutS + ld hl, FshCmd + call _PutS + call _NewLine + jp Fin +ErrCmdNotFoundt: .db "ERR: No Command: ", 0 + ErrDefault: - ld hl, ErrDefaultT + ld hl, ErrDefaultt call _PutS jp Exit -ErrDefaultT: - .db "ERR: Default; Exit",0 +ErrDefaultt: .db "ERR: Default; Exit", 0 diff --git a/includes/FshCmd.asm b/includes/FshCmd.asm index d5ca43d..732e2a0 100644 --- a/includes/FshCmd.asm +++ b/includes/FshCmd.asm @@ -68,36 +68,32 @@ fshcmdroute: call bytecmp jp z, fshcmdCLSf - jp Fin + ld hl, FshCmdErrCode + ld (hl), $01 + jp Err -; fshcmdfill -;; fills fshvars with word +; fshvarfill +;; fills fshcmd with byte ;; Inputs: -;; HL: 16b +;; C: byte 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 + 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 / 2 + jr c, fshcmdfillLoop + pop de + pop bc pop hl ret - #include "includes/commands.inc" diff --git a/includes/define.inc b/includes/define.inc index 6694cf2..64ce319 100644 --- a/includes/define.inc +++ b/includes/define.inc @@ -8,7 +8,7 @@ #define END .end #define FshVarsSize 128 ;256 bytes | 64 words -#define FshCmdSize 17 ;17 bytes | 8 chars | 1 null, 4 words +#define FshCmdSize 24 ;17 bytes | 8 chars | 1 null, 4 words (args) | 1 byte (err code) | 6 unused #define FshCmdInptSize 8 ;8 bytes | 8 chars #define FshPrgmSize 1024 ;1024 bytes | max size @@ -23,3 +23,4 @@ FshCmdArg0 equ FshCmdOP + 1 FshCmdArg1 equ FshCmdOP + 3 FshCmdArg2 equ FshCmdOP + 5 FshCmdArg3 equ FshCmdOP + 7 +FshCmdErrCode equ FshCmdArg3 + 1