change optcode to 2 bytes

move some macros to locations of use
This commit is contained in:
Stephen Toth 2018-07-16 13:54:15 -04:00
parent b0aa131622
commit e481e6b521
21 changed files with 3511 additions and 3463 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -6,6 +6,17 @@
;;Output:
;; Sets (DE) with command op code
commanddecode:
#macro decodecmdopt(cmdXs, cmdXo)
push hl
push de
ld de, cmdXs
call strcmp
ld hl, cmdXo
pop de
call z, wordcpy
pop hl
#endmacro
call fshcmddecode
call cryptocmddecode
;Extention Point
@ -17,6 +28,12 @@ commanddecode:
;;Inputs:
;; HL: Op code mem loc
commandroute:
#macro routeoptjp(cmdXo, cmdXf)
ld de, cmdXo
call wordcmp
jp z, cmdXf
#endmacro
call fshcmdroute
call cryptocmdroute
;Extention Point

View File

@ -1,5 +1,5 @@
cryptocmdDECRYPT: .db "DECRYPT", 0
cryptocmdDECRYPTo: .db $41
cryptocmdDECRYPTo: .dw $0102
cryptocmdDECRYPTm: .db "Decrypts a string using a cypher. see 'DECRYPT HELP' for info on cyphers", 0
cryptocmdDECRYPTu: .db "DECRYPT <Crypt Command> <Crypt Args>", 0
cryptocmdDECRYPTf:

View File

@ -1,5 +1,5 @@
cryptocmdENCRYPT: .db "ENCRYPT", 0
cryptocmdENCRYPTo: .db $40
cryptocmdENCRYPTo: .dw $0101
cryptocmdENCRYPTm: .db "Encrypts a string using a cypher. see 'ENCRYPT HELP' for info on cyphers", 0
cryptocmdENCRYPTu: .db "ENCRYPT <Crypt Command> <Crypt Args>", 0
cryptocmdENCRYPTf:

View File

@ -1,5 +1,5 @@
fshcmdCLS: .db "CLS", 0
fshcmdCLSo: .db $10
fshcmdCLSo: .dw $0010
fshcmdCLSm: .db "Clears the screen", 0
fshcmdCLSu: .db "CLS", 0
fshcmdCLSf:

View File

@ -1,5 +1,5 @@
fshcmdCOPY: .db "COPY", 0
fshcmdCOPYo: .db $02
fshcmdCOPYo: .dw $0002
fshcmdCOPYm: .db "Copys a value in FSH memory to another addess", 0
fshcmdCOPYu: .db "COPY <source address> <destination address>", 0
fshcmdCOPYf:

View File

@ -1,5 +1,5 @@
fshcmdEXIT: .db "EXIT", 0
fshcmdEXITo: .db $FF
fshcmdEXITo: .dw $00FF
fshcmdEXITm: .db "Exits Fsh", 0
fshcmdEXITu: .db "EXIT", 0
fshcmdEXITf: JP Cleanup

View File

@ -1,5 +1,5 @@
fshcmdHELP: .db "HELP", 0
fshcmdHELPo: .db $21
fshcmdHELPo: .dw $0021
fshcmdHELPm: .db "Displays all commands", 0
fshcmdHELPu: .db "HELP", 0
fshcmdHELPf:

View File

@ -1,5 +1,5 @@
fshcmdINFO: .db "INFO", 0
fshcmdINFOo: .db $20
fshcmdINFOo: .dw $0020
fshcmdINFOm: .db "Displays Syetem Information and Stats", 0
fshcmdINFOu: .db "INFO", 0
fshcmdINFOf:

View File

@ -1,5 +1,5 @@
fshcmdMAN: .db "MAN", 0
fshcmdMANo: .db $22
fshcmdMANo: .dw $0022
fshcmdMANm: .db "Displays MAN text for command", 0
fshcmdMANu: .db "MAN <command>", 0
fshcmdMANf:

View File

@ -1,5 +1,5 @@
fshcmdMOVE: .db "MOVE", 0
fshcmdMOVEo: .db $03
fshcmdMOVEo: .dw $0003
fshcmdMOVEm: .db "Move a value in FSH memory to another addess", 0
fshcmdMOVEu: .db "MOVE <source address> <destination address>", 0
fshcmdMOVEf:

View File

@ -1,5 +1,5 @@
fshcmdSET: .db "SET", 0
fshcmdSETo: .db $01
fshcmdSETo: .dw $0001
fshcmdSETm: .db "Sets a value in FSH memory", 0
fshcmdSETu: .db "SET <destination address> <value>", 0
fshcmdSETf:

View File

@ -1,5 +1,5 @@
fshcmdSLEEP: .db "SLEEP", 0
fshcmdSLEEPo: .db $16
fshcmdSLEEPo: .dw $0016
fshcmdSLEEPm: .db "Puts the calculator into sleep mode (APD)", 0
fshcmdSLEEPu: .db "SLEEP", 0
fshcmdSLEEPf:

View File

@ -1,5 +1,5 @@
fshcmdVAR: .db "VAR", 0
fshcmdVARo: .db $11
fshcmdVARo: .dw $0011
fshcmdVARm: .db "Displays a value from FSH memory", 0
fshcmdVARu: .db "VAR <source address>", 0
fshcmdVARf:

View File

@ -1,5 +1,5 @@
fshcmdVARS: .db "VARS", 0
fshcmdVARSo: .db $12
fshcmdVARSo: .dw $0012
fshcmdVARSm: .db "Displays all Fsh Vars", 0
fshcmdVARSu: .db "VARS", 0
fshcmdVARSf:

View File

@ -16,3 +16,23 @@ wordcpy:
pop hl
pop de
ret
;;wordcmp
;;Compares 2 words
;;Inputs:
;; HL: word pointer
;; DE: word pointer
wordcmp:
push hl
push de
ld a, (de)
cp a, (hl)
jr nz, wordcmpEnd
inc hl
inc de
ld a, (de)
cp a, (hl)
wordcmpEnd:
pop de
pop hl
ret

View File

@ -1,6 +1,7 @@
#include "includes/lib/std/Math.asm"
#include "includes/lib/std/Random.asm"
#include "includes/lib/std/Byte.asm"
#include "includes/lib/std/Word.asm"
#include "includes/lib/std/Mem.asm"
#include "includes/lib/std/Char.asm"
#include "includes/lib/std/Cursor.asm"

View File

@ -1,21 +0,0 @@
;;decodecmdopt
;;compares cmdXs to command input and conditionally sets opt to optcode
;;Inputs:
;; HL: cmd string input
;; DE: op code mem location
#macro decodecmdopt(cmdXs, cmdXo)
push hl
push de
ld de, cmdXs
call strcmp
ld hl, cmdXo
pop de
call z, bytecpy
pop hl
#endmacro
#macro routeoptjp(cmdXo, cmdXf)
ld de, cmdXo
call bytecmp
jp z, cmdXf
#endmacro

View File

@ -1,4 +1,3 @@
#include "includes/macros/misc.asm"
#include "includes/macros/pixel.asm"
#include "includes/macros/draw.asm"
#include "includes/macros/command.asm"

View File

@ -18,15 +18,13 @@ FshVars equ RamVars
FshCmd equ FshVars + FshVarsSize
FshPrgm equ FshCmd + FshCmdSize
FshCmdNull equ FshCmd + FshCmdInptSize
FshCmdOP equ FshCmdNull + 1
FshCmdArg0 equ FshCmd + 9
FshCmdArg1 equ FshCmdArg0 + 9
FshCmdArg2 equ FshCmdArg1 + 9
FshCmdArg3 equ FshCmdArg2 + 9
FshCmdArgFlags equ FshCmdArg3 + 10
FshCmdErrCode equ FshCmdArgFlags + 1
FshScratch equ FshCmdErrCode + 1
FshCmdOP equ FshCmdErrCode + 1
FshScratch equ FshCmdOP + 2
.list