Skip to content

Commit

Permalink
Merge pull request #17 from fourstix/b_pause
Browse files Browse the repository at this point in the history
Create pause utility.
  • Loading branch information
fourstix authored Dec 2, 2021
2 parents b7af5b4 + e1a6319 commit 7155f57
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 4 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ Free a block of memory allocated at the hex address *hhhh* on the heap.

## scpy
**Usage:** scpy [-y] *source* *dest*
Safely copy the file from *source* to the destination file *dest*. The scpy command does not over-write directories and will prompt before over-writing an existing destination file. The -y option will
over-write an existing file without the prompt. *Copy or rename 'scpy' to 'copy' to replace default Elf/OS command in the /bin directory.*
Safely copy the file from *source* to the destination file *dest*. The scpy command does not over-write directories and will prompt before over-writing an existing destination file. The -y option will over-write an existing file without the prompt. *Copy or rename 'scpy' to 'copy' to replace default Elf/OS command in the /bin directory.*

## xtrim
**Usage:** xtrim *filename*, where *filename* is an executable file.
Expand All @@ -64,6 +63,10 @@ Send the hex value *hh* out to Port 4 *(where hh ranges in value from 00 to FF)*
**Usage:** nop
No Operation, a simple program that does nothing. *Can be copied or renamed to 'rem' in the /bin directory and used for comments in command files*

## pause
**Usage:** pause [-0|-1|-2|-3|-4, default = -4]
Display a prompt *Press Input to continue...* and wait for Input to return. The options -1,-2,-3 or -4 will wait for input on the /EFn line. The option -0 will wait for serial input. The default is to wait for Input on /EF4.

## pwd
**Usage:** pwd
Print Working Directory, write the current directory to the output.
Expand Down Expand Up @@ -123,7 +126,7 @@ Library Files
-------------
The command files are grouped into three Elf/OS library files that can be unpacked with the Elf/OS lbr command using the e option to *extract* files.
* file_utils.lbr - Library file for Elf/OS file utilities containing the cmd, flags, header, malloc, mfree and xtrim commands. Extract these files with the Elf/OS command *lbr e file_utils*
* io_utils.lbr - Library file for Elf/OS I/O utilities containing the clr, input, nop, output, pwd, say, and stack commands. Extract these files with the Elf/OS command *lbr e io_utils*
* io_utils.lbr - Library file for Elf/OS I/O utilities containing the clr, input, nop, output, pause, pwd, say, and stack commands. Extract these files with the Elf/OS command *lbr e io_utils*
* stg_utils.lbr - Library file for STG NVR/RTC/UART and STG EPROM utilities contains the stg, videostg, xsb, seq and req commands. Extract these files with the Elf/OS command *lbr e stg_utils*
* video_utils.lbr - Library file for ELf/OS 1861 Pixie Video utilities contains the spaceship, dma_test, tvclock and voff commands. Extract these files with the Elf/OS command *lbr e video_utils*

Expand Down Expand Up @@ -155,8 +158,9 @@ Repository Contents
* **/src/io/** -- Source files for Elf/OS I/O utilities.
* cls.asm - Clear the screen
* input.asm - Input and display data read from Port 4
* nop.asm - No Operation - simple program that does nothing.
* nop.asm - No Operation - simple program that does nothing
* output.asm - Output hh - send the hex value 'hh' out to Port 4
* pause.asm - Display a prompt and wait for input
* pwd.asm - Print Working Directory - prints the current directory
* say.asm - Say 'text' - write the text string back to the output
* stack.asm - Print the value of the Elf/OS stack pointer
Expand Down
Binary file added bin/io/pause.bin
Binary file not shown.
Binary file modified hlp/utils.lbr
Binary file not shown.
Binary file modified lbr/io_utils.lbr
Binary file not shown.
112 changes: 112 additions & 0 deletions src/io/pause.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
; -------------------------------------------------------------------
; Display a prompt message and wait for input
; Copyright 2021 by Gaston Williams
; -------------------------------------------------------------------
; Based on software written by Michael H Riley
; Thanks to the author for making this code available.
; Original author copyright notice:
; *******************************************************************
; *** This software is copyright 2004 by Michael H Riley ***
; *** You have permission to use, modify, copy, and distribute ***
; *** this software so long as this copyright notice is retained. ***
; *** This software may not be used in commercial applications ***
; *** without express written permission from the author. ***
; *******************************************************************

#include ops.inc
#include bios.inc
#include kernel.inc

; ************************************************************
; This block generates the Execution header
; It occurs 6 bytes before the program start.
; ************************************************************
org 02000h-6 ; Header starts at 01ffah
dw 02000h ; Program load address
dw endrom-2000h ; Program size
dw 02000h ; Program execution address

org 02000h ; Program code starts here
br start ; Jump past build information

; Build date
date: db 80H+12 ; Month, 80H offset means extended info
db 2 ; Day
dw 2021 ; Year

; Current build number
build: dw 1

; Must end with 0 (null)
db 'Copyright 2021 Gaston Williams',0

start: LOAD rf, prompt ; set rf to default message
chk_arg: lda ra ; process arguments
smi ' '
bz chk_arg ; move past any spaces in argument
dec ra ; move back to non-space character
LDA ra ; check for nonzero byte
bz wait4 ; jump to default input on /ef4
smi '-' ; check for argument switch
lbnz bad_arg ; anything else is a bad argument
ldn ra ; check for option 0
smi '0' ; to wait for input on serial data
bz waits
smi 1 ; check for option 1 ('1' - '0' = 1)
bz wait1 ; to wait for input on /ef1
smi 1 ; check for option 2 ('2' - '1' = 1)
bz wait2 ; to wait for input of /ef2
smi 1 ; check for option 3 ('3' - '2' = 1)
bz wait3 ; to wait for input of /ef4
smi 1 ; check for option 4 ('4' - '3' = 1)
bz wait4 ; to wait for input of /ef4
lbr bad_arg ; anything else is a bad argument

waits: CALL O_MSG ; display prompt
CALL O_INPUT ; wait here for serial input
br goodbye ; exit
wait1: CALL O_MSG ; display prompt
bn1 $ ; wait here for input press on /ef1
br goodbye ; exit
wait2: CALL O_MSG ; display prompt
bn2 $ ; wait here for input press on /ef2
br goodbye ; exit
wait3: CALL O_MSG ; display prompt
bn3 $ ; wait here for input press on /ef3
br goodbye ; exit
wait4: CALL O_MSG ; display prompt
bn4 $ ; wait here for input press on /ef4
goodbye: RETURN ; return to Elf/OS
bad_arg: LOAD rf, usage ; show usage text and exit
CALL O_MSG
LOAD rf, info1
CALL O_MSG
LOAD rf, info2
CALL O_MSG
LOAD rf, info3
CALL O_MSG
LOAD rf, info4
CALL O_MSG
lbr O_WRMBOOT ; return to Elf/OS
prompt: db 'Press Input to continue...',0
usage: db 'Usage: pause [-0|-1|-2|-3|-4, default = -4]',13,10,0
info1: db 'Display a prompt message and wait for input.',13,10,0
info2: db 'Use option -1,-2,-3 or -4 to wait for /EFn line input.',13,10,0
info3: db 'Use option -0 to wait for serial input.',13,10,0
info4: db 'Waiting for input on the /EF4 line is the default.',13,10,0
;------ define end of execution block
endrom: equ $

0 comments on commit 7155f57

Please sign in to comment.