I thought I would close the loop with a recipe that works for doing bare
metal work:
First, the revised "program":
.title getc
TKS = 177560
TKB = 177562
;TPS = 177564
;TPB = 177566
begin:
inc TKS ;set the ASR to input
getc:
tstb TKS ;is a character available on the ASR?
bpl getc ;loop until there is
movb TKB,R0 ;put the character into register 0
halt
.end begin
In RT-11, edit and save the program:
.edit/create vol:getc.mac
Compile it:
.r macro
*VOL:getc,VOL:getc/L:TTM/C:C:E:M:P:R:S=VOL:getc.mac
Type the listing if you like:
.type vol:getc.lst
Link it with /lda for an absolute binary that starts at location 1000.
.link vol:getc/map:vol:getc/lda
Look at the map to confirm:
.type vol:getc.map
RT-11 LINK V08.10 Load Map Page 1
GETC .LDA Title: GETC Ident:
Section Addr Size Global Value Global Value Global Value
. ABS. 000000 001000 = 256. words (RW,I,GBL,ABS,OVR)
001000 000020 = 8. words (RW,I,LCL,REL,CON)
Transfer address = 001000, High limit = 001016 = 263. words
Suspend RT-11
CTRL-E
In SimH, attach the lda file to the paper tape punch:
sim>att ptp getc.lda
Resume RT-11
sim>c
Back in RT-11, copy the lda file to the PC: device:
copy getc.lda pc:
Halt RT-11:
CTRL-E
sim>q
Fire up pdp11:
pdp11
PDP-11 simulator V4.0-0 Beta git commit id: 9c977e93
In SimH, load the absolute address binary and run it from location 1000:
sim> load getc.lda
sim> g 1000
Press a key, any key and try to remember what you pressed (type 'A'):
A
HALT instruction, PC: 001020 (HALT)
Examine the contents of register 0:
sim> e r0
R0: 000101
101 is the ASCII code for 'A' in Octal .
Thanks all for the hints and suggestions.
Will
On 2/19/16 4:01 PM, Timothe Litt wrote:
The console terminal driver won't like you touching the device registers.
Don't do that. Use the RT-11 syscalls instead.
Or load your program into the (emulated) bare hardware, and have fun.
This communication may not represent my employer's views,
if any, on the matters discussed.
On 19-Feb-16 16:58, Will Senn wrote:
Given the following test program that I wrote (GETC.MAC):
.title getc
.mcall .exit
TKS = 177560
TKB = 177562
;TPS = 177564
;TPB = 177566
begin:
inc TKS ;set the ASR read enable bit
getc:
tstb TKS ;is a character available?
bpl getc ;loop until there is
movb TKB,R0 ;put the character into register 0
.exit
.end begin
I would expect the console to wait until I typed a single character
and then for the program to exit. What is happening is that the
program appears to accept any number of characters and only ends when
I type CTRL-C twice.
Here are some questions that arise:
1. Is it reasonable to expect to be able to read directly from the ASR
Keyboard buffer while running RT-11 in SimH or does this somehow
compete with the running OS? (I can print characters using the ASR
Punch Buffer just fine)
2. Is there a flaw in the program? (Nevermind that it doesn't do
anything much with the character).
3. Is this a totally abnormal way to read a character?
4. What's up with needing to hit CTRL-C twice?
Answers to any of the above would be appreciated or if you have
something else, that's fine too.
Thanks,
Will
_______________________________________________
Simh mailing list
[email protected]
http://mailman.trailing-edge.com/mailman/listinfo/simh
_______________________________________________
Simh mailing list
[email protected]
http://mailman.trailing-edge.com/mailman/listinfo/simh
_______________________________________________
Simh mailing list
[email protected]
http://mailman.trailing-edge.com/mailman/listinfo/simh