<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.sizecoding.org/index.php?action=history&amp;feed=atom&amp;title=4is256</id>
		<title>4is256 - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://www.sizecoding.org/index.php?action=history&amp;feed=atom&amp;title=4is256"/>
		<link rel="alternate" type="text/html" href="http://www.sizecoding.org/index.php?title=4is256&amp;action=history"/>
		<updated>2026-05-03T07:49:03Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.27.0</generator>

	<entry>
		<id>http://www.sizecoding.org/index.php?title=4is256&amp;diff=200&amp;oldid=prev</id>
		<title>Trixter at 20:26, 14 August 2016</title>
		<link rel="alternate" type="text/html" href="http://www.sizecoding.org/index.php?title=4is256&amp;diff=200&amp;oldid=prev"/>
				<updated>2016-08-14T20:26:52Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 20:26, 14 August 2016&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Tinyprog|title=4is256|author=Rrrola|bsize=256|link=http://www.pouet.net/prod.php?which=29286}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Tinyprog|title=4is256|author=Rrrola|bsize=256|link=http://www.pouet.net/prod.php?which=29286}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Case Study]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;(Case study forthcoming)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;(Case study forthcoming)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Trixter</name></author>	</entry>

	<entry>
		<id>http://www.sizecoding.org/index.php?title=4is256&amp;diff=188&amp;oldid=prev</id>
		<title>Trixter at 19:47, 14 August 2016</title>
		<link rel="alternate" type="text/html" href="http://www.sizecoding.org/index.php?title=4is256&amp;diff=188&amp;oldid=prev"/>
				<updated>2016-08-14T19:47:30Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 19:47, 14 August 2016&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;{{Tinyprog|title=4is256|author=Rrrola|bsize=256|link=http://www.pouet.net/prod.php?which=29286}}&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;(Case study forthcoming)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;(Case study forthcoming)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Trixter</name></author>	</entry>

	<entry>
		<id>http://www.sizecoding.org/index.php?title=4is256&amp;diff=185&amp;oldid=prev</id>
		<title>Trixter: Created page with &quot;(Case study forthcoming)  &lt;syntaxhighlight lang=nasm&gt; ; *         **  %%% ### 4is256 ; * %  @@@@  ** %   #   a 256-byte brick game ; **%%      #    ==  @@ by Rrrola ;   %  ===...&quot;</title>
		<link rel="alternate" type="text/html" href="http://www.sizecoding.org/index.php?title=4is256&amp;diff=185&amp;oldid=prev"/>
				<updated>2016-08-14T18:46:29Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;(Case study forthcoming)  &amp;lt;syntaxhighlight lang=nasm&amp;gt; ; *         **  %%% ### 4is256 ; * %  @@@@  ** %   #   a 256-byte brick game ; **%%      #    ==  @@ by Rrrola ;   %  ===...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;(Case study forthcoming)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=nasm&amp;gt;&lt;br /&gt;
; *         **  %%% ### 4is256&lt;br /&gt;
; * %  @@@@  ** %   #   a 256-byte brick game&lt;br /&gt;
; **%%      #    ==  @@ by Rrrola&lt;br /&gt;
;   %  ==== ### ==   @@ &amp;lt;rrrola@gmail.com&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; STORY&lt;br /&gt;
;  confused bricks fall down the pit of sorrow&lt;br /&gt;
;  show them the rightful way of flawless rows&lt;br /&gt;
;  make them complete&lt;br /&gt;
;  make them disappear in joy&lt;br /&gt;
;  and get awarded for their redemption&lt;br /&gt;
&lt;br /&gt;
; CONTROLS AND SHIFTS&lt;br /&gt;
;  left shift ......... move left&lt;br /&gt;
;  right shift ....... move right&lt;br /&gt;
;  ctrl .............. rotate ccw&lt;br /&gt;
;  alt .............. fall faster&lt;br /&gt;
&lt;br /&gt;
; SCORING&lt;br /&gt;
;  fast falling ........... 1/row&lt;br /&gt;
;  deleted rows ... 32/96/160/224&lt;br /&gt;
;  don't delete too fast ... -256 (punishment for the greedy ;-))&lt;br /&gt;
&lt;br /&gt;
; LEVEL (FALLING SPEED)&lt;br /&gt;
;  increases every (1&amp;lt;&amp;lt;level) deletions&lt;br /&gt;
&lt;br /&gt;
; note: needs vertical retrace for timing (fullscreen or pure DOS)&lt;br /&gt;
; greets to everyone who JUST WOULDN'T GET THE STRAIGHT ONE OMGWTF&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
HEIGHT     equ 24  ; must be a multiple of 4&lt;br /&gt;
WIDTH      equ 10  ; 4..23&lt;br /&gt;
PIT_CHAR   equ 'º'&lt;br /&gt;
BRICK_CHAR equ 'Û'&lt;br /&gt;
&lt;br /&gt;
org 100h   ; assume ax=0 bl=0 sp=0FFFEh&lt;br /&gt;
&lt;br /&gt;
inc  ax&lt;br /&gt;
int  10h&lt;br /&gt;
mov  ah,5  ; textmode 40x25, page 1 (offset 800h)&lt;br /&gt;
int  10h   ; filled with gray spaces on black (0720h)&lt;br /&gt;
push word 0B800h&lt;br /&gt;
pop  es&lt;br /&gt;
push es&lt;br /&gt;
pop  ds&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Draw the pit and erase complete rows&lt;br /&gt;
&lt;br /&gt;
P:&lt;br /&gt;
mov  di,2178+(HEIGHT-1)*80&lt;br /&gt;
mov  si,di ;-) si = source row, di = destination row&lt;br /&gt;
mov  cx,HEIGHT+4&lt;br /&gt;
E:&lt;br /&gt;
sub  di,byte 80&lt;br /&gt;
N:&lt;br /&gt;
add  bl,64 ; score += {0,64,128,192}[erased rows mod 4]&lt;br /&gt;
sub  si,byte 80+WIDTH*2&lt;br /&gt;
&lt;br /&gt;
mov  ax,800h+PIT_CHAR&lt;br /&gt;
stosw&lt;br /&gt;
sub  di,byte WIDTH*2+4&lt;br /&gt;
stosw&lt;br /&gt;
&lt;br /&gt;
mov  dx,WIDTH&lt;br /&gt;
A:&lt;br /&gt;
or   [di+(HEIGHT+4)*80+1],ah&lt;br /&gt;
and  al,[si+1]&lt;br /&gt;
movsw      ; white score at the bottom of the pit, shift rows&lt;br /&gt;
dec  dx&lt;br /&gt;
jnz  A&lt;br /&gt;
&lt;br /&gt;
and  al,8  ; brightness all the way?&lt;br /&gt;
jnz  N&lt;br /&gt;
loop E&lt;br /&gt;
&lt;br /&gt;
cmp  si,di ; if any rows were deleted, adjust score to +32/96/160/224&lt;br /&gt;
je   G&lt;br /&gt;
sub  bl,32&lt;br /&gt;
dec  sp    ; sp = 0FFFEh-total deletions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Generate a new brick&lt;br /&gt;
&lt;br /&gt;
G:         ; di=6F2h cx=0&lt;br /&gt;
in   al,40h; could be &amp;quot;rdtsc&amp;quot; for hardcore randomness&lt;br /&gt;
mov  ah,5Ah&lt;br /&gt;
mul  di    ; dx:ax=2711400h..277FF0Eh&lt;br /&gt;
mov  bp,dx&lt;br /&gt;
mov  cl,[byte bp-271h+S]&lt;br /&gt;
mov  di,800h-160+48-(WIDTH|1)&lt;br /&gt;
mov  si,es ;-) the highest bits of si need to be &amp;quot;10&amp;quot;&lt;br /&gt;
&lt;br /&gt;
; bp = brick index + 271h&lt;br /&gt;
; cx = rotated brick layout (4 bits per row)&lt;br /&gt;
; di = brick position&lt;br /&gt;
; most significant zero bit in sp = number of frames before dropping&lt;br /&gt;
; (si is used for checking that)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Increase the displayed score by 1&lt;br /&gt;
&lt;br /&gt;
M:&lt;br /&gt;
or   bl,bl&lt;br /&gt;
jz   V&lt;br /&gt;
push di    ; di = behind the last zero&lt;br /&gt;
mov  di,800h+HEIGHT*80+50&lt;br /&gt;
dec  bx&lt;br /&gt;
D:&lt;br /&gt;
dec  di    ; next digit&lt;br /&gt;
dec  di&lt;br /&gt;
mov  al,'0'; assume overflow&lt;br /&gt;
xchg al,[di]&lt;br /&gt;
or   al,10h&lt;br /&gt;
cmp  al,'9'&lt;br /&gt;
je   D&lt;br /&gt;
inc  ax&lt;br /&gt;
stosb      ; if the digit wasn't '9', raise it&lt;br /&gt;
pop  di&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Wait for vertical retrace start (70/sec) and erase the brick&lt;br /&gt;
&lt;br /&gt;
V:&lt;br /&gt;
mov  dx,3DAh&lt;br /&gt;
in   al,dx&lt;br /&gt;
and  al,8&lt;br /&gt;
jz   V&lt;br /&gt;
W:&lt;br /&gt;
in   al,dx&lt;br /&gt;
and  al,8&lt;br /&gt;
jnz  W     ; al=0&lt;br /&gt;
call B     ; if not erasable (= has no space to appear), GAME OVER&lt;br /&gt;
jnc  near 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Keyboard handler&lt;br /&gt;
&lt;br /&gt;
mov  ah,2&lt;br /&gt;
int  16h&lt;br /&gt;
and  bh,al ; bh = previous shift state&lt;br /&gt;
xchg al,bh&lt;br /&gt;
not  bh    ; if a shift was just pressed, set a bit in al&lt;br /&gt;
&lt;br /&gt;
pusha&lt;br /&gt;
&lt;br /&gt;
shr  al,1  ; RSHIFT: X++&lt;br /&gt;
jnc  X&lt;br /&gt;
scasw      ; di+=2&lt;br /&gt;
X:&lt;br /&gt;
&lt;br /&gt;
shr  al,1  ; LSHIFT: X--&lt;br /&gt;
jnc  Y&lt;br /&gt;
dec  di&lt;br /&gt;
dec  di&lt;br /&gt;
Y:&lt;br /&gt;
&lt;br /&gt;
shl  ax,15&lt;br /&gt;
&lt;br /&gt;
jnc  F     ; ALT: Y++, score++&lt;br /&gt;
inc  bx&lt;br /&gt;
mov  bh,8  ; can be held until landing&lt;br /&gt;
H:&lt;br /&gt;
mov  si,sp&lt;br /&gt;
add  si,byte 16&lt;br /&gt;
add  di,byte 80&lt;br /&gt;
F:&lt;br /&gt;
&lt;br /&gt;
jns  C     ; CTRL: rotation&lt;br /&gt;
R:         ; ax=8000h, CF=0&lt;br /&gt;
rcl  cx,13 ; ax = cx rotated 90 degress ccw around [1;1]&lt;br /&gt;
rcr  ax,1&lt;br /&gt;
jnc  R&lt;br /&gt;
cmp  ah,[byte bp-271h+S]&lt;br /&gt;
je   I     ; if we reach the original shape, reload (for O,S,Z)&lt;br /&gt;
ror  ax,12&lt;br /&gt;
I:&lt;br /&gt;
xchg ah,al&lt;br /&gt;
xchg ax,cx&lt;br /&gt;
C:         ; al=0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Test whether changes were OK, drop if it's time&lt;br /&gt;
&lt;br /&gt;
call B&lt;br /&gt;
jnc  Q&lt;br /&gt;
add  sp,byte 16&lt;br /&gt;
pusha&lt;br /&gt;
Q:&lt;br /&gt;
popa       ; use [bp-7*16] for black background instead of gray&lt;br /&gt;
lea  ax,[bp+0]&lt;br /&gt;
rol  si,1  ; OF = (CF!=sign(si))&lt;br /&gt;
jnc  L     ; you can't land with alt only (less mistakes)&lt;br /&gt;
&lt;br /&gt;
push word M&lt;br /&gt;
jno  B     ; doesn't have to fall: draw the brick&lt;br /&gt;
&lt;br /&gt;
pop  ax    ; has to fall: clean the stack&lt;br /&gt;
xor  ax,ax&lt;br /&gt;
pusha&lt;br /&gt;
jmp  short H&lt;br /&gt;
&lt;br /&gt;
L:&lt;br /&gt;
or   al,8  ; draw the fallen brick bright and generate next brick&lt;br /&gt;
push word P&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; Brick drawing (al=color cx=shape di=address)&lt;br /&gt;
&lt;br /&gt;
B:&lt;br /&gt;
push bx&lt;br /&gt;
xor  bx,bx&lt;br /&gt;
T:&lt;br /&gt;
ror  cx,1&lt;br /&gt;
jnc  skip  ; brightness prevents drawing&lt;br /&gt;
test byte[bx+di],8 ; CF=0&lt;br /&gt;
jnz  O&lt;br /&gt;
mov  [bx+di],al&lt;br /&gt;
mov  byte[bx+di-1],BRICK_CHAR&lt;br /&gt;
skip:&lt;br /&gt;
inc  bx&lt;br /&gt;
inc  bx    ; bl:00 02 04 06  08&lt;br /&gt;
test bl,8  ;    50 52 54 56  58&lt;br /&gt;
jz   T     ;    A0 A2 A4 A6  A8&lt;br /&gt;
add  bl,72 ;    F0 F2 F4 F6  F8 40+CF&lt;br /&gt;
jnc  T&lt;br /&gt;
O:&lt;br /&gt;
pop  bx    ; if the brick could be drawn, CF=1&lt;br /&gt;
ret&lt;br /&gt;
&lt;br /&gt;
    ; .... ##.. ..#. #... .##. .#.. ##..&lt;br /&gt;
    ; #### .##. ###. ###. ##.. ###. ##..&lt;br /&gt;
S: db 0F0h, 63h, 74h, 71h, 36h, 72h, 33h&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Trixter</name></author>	</entry>

	</feed>