Add punched tape functionality

This commit is contained in:
CrazyEttin 2022-08-14 17:56:11 +03:00
parent 1c2c501d09
commit c6c1c5567f
2 changed files with 113 additions and 23 deletions

View File

@ -247,6 +247,16 @@ cnarg: load r1, ucp
breq r0, r1, print breq r0, r1, print
load r1, lcp load r1, lcp
breq r0, r1, print breq r0, r1, print
;Write to tape
load r1, ucw
breq r0, r1, write
load r1, lcw
breq r0, r1, write
;Read from tape
load r1, ucr
breq r0, r1, read
load r1, lcr
breq r0, r1, read
;Halt ;Halt
load r1, uch load r1, uch
breq r0, r1, end breq r0, r1, end
@ -609,39 +619,77 @@ lstend: load r0, count
;Print the text ;Print the text
;Get the printer address
;High byte
print: load r0, cstff
store prwrch + 1, r0
;Low byte
load r0, cstfe
store prwrch + 2, r0
;Print
cleq r0, r0, prwr
;Return to the command prompt
breq r0, r0, cmdp
;***
;Write the text to tape
;Get the keypunch address
;High byte
write: load r0, cstff
store prwrch + 1, r0
;Low byte
load r0, cstfd
store prwrch + 2, r0
;Write
cleq r0, r0, prwr
;Write a substitute
load r0, sub
store fffd, r0
;Return to the command prompt
breq r0, r0, cmdp
;***
;Read the text from tape
;Get the save start address ;Get the save start address
;High byte ;High byte
print: load r0, svstrt read: load r0, svstrt
store chprnt + 1, r0 store chrsto + 1, r0
;Low byte ;Low byte
load r0, svstrt + 1 load r0, svstrt + 1
store chprnt + 2, r0 store chrsto + 2, r0
;Load a character from the save ;Read and store a character
chprnt: load r1, buffer + 100 chread: load r1, fffd
chrsto: store buffer + 100, r1
;Check for the save end ;Check for the save end
load r2, sub load r2, sub
breq r1, r2, prend breq r1, r2, redend
;Print the character
store fffe, r1
;Increment the save address ;Increment the save address
;Load the address ;Load the address
load r0, chprnt + 1 load r0, chrsto + 1
load r1, chprnt + 2 load r1, chrsto + 2
;Increment ;Increment
cleq r0, r0, incdw cleq r0, r0, incdw
;Store the address ;Store the address
store chprnt + 1, r0 store chrsto + 1, r0
store chprnt + 2, r1 store chrsto + 2, r1
;Print the next character ;Read the next character
breq r0, r0, chprnt breq r0, r0, chread
;Return to the command prompt ;Return to the command prompt
prend: breq r0, r0, cmdp redend: breq r0, r0, cmdp
;*** ;***
@ -1238,6 +1286,44 @@ prcln: load r0, colon
;*** ;***
;Print or write to tape
;Get the save start address
;High byte
prwr: load r0, svstrt
store chprwr + 1, r0
;Low byte
load r0, svstrt + 1
store chprwr + 2, r0
;Load a character from the save
chprwr: load r1, buffer + 100
;Check for the save end
load r2, sub
breq r1, r2, pwend
;Print the character
prwrch: store fffe, r1
;Increment the save address
;Load the address
load r0, chprwr + 1
load r1, chprwr + 2
;Increment
cleq r0, r0, incdw
;Store the address
store chprwr + 1, r0
store chprwr + 2, r1
;Print the next character
breq r0, r0, chprwr
;Return
pwend: ret
;***
;Data ;Data
;Constants ;Constants
@ -1258,6 +1344,8 @@ constd: data d
conste: data e conste: data e
constf: data f constf: data f
constf: data f constf: data f
cstfd: data fd
cstfe: data fe
cstff: data ff cstff: data ff
;Characters ;Characters
@ -1292,6 +1380,8 @@ uch: data 48
uci: data 49 uci: data 49
ucl: data 4c ucl: data 4c
ucp: data 50 ucp: data 50
ucr: data 52
ucw: data 57
bslash: data 5c bslash: data 5c
lca: data 61 lca: data 61
lcb: data 62 lcb: data 62
@ -1303,6 +1393,8 @@ lch: data 68
lci: data 69 lci: data 69
lcl: data 6c lcl: data 6c
lcp: data 70 lcp: data 70
lcr: data 72
lcw: data 77
;Variables ;Variables
ovrflw: data 0 ovrflw: data 0
@ -1326,10 +1418,6 @@ count: data 0
cmpadr: data 0 cmpadr: data 0
data 0 data 0
;Buffer and save ;Buffer and save
bfstrt: addr buffer bfstrt: addr buffer
bfsize: data fe bfsize: data fe

View File

@ -10,9 +10,9 @@ System requirements
------------------- -------------------
Gidubba requires a terminal with local echo at address FFFF and Gidubba requires a terminal with local echo at address FFFF and
optionally a line printer at address FFFE. The emulator implementation optionally a line printer at address FFFE and a punched tape reader and
included in the Thingamajig repository is suitable. If your setup keypunch at FFFD. If your setup differs from this you may have to modify
differs from this you may have to modify the code yourself. the code yourself.
Usage Usage
----- -----
@ -33,6 +33,8 @@ Commands with two arguments:
Commands with no argument: Commands with no argument:
* P: Print (requires a printer) * P: Print (requires a printer)
* W: Writes to tape (requires a keypunch)
* R: Reads from tape (requires a tape reader)
* H: Halt * H: Halt
Both commands and arguments are case-insensitive. In both the command Both commands and arguments are case-insensitive. In both the command