Prev: 37322 Up: Map Next: 37490
37363: TickMessageQueue
Per-frame driver of the message line's teletype effect. A message's life: dequeue -> RenderMessage draws it over black attributes -> a bright-red cursor sweeps left-to-right, turning each column black-on-cyan (the reveal) -> the message holds (timer 50, or just 2 when more messages wait) -> the cursor sweeps back right-to-left blacking it out -> the next message is fetched. MsgDrawnCol encodes the phase: 0 = line free, bit 7 set = revealing, bit 7 clear = erasing. Called twice per frame, so the sweeps run at ~100 cells/s.
Used by the routine at 36457.
37363 LD A,(33709) message currently holding?
37366 AND A
37367 JR Z,37383
37369 DEC A yes: run down the hold time
37370 LD (33709),A
37373 RET NZ
37374 LD A,(33710) hold over: start the erase sweep —
37377 AND 31 MsgDrawnCol = current column,
37379 LD (33708),A bit 7 clear
37382 RET
37383 LD A,(33708) a sweep in progress?
37386 AND A
37387 JR NZ,37432
37389 LD A,(33741) line free: anything queued?
37392 LD HL,33714
37395 CP L
37396 JR NZ,37399
37398 RET no: idle
37399 LD A,(HL) pop the head entry:
37400 INC HL A = msg#,
37401 LD E,(HL) E/D = actor/target params
37402 INC HL
37403 LD D,(HL)
37404 LD (33712),DE
37408 LD BC,21 compact the queue down
37411 LD DE,33714 by one 3-byte entry
37414 LD HL,33717
37417 LDIR
37419 LD HL,(33741)
37422 DEC HL
37423 DEC HL
37424 DEC HL
37425 LD (33741),HL
37428 CALL 37221 draw it (still invisible)
37431 RET
37432 BIT 7,A which sweep phase?
37434 JR Z,37477 bit 7 clear: erasing
37436 LD HL,(33710) revealing: the column behind turns
37439 LD (HL),40 black-on-cyan (readable),
37441 INC HL the cursor block (bright red)
37442 LD (HL),82 moves one right
37444 LD (33710),HL
37447 DEC A reached the end of the text?
37448 CP 128
37450 JR Z,37456
37452 LD (33708),A not yet: keep sweeping
37455 RET
37456 XOR A reveal done: line phase = idle,
37457 LD (33708),A
37460 LD A,(33741) hold the message for 50 ticks —
37463 LD HL,33714 only 2 when more messages
37466 CP L are waiting
37467 LD A,50
37469 JR Z,37473
37471 LD A,2
37473 LD (33709),A
37476 RET
37477 LD HL,(33710) erasing: black out this column,
37480 LD (HL),0 the cursor block moves one left
37482 DEC HL
37483 LD (HL),82
37485 LD (33710),HL
37488 DEC A A = columns left (0 frees the line)
37489 DEFB 50 opcode of "LD (msg-head var),A": its operands are the XOR H / ADD A,E at 37490, so falling through stores A and hits that entry's RET
Prev: 37322 Up: Map Next: 37490