On command-line shells or OS, you often need to print a message and waits for any key pressed by the user. The command is often named as ‘pause’. For example, on the command shell on Windows 8, you will have the following message printed while waiting for a key input.
The pause command is so popular that it is a internal command (resident in memory when shell is loaded) which does not require loading the code from file.
BBG-DOS as described [here] is a 8-bit Operating System made by BBG. Despite many commands such as dir, copy, cd, md, format, diskcopy and so many more, it does not have a pause command!
So we will use the 6502 assembly to program a such tiny pause.cmd program and compile this using BBG assembler basm.cmd.
; made by HelloACM.com include xnrdef.h org $8000 jmp start start: lda #DosReadKeyNoEcho jsr DosIOEntry tax ldy #$0 lda #DosProgramReturn jmp DosIOEntry
The above 6502 code works by calling the DOS function to read a key with no echo, remember its key code and use this key code as the return code to BBGDOS via the assembly instruction tax (that copies the value of register A to register X). It is similar to errorlevel in modern DOS shells.
The errorlevel code can be used later, e.g. users can press a key to select items in a menu with the help of echo
The message isn’t printed so that you can use echo (internal command) in BBGDOS to customise the message.
For example, you can create a pause.bat and contains the following:
@echo off echo Press Any Key to Continue... pause.cmd
The executable files have the following sequence given the same filename and different extensions: pause (internal if applicable), pause.cmd, pause.exc, pause.gam and pause.bat.
pause.cmd can be downloaded here(zipped, 1KB less)
–EOF (The Ultimate Computing & Technology Blog) —
Last Post: Dumping Memory using BASIC on 8-bit Famicom Clone - BBG
Next Post: Hot Boot and Cold Boot on 8-bit Famiclone BBG-DOS