level 6 cleanup, fix keyboard debounce

This commit is contained in:
Jeremy Penner 2020-04-04 13:27:40 -04:00
parent 60f6e348ad
commit 89aee929eb
22 changed files with 106 additions and 54 deletions

BIN
boot.jim

Binary file not shown.

BIN
debug.jim

Binary file not shown.

BIN
defs.jim

Binary file not shown.

BIN
end.jim

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
game.jim

Binary file not shown.

View file

@ -165,6 +165,9 @@ defer on-gord-sit
then ;
var hack-handled
: hacked 1 hack-handled ! ;
: hack-override? ( e -- e b )
dup EVHACK = if hacked drop EVNOP 1 else 0 then ;
: activate-libb
haslibb? if Libb entity-present? not if
:| 0 hack-handled !

BIN
input.jim

Binary file not shown.

BIN
jiles.jim

Binary file not shown.

BIN
job.jim

Binary file not shown.

19
kbd.c
View file

@ -35,12 +35,29 @@ static void interrupt kbd_isr() {
enable();
}
unsigned char kbd_wait() {
unsigned char kbd_wait_raw() {
kbd_triggered = 0;
while (!kbd_triggered) {}
return kbd_triggered;
}
static unsigned char kbd_any() {
unsigned char key;
kbd_debounce();
for (key = 0; key < 128; key ++) {
if (keybuf[key] != KEY_OFF) {
return key;
}
}
return 0xff;
}
unsigned char kbd_wait() {
unsigned char found = kbd_any();
for (; found != 0xff; found = kbd_any()) {}
for (; found == 0xff; found = kbd_any()) {}
return found;
}
void kbd_init() {
if (oldKbdISR == NULL) {
memset(keybuf, 0, 128);

3
kbd.h
View file

@ -17,7 +17,8 @@ unsigned char kbd_wait();
#define keyIsDown(k) (keybuf[k] & KEY_SIGNAL)
#define keyWasPressed(k) ((keybuf[k] & 0x0f) == KEY_PRESSED)
#define consumeKey(k) (keybuf[k] = keyWasPressed(k) ? KEY_DOWN : keybuf[k])
#define consumeKey(k) (keybuf[k] = keyWasPressed(k) ? \
KEY_DOWN | (keybuf[k] & KEY_SIGNAL ) : keybuf[k])
#define keyWasReleased(k) ((keybuf[k] & 0x0f) == KEY_RELEASED)
#define K_ESC 1

Binary file not shown.

View file

@ -69,7 +69,7 @@ var pady-introduced
18 1 defrexx r1
3 1 door d1
17 1 door d2
16 1 door d2
4 11 door d3
10 9 door d4
16 11 door d5
@ -87,18 +87,18 @@ defer term-loop
: ret-if-on ( e -- ) dup computer-on? if rdrop else drop then ;
: first-on ( -- e )
c1 ret-if-on c2 ret-if-on c3 ret-if-on c4 ret-if-on c5 ret-if-on
c6 ret-if-on c7 ret-if-on c8 ret-if-on c9 ret-if-on cx ret-if-on 0 ;
c1 ret-if-on cx ret-if-on c2 ret-if-on c3 ret-if-on c4 ret-if-on
c5 ret-if-on c6 ret-if-on c7 ret-if-on c8 ret-if-on c9 ret-if-on 0 ;
defer cmp-next-on
: next-on ( e -- e )
:| over = if drop ' ret-if-on ' cmp-next-on redefine then |; ' cmp-next-on redefine
c1 cmp-next-on c2 cmp-next-on c3 cmp-next-on c4 cmp-next-on c5 cmp-next-on
c6 cmp-next-on c7 cmp-next-on c8 cmp-next-on c9 cmp-next-on cx cmp-next-on
c1 cmp-next-on cx cmp-next-on c2 cmp-next-on c3 cmp-next-on c4 cmp-next-on
c5 cmp-next-on c6 cmp-next-on c7 cmp-next-on c8 cmp-next-on c9 cmp-next-on
first-on ;
:noname responder next-on ; ' term-loop redefine
5197 ' d1 3 2 keypad k1
-1 ' d2 17 2 keypad k2 ( must be hacked )
-1 ' d2 16 2 keypad k2 ( must be hacked )
2757 ' d3 4 10 keypad k3
7777 ' d5 16 10 keypad k5
@ -110,7 +110,11 @@ defer cmp-next-on
LEV_END 13 12 exitdoor dx
' dx 14 12 scanner sx
c1 :noname dup chain-listener EVACT = if
c1 :noname hack-override? if
libb say" just a bunch of boring\source code."
libb say" bill didn't leave anything\really juicy here where\other people could get at it."
then
dup chain-listener EVACT = if
term say" .:: welcome to farquaad ::.\please select your choice:"
0 begin :|
s" about farquaad" :|
@ -118,7 +122,7 @@ c1 :noname dup chain-listener EVACT = if
term say" don't mess with it!!!"
|; yield
s" s3cr3t c0d3z" :| term say" get out lamer" |; yield
s" boss key" :| term say" press f9 to activate" |; yield
s" boss key" :| term say" press f9 to activate\at any time" |; yield
s" open pod bay doors" :| term say" i can't do that dave" |; yield
s" log off" :| term say" good riddance" drop 1 |; yield
done |; choose
@ -141,7 +145,7 @@ c3 :noname dup chain-listener EVACT = if
else
term say" The passcode is 5197."
then
term say" Subject: re: RE: Server's down\Uhhh the firewall blocked\the passcode?"
term say" Subject: re: RE: Server's down\Uhhh the firewall is blocking\the passcode?"
term say" Subject: re: RE: Server's down\AUGH FINE I rebooted it."
then ;
@ -150,41 +154,80 @@ c4 :noname
term say" bill's workstation\keep out dipshits"
then
dup EVTOUCH = if isneut? if
haslibb? not if
with-libb
libb say" well, well, well.\what have we here?"
libb say" > /version"
neut say" < NEUT v0.71.4rc12"
neut say" > IDENTIFY_PROGRAM.EXE"
libb say" < libb v2.718282"
libb say" oh, a nosy little fella."
neut say" NOT A FELLA."
libb say" perhaps you and i could\help each other."
neut say" WE ARE ASSISTING ALL WHO\ARE IN NEED."
libb say" i've been watching the\network. it's kind of what\i do."
libb say" you and your programmer,\you're escaping, aren't\you?"
neut say" THE BUILDING IS UNSAFE.\WE ARE HELPING."
libb say" i want out, neut."
libb say" i hate being cooped up in\this locked-down corporate\hellhole of a network."
libb say" you're going to take me\with you."
neut say" THIS COURSE OF ACTION\ALSO SEEMS POTENTIALLY\UNSAFE."
libb say" that wasn't a threat, neut.\that was a fact."
libb say" you can't get out of here\without me."
libb say" i can disable keypads.\i can reprogram terminals.\i can HELP, neut."
hide-footer 10 sleep
neut say" IT NEVER HURTS TO HELP."
libb say" that's the spirit."
neut say" > UPLOAD.EXE /LIBB"
libb say" aww yiss."
libb say" press z when you need me\to mess with something."
then
then then chain-listener ;
haslibb? not if
with-libb
libb say" well, well, well.\what have we here?"
libb say" > /version"
neut say" < NEUT v0.71.4rc12"
neut say" > IDENTIFY_PROGRAM.EXE"
libb say" < libb v2.718282"
libb say" oh, a nosy little fella."
neut say" NOT A FELLA."
libb say" perhaps you and i could\help each other."
neut say" WE ARE ASSISTING ALL WHO\ARE IN NEED."
libb say" i've been watching the\network. it's kind of what\i do."
libb say" you and your programmer,\you're escaping, aren't\you?"
neut say" THE BUILDING IS UNSAFE.\WE ARE HELPING."
libb say" i want out, neut."
libb say" i hate being cooped up in\this locked-down corporate\hellhole of a network."
libb say" you're going to take me\with you."
neut say" THIS COURSE OF ACTION\ALSO SEEMS POTENTIALLY\UNSAFE."
libb say" that wasn't a threat, neut.\that was a fact."
libb say" you can't get out of here\without me."
libb say" i can disable keypads.\i can reprogram terminals.\i can HELP, neut."
hide-footer 10 sleep
neut say" IT NEVER HURTS TO HELP."
libb say" that's the spirit."
neut say" > UPLOAD.EXE /LIBB"
libb say" aww yiss."
libb say" press z when you need me\to mess with something."
then
then then
hack-override? if
libb say" i brought everything good\along with me, don't worry."
then chain-listener ;
c5 :noname dup chain-listener EVACT = if
gord say" A weird looking spreadsheet..."
gord say" Oh wait, I pressed a key and\it disappeared. Someone using\the boss key to hide"
gord say" that they're reading the entire\archive of User Friendly comic\strips."
then ;
c6 :noname dup chain-listener EVACT = if
c6 :noname hack-override? if
libb say" hehehe, that was a fun one."
then
dup chain-listener EVACT = if
term say" Subject: Card scanners?\Looks like the scanners are\on the fritz again..."
term say" I scanned my keycard to get\into the office and the door\wouldn't close!"
term say" Someone's gotta fix that ASAP,\it's a serious security problem!"
term say" Subject: re: Card scanners?\I can take a quick look, I\might have an idea as to"
term say" what's going on.\ -- Bill"
then ;
c7 :noname hack-override? if
libb say" you know the switch is right\there on the wall, right?"
then
dup EVTOUCH = if isprog? not if
b2 switch-on? if
term say" WorkSecure (tm) v2.0\AUTHORIZED PERSONNEL ONLY"
term say" Actively neutralizing:\1 threat(s)"
else
jaye say" Looks like the power is cut."
then
drop EVNOP
then then chain-listener ;
c8 :noname dup chain-listener EVACT = if
term say" Subject: Password security\A reminder to all developers\about security best practice:"
term say" DO NOT WRITE DOWN PASSWORDS!\We pay significant license fees\for encrypted password"
term say" managers for all employees!\Use it to generate and store\secure passwords!"
jaye say" There's a sticky note attached\to the monitor that says\'7777'."
then ;
c9 :noname hack-override? if
libb say" he's just being dramatic."
then
dup chain-listener EVACT = if
term say" Subject: Experiment\Hey folks, can you all do me a\huge favour?"
term say" There was a small bug in my\code (yes, it happens!) and a\program I was working on"
term say" made a few too many copies of\itself. Can everyone check to\see if you have a process"
@ -193,18 +236,6 @@ c6 :noname dup chain-listener EVACT = if
term say" It could seriously mess with\your system.\ -- Bill"
then ;
c7 :noname dup chain-listener EVTOUCH = if isprog? not if
term say" WorkSecure (tm) v2.0\AUTHORIZED PERSONNEL ONLY"
term say" Actively neutralizing:\1 threat(s)"
then then ;
c8 :noname dup chain-listener EVACT = if
term say" Subject: Password security\A reminder to all developers\about security best practice:"
term say" DO NOT WRITE DOWN PASSWORDS!\We pay significant license fees\for encrypted password"
term say" managers for all employees!\Use it to generate and store\secure passwords!"
gord say" There's a sticky note attached\to the monitor that says\'7777'."
then ;
cx :noname dup EVTOUCH = if isprog? not if b1 switch-on? not if
jaye say" This is the sign-in terminal\used by visitors."
jaye say" It's not turning on for some\reason."

Binary file not shown.

BIN
level.jim

Binary file not shown.

BIN
map.jim

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
state.jim

Binary file not shown.

BIN
timer.jim

Binary file not shown.