mirror of
https://github.com/PDP-10/its.git
synced 2026-04-30 13:42:06 +00:00
105 lines
2.4 KiB
Plaintext
105 lines
2.4 KiB
Plaintext
;;; -*- Midas -*- Game idea by RAE / Code by KMP
|
||
title Guess - Guess a number
|
||
|
||
a=:1
|
||
b=:2
|
||
c=:3
|
||
ttyo=:4
|
||
ttyi=:5
|
||
char=:6
|
||
where=:7
|
||
wins=:10
|
||
|
||
;;; Define some helpful macros
|
||
|
||
.insrt syseng;$call macro
|
||
|
||
define sysc3 op,val1,val2,val3
|
||
.call [ setz ? sixbit /op/ ? movem arg1 ? movem arg2 ? movem arg3 ((setz)) ]
|
||
termin
|
||
|
||
define type &string
|
||
movei a,<.length string>
|
||
move b,[440700,,[ascii string]]
|
||
$call siot,[#ttyo,b,a]
|
||
.lose %lsfil
|
||
termin
|
||
|
||
;;; Main program
|
||
|
||
guess: $call open,[#ttyo,[sixbit/tty/]][][#.uao\%tjdis]
|
||
.lose %lsfil
|
||
|
||
$call open,[#ttyi,[sixbit/tty/]][][#.uai]
|
||
.lose %lsfil
|
||
|
||
movei where,[ jrst death ]
|
||
|
||
setz wins,
|
||
|
||
;(SYSCALL 0 'TTYSET TYO ; bit 3.2 (%TSSII) of TTYSTS
|
||
; (CAR (STATUS TTY)) (CADR (STATUS TTY))
|
||
; (BOOLE 7 1_19. (CADDR (STATUS TTY))))
|
||
|
||
$call ttyget,[#ttyi][a,b,c]
|
||
jrst suicide
|
||
ior c,[2,,]
|
||
$call ttyset,[#ttyi,a,b,c]
|
||
jrst suicide
|
||
type "AAre you thinking of a number? "
|
||
jrst win2
|
||
|
||
askhim: type "AOk. Is your number 7? "
|
||
movei where,die
|
||
ask1: .iot ttyi,char ; Read a char
|
||
andi char,137 ; Uppercase
|
||
cain char,"Y ; If a y, ...
|
||
jrst win ; We win
|
||
cain char,"N ; If an n, ...
|
||
jrst askhim ; Loop
|
||
caie char,"Q ; If a q, ...
|
||
cain char,^Q ; or control-q
|
||
jrst [ type "AYou can't quit.AIs your number 7? "
|
||
jrst ask1 ]
|
||
cain char,^Z
|
||
jrst [ type "AYou can't Control-Z out!AIs your number 7? "
|
||
jrst ask1 ]
|
||
cain char,^G
|
||
jrst [ type "AYou can't ^G out ... I'm going to win.AIs your number 7? "
|
||
jrst ask1 ]
|
||
type " (Y or N) " ; Give help
|
||
jrst ask1 ; and loop
|
||
|
||
win: aos wins, ; Count wins
|
||
type "AI win..." ; Rub it in
|
||
win1: type "Want to play again? " ; Maybe new round
|
||
win2: .iot ttyi,char ; Read a char
|
||
andi char,137 ; Uppercase
|
||
cain char,"Y ; If a y, ...
|
||
jrst askhim ; Start over
|
||
cain char,"N ; If an n, ...
|
||
jrst @where ; Die
|
||
type " (Y or N) " ; Give help
|
||
jrst win2 ; and loop
|
||
|
||
die: cain wins,1
|
||
jrst [ type "ABeat you today, huh?"
|
||
jrst death ]
|
||
cain wins,2
|
||
jrst [ type "ATwo for me and *none* for you ..."
|
||
jrst death ]
|
||
cain wins,3
|
||
jrst [ type "AHey, I'm getting pretty good at this. Won 3 of 3"
|
||
jrst death ]
|
||
caig wins,5
|
||
jrst [ type "AYou're just not winning!"
|
||
jrst death ]
|
||
type "AYou'd probably win more if you didn't pick 7"
|
||
|
||
death: type "ABetter luck next time...A"
|
||
.logout 1, ; Kill job
|
||
|
||
suicid: type "AUnknown error. Please report this.A"
|
||
jrst death
|
||
|
||
end guess |