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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
|
org 0x100 ; .com files always start 256 bytes into the segment
VIDEO_SEGMENT equ 0xa000
PAGE0_OFFSET equ 0x0000
SC_INDEX equ 0x03c4
GC_INDEX equ 0x03ce
SET_RESET equ 0x00
ENABLE_SET_RESET equ 0x01
SCREEN_HEIGHT_IN_LINES equ 200
SCREEN_WIDTH_IN_BYTES equ 40
JOE_WIDTH_IN_BYTES equ 5
JOE_WIDTH_IN_BITS equ 40
JOE_HEIGHT_IN_LINES equ 17
JOE_X_START_BYTE equ 20
JOE_Y_START_LINE equ 100
JOE_STARTING_BYTE equ 4020
section .data
;------------bleu--vert---rouge--brillant-------------
;couleur 1: 1 0 0 1
;couleur 2: 1 1 0 1
;couleur 3: 1 0 1 1
;couleur 4: 0 1 0 1
;couleur 5: 0 1 1 1
;couleur 6: 1 1 1 0
;couleur 7: 1 0 0 0
;couleur 8: 1 1 0 0
;couleur 9: 1 0 1 0
joe_plan_bleu db 0x00,0x00,0x01,0x00,0x00 ;couleurs concernées : 1 2 3 6 7 8 9
db 0x00,0x10,0x07,0x00,0x00
db 0x00,0x0e,0x5e,0x00,0x00
db 0x00,0x0f,0xfc,0x00,0x00
db 0x00,0x07,0xf8,0x00,0x00
db 0x00,0x03,0xf8,0x00,0x00
db 0x3c,0x01,0xf8,0x00,0x00
db 0x3e,0x01,0x08,0x00,0x00
db 0x3f,0x02,0x08,0x00,0x00
db 0x3f,0x01,0x18,0x00,0x00
db 0x3f,0x01,0x10,0x00,0x00
db 0x1f,0x01,0x10,0x00,0x00
db 0x1c,0x01,0xe1,0x80,0x00
db 0x00,0x00,0xe1,0xc0,0x00
db 0x00,0x01,0xe1,0xe0,0x00
db 0x00,0x02,0xf7,0xf0,0x00
db 0x00,0x07,0xff,0xf0,0x00
joe_plan_vert db 0x00,0x00,0x00,0x00,0x00 ;couleurs concernées : 2 4 5 6 8
db 0x00,0x00,0x00,0x00,0x00
db 0x00,0x00,0x00,0x00,0x00
db 0x00,0x00,0x00,0x00,0x00
db 0x00,0x00,0x00,0x00,0x00
db 0x00,0x00,0x00,0x00,0x00
db 0x00,0x00,0x00,0x00,0x00
db 0x18,0x01,0x00,0x00,0x00
db 0x1c,0x00,0x00,0x00,0x00
db 0x1c,0x00,0x00,0x00,0x00
db 0x0c,0x00,0x00,0x00,0x00
db 0x00,0x00,0x00,0x00,0x00
db 0x03,0x00,0x00,0x00,0x00
db 0x01,0x80,0x00,0x00,0x00
db 0xc0,0x20,0x00,0x00,0x00
db 0x60,0x30,0x00,0x00,0x00
db 0x30,0x88,0x00,0x00,0x00
joe_plan_rouge db 0x00,0x00,0x00,0x00,0x00 ;couleurs concernées : 3 5 6 9
db 0x00,0x00,0x00,0x00,0x00
db 0x00,0x00,0x00,0x00,0x00
db 0x00,0x00,0x00,0x00,0x00
db 0x00,0x00,0x00,0x00,0x00
db 0x00,0x00,0x00,0x00,0x00
db 0x00,0x00,0x00,0x00,0x00
db 0x18,0x00,0x00,0x00,0x00
db 0x1c,0x00,0x00,0x00,0x00
db 0x1c,0x00,0x00,0x00,0x00
db 0x0c,0x01,0x00,0x00,0x00
db 0x00,0x00,0x00,0x00,0x00
db 0x00,0x00,0x00,0x80,0x00
db 0x00,0x00,0x00,0xc0,0x00
db 0x00,0x00,0x01,0xe0,0x00
db 0x00,0x00,0x01,0xf0,0x00
db 0x00,0x00,0x07,0xf0,0x00
joe_plan_brillant db 0x00,0x00,0x01,0x00,0x00 ;couleurs concernées : 1 2 3 4 5
db 0x00,0x10,0x07,0x00,0x00
db 0x00,0x0e,0x5e,0x00,0x00
db 0x00,0x0f,0xfc,0x00,0x00
db 0x00,0x07,0xf8,0x00,0x00
db 0x00,0x03,0xf8,0x00,0x00
db 0x3c,0x01,0xf8,0x00,0x00
db 0x26,0x01,0x08,0x00,0x00
db 0x23,0x02,0x08,0x00,0x00
db 0x23,0x01,0x18,0x00,0x00
db 0x3f,0x01,0x10,0x00,0x00
db 0x1f,0x01,0x10,0x00,0x00
db 0x1f,0x01,0xe0,0x00,0x00
db 0x01,0x80,0xe0,0x00,0x00
db 0x00,0xc0,0x00,0x00,0x00
db 0x00,0x60,0x06,0x00,0x00
db 0x00,0x30,0x10,0x00,0x00
section .bss
section .text
start:
mov ax, 0x000d
int 0x10 ; dos :set video mode (320x200 16 couleurs)
mov ax, VIDEO_SEGMENT
mov es, ax
cld
mov dx, SC_INDEX
mov ax, 0x0102
out dx, ax ; map mask register = 0001 : écriture plan bleu
mov si, joe_plan_bleu
call drawJOE
mov ax, 0x0402
out dx, ax ; map mask register = 0100 : écriture plan vert
mov si, joe_plan_vert
call drawJOE
mov ax, 0x0202
out dx, ax ; map mask register = 0010 : écriture plan rouge
mov si, joe_plan_rouge
call drawJOE
mov ax, 0x0802
out dx, ax ; map mask register = 1000 : écriture plan brillant
mov si, joe_plan_brillant
call drawJOE
fin:
mov ax, 0x0c00
int 0x21 ; flush buffer; doesn't read standard input (al=0)
mov ah, 0x00
int 0x16 ; BIOS : wait for keyboard input
mov ax, 0x0003
int 0x10 ; BIOS :set video mode (TEXT 80x25)
quit:
mov ah, 0x4c ; "terminate program" sub-function
int 0x21 ; call dos services
;-------------------------------------------------------------------------
drawJOE:
mov di, JOE_STARTING_BYTE
mov cl, JOE_HEIGHT_IN_LINES
drawLoop:
times JOE_WIDTH_IN_BYTES movsb
add di, SCREEN_WIDTH_IN_BYTES-1
dec cl
jnz drawLoop
ret |
Partager