Prev: 60222 Up: Map Next: 60608
60241: Input Line
Used by the routine at JumpTable.
Main game entry from JumpTable_InputLine. ENTER submits via SubmitInputLine.
InputLine 60241 SUB A Write 0 to *InputLineState_Length, *InputLineState and *InputLineState_Dirty.
60242 LD (23547),A
60245 LD (23546),A
60248 LD (23549),A
60251 CALL InputLine_DrawCursor Call InputLine_DrawCursor.
This entry point is used by the routine at InputLine_SymbolShiftRemap.
Wait until a new key is down.
InputLine_Poll 60254 LD A,(23548) Copy *InputLineState_LastKey to D.
60257 LD D,A
60258 LD A,(23556) Read KSTATE (second key slot).
60261 LD (23548),A Write the key to *InputLineState_LastKey.
60264 CP 255 Jump to InputLine_Poll if none is down.
60266 JR Z,InputLine_Poll
60268 CP D Jump to InputLine_Poll if the key has not changed.
60269 JR Z,InputLine_Poll
60271 LD E,A E=A.
Test for Caps Shift.
60272 LD BC,65278 Read from the keyboard;
Port Number Bit
0 1 2 3 4
254 CAPS SHIFT Z X C V
60275 IN A,(C)
60277 BIT 0,A Jump to InputLine_CapsShift when Caps Shift is held.
60279 JP Z,InputLine_CapsShift
60282 LD BC,32766 Read from the keyboard;
Port Number Bit
0 1 2 3 4
127 SPACE SYMBOL SHIFT M N B
60285 IN A,(C)
60287 BIT 1,A Test the Symbol Shift bit.
Test for Symbol Shift.
InputLine_SymbolShiftHeld 60289 JR Z,InputLine_SymbolShiftRemap Jump to InputLine_SymbolShiftRemap when it is held.
This entry point is used by the routine at InputLine_SymbolShiftRemap.
Handle an ordinary keypress.
InputLine_HandleKey 60291 LD A,E Jump to InputLine_Enter if ENTER was pressed.
60292 CP 13
60294 JR Z,InputLine_Enter
Append the character to the input buffer.
60296 LD A,(23546) Fetch *InputLineState into D.
60299 LD D,A
60300 CP 62 Jump to InputLine_Poll if the line already holds 62 characters.
60302 JR NC,InputLine_Poll
60304 LD HL,23470 Store the key in InputBuffer and *PrintState_Character.
60307 ADD A,L
60308 LD L,A
60309 LD A,E
60310 LD (HL),A
60311 LD (23545),A
60314 LD A,22 Set PrintState_Row, PrintState_Flags and PrintState for echoing on row 22.
60316 LD (23544),A
60319 SUB A
60320 LD (23542),A
60323 LD A,5
60325 LD (23541),A
60328 LD A,D Copy *InputLineState to *PrintState_Column.
60329 LD (23543),A
60332 CP 32 Jump to InputLine_EchoChar if the column is still on this row.
60334 JR C,InputLine_EchoChar
60336 SUB 32 Wrap onto row 23.
60338 LD (23543),A
60341 LD A,23
60343 LD (23544),A
Echo it onto the input row.
InputLine_EchoChar 60346 CALL PrintCharacter Call PrintCharacter.
60349 LD A,(23547) Grow *InputLineState_Length if this column is new.
60352 CP D
60353 JR NZ,InputLine_AdvanceCursor
60355 INC A
60356 LD (23547),A
Advance the cursor, click, and poll again.
InputLine_AdvanceCursor 60359 LD A,D Advance *InputLineState.
60360 INC A
60361 LD (23546),A
60364 CALL InputLine_DrawCursor Call InputLine_DrawCursor.
60367 LD A,1 Set *InputLineState_Dirty.
60369 LD (23549),A
60372 CALL InputLine_Click Call InputLine_Click.
60375 JR InputLine_Poll Jump to InputLine_Poll.
Terminate the buffer with ENTER and submit the line.
InputLine_Enter 60377 LD A,(23547) Copy *InputLineState_Length to *InputLineState_SavedLength.
60380 LD (23550),A
60383 LD A,(23547) Write ENTER (13) at the end of InputBuffer.
60386 LD HL,23470
60389 ADD A,L
60390 LD L,A
60391 LD (HL),13
60393 LD HL,23470 Point InputBuffer_TokenStart and InputBuffer_NextToken at InputBuffer.
60396 LD (23463),HL
60399 LD (23465),HL
60402 JP SubmitInputLine Jump to SubmitInputLine.
Caps Shift chords: 1 restore length, 5/ 8 move the cursor, 9 insert a space, 0 delete, 2 is a no-op stub.
InputLine_CapsShift 60405 LD A,E Jump to InputLine_Caps1 if Caps Shift + 1.
60406 CP 49
60408 JR Z,InputLine_Caps1
60410 CP 50 Jump to InputLine_Caps2 if Caps Shift + 2.
60412 JR Z,InputLine_Caps2
60414 CP 53 Jump to InputLine_Caps5 if Caps Shift + 5.
60416 JR Z,InputLine_Caps5
60418 CP 56 Jump to InputLine_Caps8 if Caps Shift + 8.
60420 JR Z,InputLine_Caps8
60422 CP 48 Jump to InputLine_Caps0 if Caps Shift + 0.
60424 JP Z,InputLine_Caps0
60427 CP 57 Jump to InputLine_Caps9 if Caps Shift + 9.
60429 JR Z,InputLine_Caps9
60431 JP InputLine_Poll Jump to InputLine_Poll.
Restore the saved length and redraw.
InputLine_Caps1 60434 LD A,(23549) Jump to InputLine_Poll if *InputLineState_Dirty is set.
60437 AND A
60438 JP NZ,InputLine_Poll
60441 LD A,(23550) Copy *InputLineState_SavedLength to *InputLineState_Length.
60444 LD (23547),A
60447 CALL InputLine_Redraw Call InputLine_Redraw.
60450 JP InputLine_Poll Jump to InputLine_Poll.
Caps Shift + 2 is a no-op.
InputLine_Caps2 60453 LD A,(23549) Jump to InputLine_Poll.
60456 AND A
60457 JP Z,InputLine_Poll
60460 JP NZ,InputLine_Poll
60463 LD A,(23550) Copy *InputLineState_SavedLength to *InputLineState_Length.
60466 LD (23547),A
60469 RET Return.
Move the cursor one column left and redraw it.
InputLine_Caps5 60470 LD A,(23546) Jump to InputLine_Poll if already at the start.
60473 AND A
60474 JP Z,InputLine_Poll
60477 CALL InputLine_ClearCursor Call InputLine_ClearCursor.
60480 LD A,(23546) Decrease *InputLineState.
60483 DEC A
60484 LD (23546),A
60487 CALL InputLine_DrawCursor Call InputLine_DrawCursor.
60490 JP InputLine_Poll Jump to InputLine_Poll.
Move the cursor one column right and redraw it.
InputLine_Caps8 60493 LD A,(23547) Jump to InputLine_Poll if already at the end of the line.
60496 LD B,A
60497 LD A,(23546)
60500 CP B
60501 JP Z,InputLine_Poll
60504 CALL InputLine_ClearCursor Call InputLine_ClearCursor.
60507 LD A,(23546) Increase *InputLineState.
60510 INC A
60511 LD (23546),A
60514 CALL InputLine_DrawCursor Call InputLine_DrawCursor.
60517 JP InputLine_Poll Jump to InputLine_Poll.
Insert a space at the cursor by shifting the tail right.
InputLine_Caps9 60520 LD A,(23547) Jump to InputLine_Poll if the line is full.
60523 CP 62
60525 JP NC,InputLine_Poll
60528 INC A Increase *InputLineState_Length.
60529 LD (23547),A
60532 LD E,A Work out how many bytes to shift.
60533 LD A,(23546)
60536 LD B,A
60537 LD A,E
60538 SUB B
60539 LD C,A
60540 LD A,E Point HL at the end of InputBuffer.
60541 LD HL,23470
60544 ADD A,L
60545 LD L,A
60546 PUSH HL Copy HL to DE (using the stack).
60547 POP DE
60548 DEC HL Shift the tail right.
60549 LD B,0
60551 LDDR
60553 LD A,32 Write a space at the cursor.
60555 LD (DE),A
60556 CALL InputLine_Redraw Call InputLine_Redraw.
60559 LD A,1 Set *InputLineState_Dirty.
60561 LD (23549),A
60564 JP InputLine_Poll Jump to InputLine_Poll.
Delete the character left of the cursor by shifting the tail left.
InputLine_Caps0 60567 LD A,(23546) Jump to InputLine_Poll if already at the start.
60570 AND A
60571 JP Z,InputLine_Poll
60574 DEC A Decrease *InputLineState.
60575 LD (23546),A
60578 LD B,A Decrease *InputLineState_Length.
60579 LD A,(23547)
60582 DEC A
60583 LD (23547),A
60586 SUB B Count the bytes to shift.
60587 LD C,A
60588 INC C
60589 LD HL,23470 Point HL at the cursor in InputBuffer.
60592 LD A,B
60593 ADD A,L
60594 LD L,A
60595 PUSH HL Copy HL to DE (using the stack).
60596 POP DE
60597 INC HL Shift the tail left.
60598 LD B,0
60600 LDIR
60602 CALL InputLine_Redraw Call InputLine_Redraw.
60605 JP InputLine_Poll Jump to InputLine_Poll.
Prev: 60222 Up: Map Next: 60608