Initial setup:
0100 c5 30 lds si,[bx+si] ; Initialize SI
0102 04 ad add al,ad
0104 e6 61 out 61,al
0106 eb f9 jmp 0101
After first jump:
0101 30 04 xor [si],al ; Modify color part of text buffer.
0103 ad lodsw ; Read [si] into AX and increment SI by 2.
0104 e6 61 out 61,al
0106 eb f9 jmp 0101
So the XOR sort of randomizes memory, LODSW reads that memory back (with wraparound), and then writing to port 61h may or may not play a sound depending on bit 0 of AL.
The part I am not sure about is how SI conveniently ends up pointing at video memory. I thought text memory is at b800:0000, and I am not sure how that's derived from [bx+si]?
I believe it worked like this:
So the XOR sort of randomizes memory, LODSW reads that memory back (with wraparound), and then writing to port 61h may or may not play a sound depending on bit 0 of AL.The part I am not sure about is how SI conveniently ends up pointing at video memory. I thought text memory is at b800:0000, and I am not sure how that's derived from [bx+si]?