summaryrefslogtreecommitdiff
path: root/data/simulating_real_programs/listing_0054_draw_rectangle.asm
blob: 3274b8b80cae2d62ccea6d7359b50d0189d37717 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
; ========================================================================
;
; (C) Copyright 2023 by Molly Rocket, Inc., All Rights Reserved.
;
; This software is provided 'as-is', without any express or implied
; warranty. In no event will the authors be held liable for any damages
; arising from the use of this software.
;
; Please see https://computerenhance.com for further information
;
; ========================================================================

; ========================================================================
; LISTING 54
; ========================================================================

bits 16

; Start image after one row, to avoid overwriting our code!
mov bp, 64*4

mov dx, 0
y_loop_start:
	
	mov cx, 0
	x_loop_start:
		; Fill pixel
		mov word [bp + 0], cx ; Red
		mov word [bp + 2], dx ; Blue
		mov byte [bp + 3], 255 ; Alpha
			
		; Advance pixel location
		add bp, 4
			
		; Advance X coordinate and loop
		add cx, 1
		cmp cx, 64
		jnz x_loop_start
	
	; Advance Y coordinate and loop
	add dx, 1
	cmp dx, 64
	jnz y_loop_start