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: ;;Output:
;; Sets (DE) with command op code ;; Sets (DE) with command op code
commanddecode: 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 fshcmddecode
call cryptocmddecode call cryptocmddecode
;Extention Point ;Extention Point
@ -17,6 +28,12 @@ commanddecode:
;;Inputs: ;;Inputs:
;; HL: Op code mem loc ;; HL: Op code mem loc
commandroute: commandroute:
#macro routeoptjp(cmdXo, cmdXf)
ld de, cmdXo
call wordcmp
jp z, cmdXf
#endmacro
call fshcmdroute call fshcmdroute
call cryptocmdroute call cryptocmdroute
;Extention Point ;Extention Point

View File

@ -1,5 +1,5 @@
cryptocmdDECRYPT: .db "DECRYPT", 0 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 cryptocmdDECRYPTm: .db "Decrypts a string using a cypher. see 'DECRYPT HELP' for info on cyphers", 0
cryptocmdDECRYPTu: .db "DECRYPT <Crypt Command> <Crypt Args>", 0 cryptocmdDECRYPTu: .db "DECRYPT <Crypt Command> <Crypt Args>", 0
cryptocmdDECRYPTf: cryptocmdDECRYPTf:

View File

@ -1,5 +1,5 @@
cryptocmdENCRYPT: .db "ENCRYPT", 0 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 cryptocmdENCRYPTm: .db "Encrypts a string using a cypher. see 'ENCRYPT HELP' for info on cyphers", 0
cryptocmdENCRYPTu: .db "ENCRYPT <Crypt Command> <Crypt Args>", 0 cryptocmdENCRYPTu: .db "ENCRYPT <Crypt Command> <Crypt Args>", 0
cryptocmdENCRYPTf: cryptocmdENCRYPTf:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5,14 +5,34 @@
;; DE: Destination ;; DE: Destination
wordcpy: wordcpy:
push de push de
push hl push hl
ex de, hl ex de, hl
ld a, (de) ld a, (de)
ld (hl), a ld (hl), a
inc de inc de
inc hl inc hl
ld a, (de) ld a, (de)
ld (hl), a ld (hl), a
pop hl pop hl
pop de pop de
ret 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/Math.asm"
#include "includes/lib/std/Random.asm" #include "includes/lib/std/Random.asm"
#include "includes/lib/std/Byte.asm" #include "includes/lib/std/Byte.asm"
#include "includes/lib/std/Word.asm"
#include "includes/lib/std/Mem.asm" #include "includes/lib/std/Mem.asm"
#include "includes/lib/std/Char.asm" #include "includes/lib/std/Char.asm"
#include "includes/lib/std/Cursor.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/misc.asm"
#include "includes/macros/pixel.asm" #include "includes/macros/pixel.asm"
#include "includes/macros/draw.asm" #include "includes/macros/draw.asm"
#include "includes/macros/command.asm"

View File

@ -16,17 +16,15 @@
RamVars equ 0D0EA1Fh ;saveSScreen | 21945 bytes RamVars equ 0D0EA1Fh ;saveSScreen | 21945 bytes
FshVars equ RamVars FshVars equ RamVars
FshCmd equ FshVars + FshVarsSize FshCmd equ FshVars + FshVarsSize
FshPrgm equ FshCmd + FshCmdSize FshPrgm equ FshCmd + FshCmdSize
FshCmdNull equ FshCmd + FshCmdInptSize FshCmdArg0 equ FshCmd + 9
FshCmdOP equ FshCmdNull + 1 FshCmdArg1 equ FshCmdArg0 + 9
FshCmdArg0 equ FshCmd + 9 FshCmdArg2 equ FshCmdArg1 + 9
FshCmdArg1 equ FshCmdArg0 + 9 FshCmdArg3 equ FshCmdArg2 + 9
FshCmdArg2 equ FshCmdArg1 + 9 FshCmdArgFlags equ FshCmdArg3 + 10
FshCmdArg3 equ FshCmdArg2 + 9
FshCmdArgFlags equ FshCmdArg3 + 10
FshCmdErrCode equ FshCmdArgFlags + 1 FshCmdErrCode equ FshCmdArgFlags + 1
FshCmdOP equ FshCmdErrCode + 1
FshScratch equ FshCmdErrCode + 1 FshScratch equ FshCmdOP + 2
.list .list