Skip to content

Commit

Permalink
move lodsw to be able to use ah in adc
Browse files Browse the repository at this point in the history
  • Loading branch information
donno2048 authored Apr 12, 2024
1 parent 782959d commit db6ca93
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions snake.asm
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ start: ; reset game
cbw ; but causes weird snake movements though with other keys
add di, ax ; add offset to head position
cmp di, bx ; check if head crossed vertical edge by comparing against screen size in BX
adc BYTE [di], 0x20 ; ADC head position with 0x20 to set snake character
jnp start ; if it already had snake or wall in it or if it crossed a vertical edge, PF=0 from ADC => game over
lodsw ; load 0x2007 into AX from off-screen screen buffer and advance head pointer
adc [di], ah ; ADC head position with 0x20 to set snake character
jnp start ; if it already had snake or wall in it or if it crossed a vertical edge, PF=0 from ADC => game over
mov [bp+si], di ; store head position, use BP+SI to default to SS
jz .food ; if food was consumed, ZF=1 from ADC => generate new food
.wall: ; draw an invisible wall on the left side
Expand Down

0 comments on commit db6ca93

Please sign in to comment.