Skip to content

Commit

Permalink
Storage commands added
Browse files Browse the repository at this point in the history
  • Loading branch information
CorshamTech committed Nov 29, 2018
1 parent de2c93c commit 6a30ebb
Show file tree
Hide file tree
Showing 9 changed files with 4,092 additions and 64 deletions.
53 changes: 36 additions & 17 deletions IL.inc
Original file line number Diff line number Diff line change
Expand Up @@ -174,26 +174,12 @@ TSTN macro addr
db (addr-*)-1
endm
;
; SAVEP will save the current program to whatever
; storage media is available.
;
SAVEP macro
db 36
endm
;
; LOADP will load a program from storage.
; It will clear the current program first.
;
LOADP macro
db 37
endm
;
; FREE returns the amount of free RAM on top of
; the stack. This is the amount of room the user
; program has available.
;
FREE macro
db 38
db 36
endm
;
; RANDOM takes the top item off the stack and
Expand All @@ -202,14 +188,47 @@ FREE macro
; 42 then RANDOM returns a value from 0 to 41.
;
RANDOM macro
db 39
db 37
endm
;
; ABS will replace the top of stack with the
; absolute value.
;
ABS macro
db 38
endm
;
; OPENREAD opens a file for reading, as in getting
; statements from it.
;
OPENREAD macro
db 39
endm
;
; OPENWRITE opens a file for writing, as in saving
; the current program to it.
;
OPENWRITE macro
db 40
endm

;
; DCLOSE closes any open disk file.
;
DCLOSE macro
db 41
endm
;
; DGETLINE gets one line from the disk file and puts it
; into LINBUFF.
;
DGETLINE macro
db 42
endm
;
; DLIST saves the program to an open disk file.
;
DLIST macro
db 43
endm
;
list
20 changes: 15 additions & 5 deletions basic.il
Original file line number Diff line number Diff line change
Expand Up @@ -135,23 +135,33 @@ S17A:
EXIT

S17:
TST UNKNOWN,"REM" ;REMark. Skip rest of line
TST S17B,"REM" ;REMark. Skip rest of line
NXT CO
JMP STMT
;
; Commands related to saving/restoring programs
; to/from mass storage.
;
S17B:
if XKIM || CTMON65
TST S17C,"SAVE"
SAVEP
OPENWRITE
DLIST
DCLOSE
JMP CO

S17C:
TST UNKNOWN,"LOAD"
LOADP
JMP CO

OPENREAD
S17CLP:
DGETLINE ;get line from file
TSTL S17EOL ;no line num means EOL
INSERT ;put it into the program
JMP S17CLP ;keep going
S17EOL
DCLOSE ;close disk file
JMP CO ;back to start
endif
;
; Else, unknown command.
;
Expand Down
50 changes: 50 additions & 0 deletions config.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
;*********************************************************
; FILE: config.inc
;
; General configuration file for the Corsham Technologies
; CTMON65 monitor.
;*********************************************************
;
; Current version and revision
;
VERSION equ 0
REVISION equ 1
;
;FALSE equ 0
;TRUE equ !FALSE
;
; SS-50 bus constants
;
IO_BASE equ $e000
IO_SIZE equ 16
;
; Memory usage
;
ZERO_PAGE_START equ $00f0
ROM_START equ $f000
RAM_START equ $df00
;
; If enabled, turn on buffered input code.
;
BUFFERED_INPUT equ FALSE
;
MAX_ARGC equ 5
;
; If enabled, the debugger will display the flag register
; in ASCII. Nice, but takes more code.
;
FULL_STATUS equ TRUE
;
; Enable EXTENDED_CMDS to allow linking external commands
; to the command handler.
;
EXTENDED_CMDS equ FALSE
;
; Define to enable SD related functions
;
SD_ENABLED equ TRUE
;
; Size of the keyboard buffer
;
BUFFER_SIZE equ 132

87 changes: 87 additions & 0 deletions ctmon65.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
;*********************************************************
; FILE: ctmon65.inc
;
; Applications wishing to run under CTMON65 should include
; this file, as it defines vectors and other pieces of
; necessary data.
;*********************************************************
;
include "config.inc"
;
bss
org ROM_START
;
;=========================================================
; Jump table to common functions. The entries in this
; table are used by external programs, so nothing can be
; moved or removed from this table. New entries always
; go at the end. Many of these are internal functions
; and I figured they might be handy for others.
;
RESET ds 3
WARM ds 3
;
; These are the major and minor revision numbers so that
; code can check to see which CTMON65 version is running.
;
CTMON65ver ds 1
CTMON65rev ds 1
ds 1 ;unused
;
; Console related functions
;
cin ds 3
cout ds 3
cstatus ds 3
putsil ds 3
getline ds 3
crlf ds 3
HexA ds 3
;
; Low-level functions to access the SD card system
;
if SD_ENABLED
xParInit ds 3
xParSetWrite ds 3
xParSetRead ds 3
xParWriteByte ds 3
xParReadByte ds 3
;
; Higher level SD card functions
;
DiskPing ds 3
DiskDir ds 3
DiskDirNext ds 3
DiskOpenRead ds 3
DiskOpenWrite ds 3
DiskRead ds 3
DiskWrite ds 3
DiskClose ds 3
endif ;SD_ENABLED
;
org RAM_START
;
; The use of memory starting from here will remain
; constant through different versions of CTMON65.
;
IRQvec ds 2
NMIvec ds 2
;
; Before a L(oad) command, these are set to $FF.
; After loading, if they are different, jump to
; that address.
;
AutoRun ds 2
;
; Pointer to the subroutine that gets the next input
; character. Used for doing disk/console input.
;
inputVector ds 2
;
; Same thing for output.
;
outputVector ds 2
;
; Buffer for GETLINE
;
buffer ds BUFFER_SIZE
Loading

0 comments on commit 6a30ebb

Please sign in to comment.