#display_library: term
romimage: file=/usr/local/Cellar/bochs/2.6.2/share/bochs/BIOS-bochs-latest
megs: 32
-vgaromimage: file=/usr/local/Cellar/bochs/2.6.2/share/bochs/VGABIOS-elpin-2.40
+vgaromimage: file=/usr/local/Cellar/bochs/2.6.2/share/bochs/VGABIOS-lgpl-latest
floppya: 1_44=../bos.img, status=inserted
boot: a
floppy_bootsig_check: disabled=0
; ;\r
;------------------------------------------------------;\r
floppy_irq:\r
- push ds\r
- push eax\r
- push ebx\r
+ push ds\r
+ push eax\r
+ push ebx\r
\r
- mov ax, 0x10\r
- mov ds, ax\r
+ mov ax, 0x10\r
+ mov ds, ax\r
\r
- mov [fdd_int_done], 1\r
- mov al, 0x20\r
- out 0x20, al\r
+ mov [fdd_int_done], 1\r
+ mov al, 0x20\r
+ out 0x20, al\r
\r
- pop ebx\r
- pop eax\r
- pop ds\r
- iret\r
+ pop ebx\r
+ pop eax\r
+ pop ds\r
+ iret\r
\r
\r
\r
; out: nothing ;\r
;------------------------------------------------------;\r
fdd_off:\r
- cmp [fdd_motor_on], 0\r
- je .end\r
- push eax\r
- push edx\r
-\r
- mov dx, 0x3F2\r
- mov al, 0x0c ; motor off\r
- out dx, al\r
- mov [fdd_motor_on], 0\r
-\r
- pop edx\r
- pop eax\r
+ cmp [fdd_motor_on], 0\r
+ je .end\r
+ push eax\r
+ push edx\r
+\r
+ mov dx, 0x3F2\r
+ mov al, 0x0c ; motor off\r
+ out dx, al\r
+ mov [fdd_motor_on], 0\r
+\r
+ pop edx\r
+ pop eax\r
.end:\r
ret\r
\r
; out: nothing ;\r
;------------------------------------------------------;\r
fdd_on:\r
- cmp [fdd_motor_on], 1\r
- je .end\r
- push eax\r
- push edx\r
+ cmp [fdd_motor_on], 1\r
+ je .end\r
+ push eax\r
+ push edx\r
\r
- mov dx, 0x3F2 ; motor 0 on..\r
- mov al, 0x1C\r
- out dx, al\r
+ mov dx, 0x3F2 ; motor 0 on..\r
+ mov al, 0x1C\r
+ out dx, al\r
\r
- mov ecx, 20 ; 1/5 of a sec. to speed up\r
- call delay ; in timer.inc\r
- mov [fdd_motor_on], 1\r
+ mov ecx, 20 ; 1/5 of a sec. to speed up\r
+ call delay ; in timer.inc\r
+ mov [fdd_motor_on], 1\r
\r
- pop edx\r
- pop eax\r
+ pop edx\r
+ pop eax\r
.end:\r
ret\r
\r
; in: al = data byte ;\r
;------------------------------------------------------;\r
fdc_sendbyte:\r
- push edx\r
- push ecx\r
- push eax\r
+ push edx\r
+ push ecx\r
+ push eax\r
\r
- mov ecx, 50 ; 50 = 0.5 seconds.\r
- call active_delay ; timer.inc\r
+ mov ecx, 50 ; 50 = 0.5 seconds.\r
+ call active_delay ; timer.inc\r
.l1:\r
- cmp dword [ecx], 0 ; timeup?\r
- je .error\r
- mov dx, 0x3f4 ; check status reg\r
- in al, dx\r
- and al, 0xC0\r
- cmp al, 0x80 ; ok to write?\r
- jnz .l1\r
-\r
- pop eax\r
- pop ecx\r
- mov dx, 0x3F5 ; send byte\r
- out dx, al\r
- pop edx\r
- clc\r
- ret\r
+ cmp dword [ecx], 0 ; timeup?\r
+ je .error\r
+ mov dx, 0x3f4 ; check status reg\r
+ in al, dx\r
+ and al, 0xC0\r
+ cmp al, 0x80 ; ok to write?\r
+ jnz .l1\r
+\r
+ pop eax\r
+ pop ecx\r
+ mov dx, 0x3F5 ; send byte\r
+ out dx, al\r
+ pop edx\r
+ clc\r
+ ret\r
.error:\r
- pop eax\r
- pop ecx\r
- pop edx\r
- stc\r
- ret\r
+ pop eax\r
+ pop ecx\r
+ pop edx\r
+ stc\r
+ ret\r
\r
\r
\r
; out: al = data byte ;\r
;------------------------------------------------------;\r
fdc_getbyte:\r
- push edx\r
- push ecx\r
- push eax\r
+ push edx\r
+ push ecx\r
+ push eax\r
\r
- mov ecx, 50 ; 50 = 0.5 seconds.\r
- call active_delay ; timer.inc\r
+ mov ecx, 50 ; 50 = 0.5 seconds.\r
+ call active_delay ; timer.inc\r
.l1:\r
- cmp dword [ecx], 0 ; timeup?\r
- je .error\r
- mov dx, 0x3f4 ; check status reg\r
- in al, dx\r
- and al, 0xD0\r
- cmp al, 0xD0 ; ok to read?\r
- jnz .l1\r
-\r
- pop eax\r
- pop ecx\r
- mov dx, 0x3F5 ; get the byte\r
- in al, dx\r
- pop edx\r
- clc\r
- ret\r
+ cmp dword [ecx], 0 ; timeup?\r
+ je .error\r
+ mov dx, 0x3f4 ; check status reg\r
+ in al, dx\r
+ and al, 0xD0\r
+ cmp al, 0xD0 ; ok to read?\r
+ jnz .l1\r
+\r
+ pop eax\r
+ pop ecx\r
+ mov dx, 0x3F5 ; get the byte\r
+ in al, dx\r
+ pop edx\r
+ clc\r
+ ret\r
.error:\r
- pop eax\r
- pop ecx\r
- pop edx\r
- stc\r
- ret\r
+ pop eax\r
+ pop ecx\r
+ pop edx\r
+ stc\r
+ ret\r
\r
\r
\r
; ;\r
;------------------------------------------------------;\r
sensei:\r
- push eax\r
-\r
- mov al, 0x08 ; fdc command\r
- call fdc_sendbyte\r
- call fdc_getbyte\r
- mov ah, al ; save ST0 in ah\r
- call fdc_getbyte ; read PCN\r
- clc\r
- test ah, 0x80 ; test for error:\r
- jz .end ; "invalid command"\r
- stc\r
+ push eax\r
+\r
+ mov al, 0x08 ; fdc command\r
+ call fdc_sendbyte\r
+ call fdc_getbyte\r
+ mov ah, al ; save ST0 in ah\r
+ call fdc_getbyte ; read PCN\r
+ clc\r
+ test ah, 0x80 ; test for error:\r
+ jz .end ; "invalid command"\r
+ stc\r
.end:\r
- pop eax\r
- ret\r
+ pop eax\r
+ ret\r
\r
\r
\r
; ;\r
;------------------------------------------------------;\r
fdd_reset:\r
- push eax\r
- push ecx\r
- push edx\r
+ push eax\r
+ push ecx\r
+ push edx\r
\r
- mov byte [fdd_motor_on], 0\r
+ mov byte [fdd_motor_on], 0\r
\r
- mov dx, 0x3f2\r
- mov al, 8 ; off with all motors,\r
- out dx, al ; dma,irq etc..\r
+ mov dx, 0x3f2\r
+ mov al, 8 ; off with all motors,\r
+ out dx, al ; dma,irq etc..\r
\r
- mov ecx, 5\r
- call delay ; in timer.inc\r
+ mov ecx, 5\r
+ call delay ; in timer.inc\r
\r
- mov dx, 0x3f7\r
- mov al, 0\r
- out dx, al ; work at 500 kbit/s\r
+ mov dx, 0x3f7\r
+ mov al, 0\r
+ out dx, al ; work at 500 kbit/s\r
\r
- mov dx, 0x3f2\r
- mov al, 0x0c\r
- out dx, al ; reenable interrupts\r
+ mov dx, 0x3f2\r
+ mov al, 0x0c\r
+ out dx, al ; reenable interrupts\r
\r
- mov [fdd_int_done], 0\r
- call wait_int ; wait for floppy int.\r
- jc .error ; timeout?\r
+ mov [fdd_int_done], 0\r
+ call wait_int ; wait for floppy int.\r
+ jc .error ; timeout?\r
\r
- mov cx, 0x04\r
+ mov cx, 0x04\r
.status: ; 4 dummy-reads.\r
- call sensei\r
- loop .status\r
-\r
- mov al, 0x03 ; specify command\r
- call fdc_sendbyte\r
- mov al, 0xDF ; SRT, HUT\r
- call fdc_sendbyte\r
- mov al, 0x02 ; HLT, ND\r
- call fdc_sendbyte\r
-\r
- mov al, 1\r
- call fdd_recal_seek\r
- jc .error\r
- call fdd_off\r
- clc\r
- jmp .end\r
+ call sensei\r
+ loop .status\r
+\r
+ mov al, 0x03 ; specify command\r
+ call fdc_sendbyte\r
+ mov al, 0xDF ; SRT, HUT\r
+ call fdc_sendbyte\r
+ mov al, 0x02 ; HLT, ND\r
+ call fdc_sendbyte\r
+\r
+ mov al, 1\r
+ call fdd_recal_seek\r
+ jc .error\r
+ call fdd_off\r
+ clc\r
+ jmp .end\r
.error:\r
- call fdd_off\r
- stc\r
+ call fdd_off\r
+ stc\r
.end:\r
- pop edx\r
- pop ecx\r
- pop eax\r
- ret\r
+ pop edx\r
+ pop ecx\r
+ pop eax\r
+ ret\r
\r
\r
\r
; ;\r
;------------------------------------------------------;\r
fdd_recal_seek:\r
- push eax\r
-\r
- call fdd_on ; turn motor on\r
- cmp al, 0\r
- jne .recalibrate\r
- clc\r
- cmp bl, [result_C] ; are we there yet? :D\r
- je .ok\r
- mov al, 0x0F ; seek command\r
- call fdc_sendbyte\r
- mov al, bh ; ((head*4)|drive)\r
- call fdc_sendbyte\r
- mov al, bl ; track\r
- call fdc_sendbyte\r
- mov [result_C], bl ; now on..?\r
- jmp .get_int\r
+ push eax\r
+\r
+ call fdd_on ; turn motor on\r
+ cmp al, 0\r
+ jne .recalibrate\r
+ clc\r
+ cmp bl, [result_C] ; are we there yet? :D\r
+ je .ok\r
+ mov al, 0x0F ; seek command\r
+ call fdc_sendbyte\r
+ mov al, bh ; ((head*4)|drive)\r
+ call fdc_sendbyte\r
+ mov al, bl ; track\r
+ call fdc_sendbyte\r
+ mov [result_C], bl ; now on..?\r
+ jmp .get_int\r
.recalibrate:\r
- mov al, 0x07 ; recalibrate command\r
- call fdc_sendbyte\r
- mov al, 0 ; drive number\r
- call fdc_sendbyte\r
- mov [result_C], 0 ; now on track 0\r
+ mov al, 0x07 ; recalibrate command\r
+ call fdc_sendbyte\r
+ mov al, 0 ; drive number\r
+ call fdc_sendbyte\r
+ mov [result_C], 0 ; now on track 0\r
.get_int:\r
- mov [fdd_int_done], 0\r
- call wait_int\r
- jc .error\r
+ mov [fdd_int_done], 0\r
+ call wait_int\r
+ jc .error\r
\r
- call sensei ; sense interrupt status\r
- jc .error\r
+ call sensei ; sense interrupt status\r
+ jc .error\r
.ok:\r
- clc\r
- jmp .end\r
+ clc\r
+ jmp .end\r
.error:\r
stc\r
.end:\r
; cf = 0 if ok, 1 if error ;\r
;------------------------------------------------------;\r
fdd_read_write:\r
- pushad\r
-\r
- and dh, 1 ; head 0 or 1?\r
- mov [fdd_head], dh ; store it.\r
- shl dh, 2\r
- or dh, 0 ; drive 0, fd0\r
- mov [fdd_drivehead], dh ; dh = ((head*4)|drive)\r
- mov [fdd_errorcode], 0x04 ; basic error code\r
- cmp ch, 0x51 ; check for allowed\r
- jae .error ; track number.\r
- mov [fdd_track], ch\r
- cmp cl, 0x13 ; check for allowed\r
- jae .error ; sector number.\r
- mov [fdd_sector], cl\r
-\r
- cmp [fdd_error], 1\r
- jne .no_previous_error\r
- mov al, 1\r
- call fdd_recal_seek\r
+ pushad\r
+\r
+ and dh, 1 ; head 0 or 1?\r
+ mov [fdd_head], dh ; store it.\r
+ shl dh, 2\r
+ or dh, 0 ; drive 0, fd0\r
+ mov [fdd_drivehead], dh ; dh = ((head*4)|drive)\r
+ mov [fdd_errorcode], 0x04 ; basic error code\r
+ cmp ch, 0x51 ; check for allowed\r
+ jae .error ; track number.\r
+ mov [fdd_track], ch\r
+ cmp cl, 0x13 ; check for allowed\r
+ jae .error ; sector number.\r
+ mov [fdd_sector], cl\r
+\r
+ cmp [fdd_error], 1\r
+ jne .no_previous_error\r
+ mov al, 1\r
+ call fdd_recal_seek\r
.no_previous_error:\r
- call fdd_on\r
+ call fdd_on\r
\r
- mov dx, 0x3F7\r
- mov al, 0 ; 500Kb/sec mode\r
- out dx, al\r
- mov [fdd_errorcode], 0x80 ; error code\r
+ mov dx, 0x3F7\r
+ mov al, 0 ; 500Kb/sec mode\r
+ out dx, al\r
+ mov [fdd_errorcode], 0x80 ; error code\r
\r
- xor ecx, ecx\r
- mov cx, 3 ; try seek 3 times\r
+ xor ecx, ecx\r
+ mov cx, 3 ; try seek 3 times\r
.l2:\r
- mov al, 0\r
- push ebx\r
- mov bl, [fdd_track]\r
- mov bh, [fdd_drivehead] ; ((head*4)|drive)\r
- call fdd_recal_seek\r
- pop ebx\r
- jnc .l3 ; ok, continue.\r
- loop .l2\r
- jmp .error ; timeout.\r
+ mov al, 0\r
+ push ebx\r
+ mov bl, [fdd_track]\r
+ mov bh, [fdd_drivehead] ; ((head*4)|drive)\r
+ call fdd_recal_seek\r
+ pop ebx\r
+ jnc .l3 ; ok, continue.\r
+ loop .l2\r
+ jmp .error ; timeout.\r
.l3:\r
- push ebx\r
- cmp bl, 0\r
- je .read_fdd\r
+ push ebx\r
+ cmp bl, 0\r
+ je .read_fdd\r
\r
.write_fdd:\r
- push edi\r
- mov esi, edi\r
- mov edi, 0x80000 ; copy the stuff we will\r
- mov ecx, 128 ; write to the DMA buffer\r
- rep movsd ; 128*4=512\r
- pop edi\r
-\r
- mov bl, 2 ; channel 2\r
- mov esi, 512 ; bytes to write\r
- mov ecx, 0x80000 ; page & offset\r
- mov bh, 1 ; write floppy, read DMA\r
- call dma_transfer\r
-\r
- mov al, 0xC5 ; write sector command\r
- call fdc_sendbyte\r
- jmp .cont\r
+ push edi\r
+ mov esi, edi\r
+ mov edi, 0x80000 ; copy the stuff we will\r
+ mov ecx, 128 ; write to the DMA buffer\r
+ rep movsd ; 128*4=512\r
+ pop edi\r
+\r
+ mov bl, 2 ; channel 2\r
+ mov esi, 512 ; bytes to write\r
+ mov ecx, 0x80000 ; page & offset\r
+ mov bh, 1 ; write floppy, read DMA\r
+ call dma_transfer\r
+\r
+ mov al, 0xC5 ; write sector command\r
+ call fdc_sendbyte\r
+ jmp .cont\r
\r
.read_fdd:\r
- mov bl, 2 ; channel 2\r
- mov esi, 512 ; bytes to read\r
- mov ecx, 0x80000 ; page & offset\r
- mov bh, 0 ; read floppy, write DMA\r
- call dma_transfer\r
+ mov bl, 2 ; channel 2\r
+ mov esi, 512 ; bytes to read\r
+ mov ecx, 0x80000 ; page & offset\r
+ mov bh, 0 ; read floppy, write DMA\r
+ call dma_transfer\r
\r
- mov al, 0xE6 ; read sector command\r
- call fdc_sendbyte\r
+ mov al, 0xE6 ; read sector command\r
+ call fdc_sendbyte\r
\r
.cont:\r
- pop ebx\r
- mov al, [fdd_drivehead] ; ((head*4)|drive)\r
- call fdc_sendbyte\r
- mov al, [fdd_track] ; track/cylinder\r
- call fdc_sendbyte\r
-\r
- mov al, [fdd_head] ; head/side 0 or 1\r
- call fdc_sendbyte\r
- mov al, [fdd_sector] ; sector number\r
- call fdc_sendbyte\r
- mov al, 0x02 ; sector size, 512 bytes\r
- call fdc_sendbyte\r
-\r
- mov al, 0x12 ; sectors to a track\r
- call fdc_sendbyte\r
- mov al, 0x1B ; gap length\r
- call fdc_sendbyte\r
- mov al, 0xFF ; data length\r
- call fdc_sendbyte\r
-\r
- mov [fdd_int_done], 0\r
- call wait_int\r
- jc .error\r
-\r
- call fdc_getbyte\r
- mov [result_ST0], al ; ST0\r
- call fdc_getbyte\r
- mov [result_ST1], al ; ST1\r
- call fdc_getbyte\r
- mov [result_ST2], al ; ST2\r
- call fdc_getbyte\r
- mov [result_C], al ; cylinder\r
- call fdc_getbyte\r
- mov [result_H], al ; head\r
- call fdc_getbyte\r
- mov [result_R], al ; sector number.\r
- call fdc_getbyte\r
- mov [result_N], al ; sector size\r
-\r
- test [result_ST0], 0xc0 ; test if sr0 is 0xC0\r
- jnz .error\r
- cmp bl, 1 ; did we write the disk?\r
- je .ok\r
-\r
- mov ecx, 512 ; sector size in bytes\r
- mov esi, 0x80000 ; copy to dest. in edi\r
- rep movsb\r
+ pop ebx\r
+ mov al, [fdd_drivehead] ; ((head*4)|drive)\r
+ call fdc_sendbyte\r
+ mov al, [fdd_track] ; track/cylinder\r
+ call fdc_sendbyte\r
+\r
+ mov al, [fdd_head] ; head/side 0 or 1\r
+ call fdc_sendbyte\r
+ mov al, [fdd_sector] ; sector number\r
+ call fdc_sendbyte\r
+ mov al, 0x02 ; sector size, 512 bytes\r
+ call fdc_sendbyte\r
+\r
+ mov al, 0x12 ; sectors to a track\r
+ call fdc_sendbyte\r
+ mov al, 0x1B ; gap length\r
+ call fdc_sendbyte\r
+ mov al, 0xFF ; data length\r
+ call fdc_sendbyte\r
+\r
+ mov [fdd_int_done], 0\r
+ call wait_int\r
+ jc .error\r
+\r
+ call fdc_getbyte\r
+ mov [result_ST0], al ; ST0\r
+ call fdc_getbyte\r
+ mov [result_ST1], al ; ST1\r
+ call fdc_getbyte\r
+ mov [result_ST2], al ; ST2\r
+ call fdc_getbyte\r
+ mov [result_C], al ; cylinder\r
+ call fdc_getbyte\r
+ mov [result_H], al ; head\r
+ call fdc_getbyte\r
+ mov [result_R], al ; sector number.\r
+ call fdc_getbyte\r
+ mov [result_N], al ; sector size\r
+\r
+ test [result_ST0], 0xc0 ; test if sr0 is 0xC0\r
+ jnz .error\r
+ cmp bl, 1 ; did we write the disk?\r
+ je .ok\r
+\r
+ mov ecx, 512 ; sector size in bytes\r
+ mov esi, 0x80000 ; copy to dest. in edi\r
+ rep movsb\r
.ok:\r
- mov [fdd_errorcode], 0 ; no error.. :D\r
- mov [fdd_error], 0 ; no recal. next time\r
- clc\r
- jmp .end\r
+ mov [fdd_errorcode], 0 ; no error.. :D\r
+ mov [fdd_error], 0 ; no recal. next time\r
+ clc\r
+ jmp .end\r
.error:\r
- mov [fdd_error], 1 ; recalibrate next time\r
- stc\r
+ mov [fdd_error], 1 ; recalibrate next time\r
+ stc\r
.end:\r
- call fdd_off ; floppy motor off\r
- popad\r
- mov al, [fdd_errorcode] ; error status\r
- ret
\ No newline at end of file
+ call fdd_off ; floppy motor off\r
+ popad\r
+ mov al, [fdd_errorcode] ; error status\r
+ ret
\ No newline at end of file
\r
\r
rmode_int:\r
- pushad\r
- push eax\r
- shr eax, 16 ; move high bits to ax\r
- mov word [realmode_ax], ax ; save new ax value\r
- pop eax ; restore\r
-\r
- push ebx\r
- shr ebx, 16 ; move high bits to bx\r
- mov byte [int_number], bl ; save int number to call\r
- pop ebx\r
-\r
- mov byte [realmode_error], 0 ; all variables is in the\r
- mov word [realmode_bx], bx ; realmode/variables.inc file\r
- mov word [realmode_cx], cx\r
- mov word [realmode_dx], dx\r
- call disable_irqs\r
- jmp pword 0x18:do_16pmode ; must substract 0x10000 from\r
- ; data addresses becasue of\r
- ; fasm strict "org" behavior\r
+ pushad\r
+ push eax\r
+ shr eax, 16 ; move high bits to ax\r
+ mov word [realmode_ax], ax ; save new ax value\r
+ pop eax ; restore\r
+\r
+ push ebx\r
+ shr ebx, 16 ; move high bits to bx\r
+ mov byte [int_number], bl ; save int number to call\r
+ pop ebx\r
+\r
+ mov byte [realmode_error], 0 ; all variables is in the\r
+ mov word [realmode_bx], bx ; realmode/variables.inc file\r
+ mov word [realmode_cx], cx\r
+ mov word [realmode_dx], dx\r
+ call disable_irqs\r
+ jmp pword 0x18:do_16pmode ; begin our dark journey into 16bit-land\r
+\r
use16\r
do_16pmode:\r
- mov ax, 0x20\r
- mov ds, ax\r
- mov es, ax\r
- mov fs, ax\r
- mov gs, ax\r
- mov ss, ax\r
+ mov ax, 0x20\r
+ mov ds, ax\r
+ mov es, ax\r
+ mov fs, ax\r
+ mov gs, ax\r
+ mov ss, ax\r
\r
- cli\r
- mov eax, cr0\r
- and al, 0xFE\r
- mov cr0, eax\r
+ cli\r
+ mov eax, cr0\r
+ and al, 0xFE\r
+ mov cr0, eax\r
\r
- jmp 0x1000:(do_realm)\r
+ jmp 0x0000:(do_realm) ; this should be triple checked!\r
\r
do_realm:\r
- mov ax, cs\r
- mov ds, ax\r
+ mov ax, cs\r
+ mov ds, ax\r
\r
- xor ax, ax\r
- mov es, ax\r
- mov fs, ax\r
- mov gs, ax\r
- mov ss, ax\r
+ xor ax, ax\r
+ mov es, ax\r
+ mov fs, ax\r
+ mov gs, ax\r
+ mov ss, ax\r
\r
- lidt [ridtr] ; realmode/variables.inc\r
- sti\r
+ lidt [ridtr] ; realmode/variables.inc\r
+ sti\r
\r
- mov ax, word [realmode_ax]\r
- mov bx, word [realmode_bx]\r
- mov cx, word [realmode_cx]\r
- mov dx, word [realmode_dx]\r
+ mov ax, word [realmode_ax]\r
+ mov bx, word [realmode_bx]\r
+ mov cx, word [realmode_cx]\r
+ mov dx, word [realmode_dx]\r
\r
- push ax ; this is some cool shit.. ;)\r
- mov al, [int_number] ; interrupt to preform\r
- mov [$+5], al ; move it to right pos.\r
- pop ax\r
- db 0xCD ; opcode for int.\r
- db 0x00 ; move int_number here\r
+ push ax ; this is some cool shit.. ;)\r
+ mov al, [int_number] ; interrupt to preform\r
+ mov [$+5], al ; move it to right pos.\r
+ pop ax\r
+ db 0xCD ; opcode for int.\r
+ db 0x00 ; move int_number here\r
\r
- jnc .no_error\r
- mov byte [realmode_error], 1\r
+ jnc .no_error\r
+ mov byte [realmode_error], 1\r
\r
- .no_error:\r
- mov word [realmode_ax], ax\r
- mov word [realmode_bx], bx\r
- mov word [realmode_cx], cx\r
- mov word [realmode_dx], dx\r
+ .no_error:\r
+ mov word [realmode_ax], ax\r
+ mov word [realmode_bx], bx\r
+ mov word [realmode_cx], cx\r
+ mov word [realmode_dx], dx\r
\r
- cli\r
+ cli\r
\r
- lgdt [gdtr]\r
- lidt [idtr]\r
- mov eax, cr0\r
- or al, 1\r
- mov cr0, eax\r
+ lgdt [gdtr]\r
+ lidt [idtr]\r
+ mov eax, cr0\r
+ or al, 1\r
+ mov cr0, eax\r
\r
- jmp pword 0x08:gobackto_pm\r
+ jmp pword 0x08:gobackto_pm\r
\r
\r
use32\r
gobackto_pm:\r
- mov ax, 0x10 ; refresh all segment registers\r
- mov ds, ax\r
- mov es, ax\r
- mov fs, ax\r
- mov gs, ax\r
- mov ss, ax\r
- call enable_irqs\r
- sti\r
- popad\r
- clc ; clear carry.\r
- cmp [realmode_error], 1 ; if error, then\r
- jne .end\r
- stc ; set carry.\r
- .end:\r
- ret
\ No newline at end of file
+ mov ax, 0x10 ; refresh all segment registers\r
+ mov ds, ax\r
+ mov es, ax\r
+ mov fs, ax\r
+ mov gs, ax\r
+ mov ss, ax\r
+ call enable_irqs\r
+ sti\r
+ popad\r
+ clc ; clear carry.\r
+ cmp [realmode_error], 1 ; if error, then\r
+ jne .end\r
+ stc ; set carry.\r
+ .end:\r
+ ret
\ No newline at end of file
;-----------------------------------;\r
; variables containing CMOS data ;\r
;-----------------------------------;\r
- century db 0 ; latest century,\r
- year db 0 ; year,\r
- month db 0 ; month,\r
- day db 0 ; day (1 = sunday),\r
- hour db 0 ; hour,\r
- minute db 0 ; minute and\r
- second db 0 ; second read in from CMOS.\r
+ century db 0 ; latest century,\r
+ year db 0 ; year,\r
+ month db 0 ; month,\r
+ day db 0 ; day (1 = sunday),\r
+ hour db 0 ; hour,\r
+ minute db 0 ; minute and\r
+ second db 0 ; second read in from CMOS.\r
\r
\r
;-------------------------;\r
; save info from CMOS ;\r
;-------------------------;\r
get_cmos_data:\r
- push ax\r
+ push ax\r
\r
- mov al, 0x00 ; get the "second" byte\r
- out 0x70, al\r
- in al, 0x71\r
- mov [second], al ; save it.\r
+ mov al, 0x00 ; get the "second" byte\r
+ out 0x70, al\r
+ in al, 0x71\r
+ mov [second], al ; save it.\r
\r
- mov al, 0x02 ; get the "minute" byte\r
- out 0x70, al\r
- in al, 0x71\r
- mov [minute], al\r
+ mov al, 0x02 ; get the "minute" byte\r
+ out 0x70, al\r
+ in al, 0x71\r
+ mov [minute], al\r
\r
- mov al, 0x04 ; get the "hour" byte\r
- out 0x70, al\r
- in al, 0x71\r
- mov [hour], al\r
+ mov al, 0x04 ; get the "hour" byte\r
+ out 0x70, al\r
+ in al, 0x71\r
+ mov [hour], al\r
\r
- mov al, 0x07 ; get the "day" byte\r
- out 0x70, al\r
- in al, 0x71\r
- mov [day], al\r
+ mov al, 0x07 ; get the "day" byte\r
+ out 0x70, al\r
+ in al, 0x71\r
+ mov [day], al\r
\r
- mov al, 0x08 ; get the "month" byte\r
- out 0x70, al\r
- in al, 0x71\r
- mov [month], al\r
+ mov al, 0x08 ; get the "month" byte\r
+ out 0x70, al\r
+ in al, 0x71\r
+ mov [month], al\r
\r
- mov al, 0x09 ; get the "year" byte\r
- out 0x70, al\r
- in al, 0x71\r
- mov [year], al\r
+ mov al, 0x09 ; get the "year" byte\r
+ out 0x70, al\r
+ in al, 0x71\r
+ mov [year], al\r
\r
- mov al, 0x32 ; get the "century" byte\r
- out 0x70, al\r
- in al, 0x71\r
- mov [century], al\r
+ mov al, 0x32 ; get the "century" byte\r
+ out 0x70, al\r
+ in al, 0x71\r
+ mov [century], al\r
\r
- pop ax\r
- ret\r
+ pop ax\r
+ ret\r
\r
;------------------------------------------------;\r
; calculate binary from BCD ;\r
; out: al = bin ;\r
;------------------------------------------------;\r
BCD2bin:\r
- push ebx\r
- mov bl, al ; bl = al mod 16\r
- and bl, 0x0F\r
- shr al, 4 ; al = al / 16\r
- mov bh, 10\r
- mul bh ; multiply by 10\r
- add al, bl ; add in low nib\r
- pop ebx\r
- ret\r
+ push ebx\r
+ mov bl, al ; bl = al mod 16\r
+ and bl, 0x0F\r
+ shr al, 4 ; al = al / 16\r
+ mov bh, 10\r
+ mul bh ; multiply by 10\r
+ add al, bl ; add in low nib\r
+ pop ebx\r
+ ret\r
\r
\r
;------------------------------------------------;\r
; out: ax = ASCII ;\r
;------------------------------------------------;\r
BCD2ascii:\r
- push ecx\r
- mov ah, al\r
- and ax, 0xF00F ; mask bits\r
- shr ah, 4 ; right shift ah to get unpacked BCD\r
- or ax, 0x3030 ; combine with 30 to get ASCII\r
- xchg ah, al ; swap for ASCII storage convention\r
- pop ecx\r
- ret
\ No newline at end of file
+ push ecx\r
+ mov ah, al\r
+ and ax, 0xF00F ; mask bits\r
+ shr ah, 4 ; right shift ah to get unpacked BCD\r
+ or ax, 0x3030 ; combine with 30 to get ASCII\r
+ xchg ah, al ; swap for ASCII storage convention\r
+ pop ecx\r
+ ret
\ No newline at end of file
;--------------;\r
; setup IDT ;\r
;--------------;\r
- mov edi, u_isr ; isr.inc\r
+ mov esi, u_isr ; isr.inc\r
call init_idt ; idt.inc\r
mov esi, idt_list ; idt.inc\r
call set_idt_list ; idt.inc\r
\r
\r
;-------------------------------------------;\r
-; remap PICs to: cl = pic1 ch = pic2 ;\r
+; remap PICs ;\r
+; in: cl = pic1 ;\r
+; ch = pic2 ;\r
;-------------------------------------------;\r
remap_pics:\r
- push ax\r
- push dx\r
+ push ax\r
+ push dx\r
\r
- mov al, 0x11 ; IWC1\r
- out 0x20, al\r
- out 0xA0, al\r
+ mov al, 0x11 ; IWC1\r
+ out 0x20, al\r
+ out 0xA0, al\r
\r
- mov al, cl ; IWC2\r
- out 0x21, al\r
- mov al, ch\r
- out 0xA1, al\r
+ mov al, cl ; IWC2\r
+ out 0x21, al\r
+ mov al, ch\r
+ out 0xA1, al\r
\r
- mov al, 0x04 ; IWC3\r
- out 0x21, al\r
- mov al, 0x02\r
- out 0xA1, al\r
+ mov al, 0x04 ; IWC3\r
+ out 0x21, al\r
+ mov al, 0x02\r
+ out 0xA1, al\r
\r
- mov al, 0x01 ; IWC4\r
- out 0x21, al\r
- out 0xA1, al\r
+ mov al, 0x01 ; IWC4\r
+ out 0x21, al\r
+ out 0xA1, al\r
\r
- pop dx\r
- pop ax\r
- ret\r
+ pop dx\r
+ pop ax\r
+ ret\r
\r
\r
;----------------------;\r
; disable all IRQs. ;\r
;----------------------;\r
disable_irqs:\r
- push ax\r
+ push ax\r
\r
- mov al, 0xFF\r
- out 0x21, al\r
- out 0xA1, al\r
+ mov al, 0xFF\r
+ out 0x21, al\r
+ out 0xA1, al\r
\r
- pop ax\r
- ret\r
+ pop ax\r
+ ret\r
\r
\r
;---------------------;\r
; enable all IRQs. ;\r
;---------------------;\r
enable_irqs:\r
- push ax\r
+ push ax\r
\r
- mov al, 0x00\r
- out 0x21, al\r
- out 0xA1, al\r
+ mov al, 0x00\r
+ out 0x21, al\r
+ out 0xA1, al\r
\r
- pop ax\r
- ret\r
+ pop ax\r
+ ret\r
\r
\r
;-----------------------------;\r
; enable an IRQ. cl = irq ;\r
;-----------------------------;\r
enable_irq:\r
- push ax\r
- push cx\r
+ push ax\r
+ push cx\r
\r
- cmp cl, 8\r
- jb .master\r
+ cmp cl, 8\r
+ jb .master\r
\r
- sub cl, 8\r
- mov ah, 1\r
- shl ah, cl\r
- xor ah, 0xFF\r
+ sub cl, 8\r
+ mov ah, 1\r
+ shl ah, cl\r
+ xor ah, 0xFF\r
\r
- in al, 0xA1\r
- and al, ah\r
- out 0xA1, al\r
+ in al, 0xA1\r
+ and al, ah\r
+ out 0xA1, al\r
\r
- pop cx\r
- pop ax\r
- ret\r
- .master:\r
- mov ah, 1\r
- shl ah, cl\r
- xor ah, 0xFF\r
+ pop cx\r
+ pop ax\r
+ ret\r
+ .master:\r
+ mov ah, 1\r
+ shl ah, cl\r
+ xor ah, 0xFF\r
\r
- in al, 0x21\r
- and al, ah\r
- out 0x21, al\r
+ in al, 0x21\r
+ and al, ah\r
+ out 0x21, al\r
\r
- pop cx\r
- pop ax\r
- ret\r
+ pop cx\r
+ pop ax\r
+ ret\r
\r
\r
;------------------------------;\r
-; disable an IRQ. cl = irq ;\r
+; disable an IRQ. ;\r
+; in: cl = irq ;\r
;------------------------------;\r
disable_irq:\r
- push ax\r
- push cx\r
-\r
- cmp cl, 8\r
- jb .master\r
-\r
- sub cl, 8\r
- mov ah, 1\r
- shl ah, cl\r
-\r
- in al, 0xA1\r
- or al, ah\r
- out 0xA1, al\r
-\r
- pop cx\r
- pop ax\r
- ret\r
- .master:\r
- mov ah, 1\r
- shl ah, cl\r
-\r
- in al, 0x21\r
- or al, ah\r
- out 0x21, al\r
-\r
- pop cx\r
- pop ax\r
- ret
\ No newline at end of file
+ push ax\r
+ push cx\r
+\r
+ cmp cl, 8\r
+ jb .master\r
+\r
+ sub cl, 8\r
+ mov ah, 1\r
+ shl ah, cl\r
+\r
+ in al, 0xA1\r
+ or al, ah\r
+ out 0xA1, al\r
+\r
+ pop cx\r
+ pop ax\r
+ ret\r
+ .master:\r
+ mov ah, 1\r
+ shl ah, cl\r
+\r
+ in al, 0x21\r
+ or al, ah\r
+ out 0x21, al\r
+\r
+ pop cx\r
+ pop ax\r
+ ret
\ No newline at end of file
;-----------------;\r
; variables ;\r
;-----------------;\r
- timer_wait dd 0 ; time to wait\r
- timer_counter dd 0, 0 ; time since BOS started\r
- call_list dd 0, 0, 0, 0, 0 ; functions to call\r
+ timer_wait dd 0 ; time to wait\r
+ timer_counter dd 0, 0 ; time since BOS started\r
+ call_list dd 0, 0, 0, 0, 0 ; functions to call\r
\r
\r
;---------------------------;\r
; Timer IRQ(0) ;\r
;---------------------------;\r
timer:\r
- add dword [timer_counter], 1 ; it's just a 64-bit\r
- adc dword [timer_counter+4], 0 ; counter since boot.\r
-\r
- cmp [timer_wait], 0 ; "delay" countdown.\r
- je .test1\r
- dec [timer_wait]\r
-\r
- .test1: ; checks for calls to\r
- cmp [call_list], dword 0 ; do before we quit.\r
- je .test2\r
- call dword [call_list]\r
- .test2:\r
- cmp [call_list+4], dword 0\r
- je .test3\r
- call dword [call_list+4]\r
- .test3:\r
- cmp [call_list+8], dword 0\r
- je .test4\r
- call dword [call_list+8]\r
- .test4:\r
- cmp [call_list+12], dword 0\r
- je .test5\r
- call dword [call_list+12]\r
- .test5:\r
- cmp [call_list+16], dword 0\r
- je .end\r
- call dword [call_list+16]\r
-\r
- .end:\r
- mov al, 0x20\r
- out 0x20, al\r
- ret\r
+ add dword [timer_counter], 1 ; it's just a 64-bit\r
+ adc dword [timer_counter+4], 0 ; counter since boot.\r
+\r
+ cmp [timer_wait], 0 ; "delay" countdown.\r
+ je .test1\r
+ dec [timer_wait]\r
+\r
+ .test1: ; checks for calls to\r
+ cmp [call_list], dword 0 ; do before we quit.\r
+ je .test2\r
+ call dword [call_list]\r
+ .test2:\r
+ cmp [call_list+4], dword 0\r
+ je .test3\r
+ call dword [call_list+4]\r
+ .test3:\r
+ cmp [call_list+8], dword 0\r
+ je .test4\r
+ call dword [call_list+8]\r
+ .test4:\r
+ cmp [call_list+12], dword 0\r
+ je .test5\r
+ call dword [call_list+12]\r
+ .test5:\r
+ cmp [call_list+16], dword 0\r
+ je .end\r
+ call dword [call_list+16]\r
+\r
+ .end:\r
+ mov al, 0x20\r
+ out 0x20, al\r
+ ret\r
\r
\r
\r
; out: eax = 0 if OK ;\r
;------------------------------------------------;\r
add_timercall:\r
- cmp [call_list], 0\r
- jne .test2\r
- mov [call_list], ebx\r
- jmp .end\r
- .error:\r
- mov eax, 1\r
- ret\r
- .test2:\r
- cmp [call_list+4], 0 ; since i am so lazy\r
- jne .test3 ; and a loop can be\r
- mov [call_list+4], ebx ; rather complicated\r
- jmp .end ; for this stuff, i\r
- .test3: ; check for each one..\r
- cmp [call_list+8], 0 ; after all, it's only 5.\r
- jne .test4\r
- mov [call_list+8], ebx\r
- jmp .end\r
- .test4:\r
- cmp [call_list+12], 0\r
- jne .test5\r
- mov [call_list+12], ebx\r
- jmp .end\r
- .test5:\r
- cmp [call_list+16], 0\r
- jne .error\r
- mov [call_list+16], ebx\r
- .end:\r
- xor eax, eax\r
- ret\r
+ cmp [call_list], 0\r
+ jne .test2\r
+ mov [call_list], ebx\r
+ jmp .end\r
+ .error:\r
+ mov eax, 1\r
+ ret\r
+ .test2:\r
+ cmp [call_list+4], 0 ; since i am so lazy\r
+ jne .test3 ; and a loop can be\r
+ mov [call_list+4], ebx ; rather complicated\r
+ jmp .end ; for this stuff, i\r
+ .test3: ; check for each one..\r
+ cmp [call_list+8], 0 ; after all, it's only 5.\r
+ jne .test4\r
+ mov [call_list+8], ebx\r
+ jmp .end\r
+ .test4:\r
+ cmp [call_list+12], 0\r
+ jne .test5\r
+ mov [call_list+12], ebx\r
+ jmp .end\r
+ .test5:\r
+ cmp [call_list+16], 0\r
+ jne .error\r
+ mov [call_list+16], ebx\r
+ .end:\r
+ xor eax, eax\r
+ ret\r
\r
\r
\r
; out: eax = 0 if OK ;\r
;-------------------------------------------------;\r
remove_timercall:\r
- cmp [call_list], ebx\r
- jne .test2\r
- mov [call_list], dword 0\r
- jmp .end\r
- .error:\r
- mov eax, 1\r
- ret\r
- .test2:\r
- cmp [call_list+4], ebx\r
- jne .test3\r
- mov [call_list+4], dword 0\r
- jmp .end\r
- .test3:\r
- cmp [call_list+8], ebx\r
- jne .test4\r
- mov [call_list+8], dword 0\r
- jmp .end\r
- .test4:\r
- cmp [call_list+12], ebx\r
- jne .test5\r
- mov [call_list+12], dword 0\r
- jmp .end\r
- .test5:\r
- cmp [call_list+16], ebx\r
- jne .error\r
- mov [call_list+16], dword 0\r
- .end:\r
- xor eax, eax\r
- ret\r
+ cmp [call_list], ebx\r
+ jne .test2\r
+ mov [call_list], dword 0\r
+ jmp .end\r
+ .error:\r
+ mov eax, 1\r
+ ret\r
+ .test2:\r
+ cmp [call_list+4], ebx\r
+ jne .test3\r
+ mov [call_list+4], dword 0\r
+ jmp .end\r
+ .test3:\r
+ cmp [call_list+8], ebx\r
+ jne .test4\r
+ mov [call_list+8], dword 0\r
+ jmp .end\r
+ .test4:\r
+ cmp [call_list+12], ebx\r
+ jne .test5\r
+ mov [call_list+12], dword 0\r
+ jmp .end\r
+ .test5:\r
+ cmp [call_list+16], ebx\r
+ jne .error\r
+ mov [call_list+16], dword 0\r
+ .end:\r
+ xor eax, eax\r
+ ret\r
\r
\r
\r
; out: nothing ;\r
;--------------------------------------------;\r
delay:\r
- mov [timer_wait], ecx ; mov value to "timer"\r
- .loop:\r
- cmp [timer_wait], 0\r
- jne .loop\r
- ret\r
+ mov [timer_wait], ecx ; mov value to "timer"\r
+ .loop:\r
+ cmp [timer_wait], 0\r
+ jne .loop\r
+ ret\r
\r
\r
\r
; out: ecx = pointer to counter ;\r
;--------------------------------------------;\r
active_delay:\r
- mov [timer_wait], ecx ; mov value to "timer"\r
- mov ecx, timer_wait ; let caller check value\r
- ret\r
+ mov [timer_wait], ecx ; mov value to "timer"\r
+ mov ecx, timer_wait ; let caller check value\r
+ ret\r
\r
\r
\r
; set PIT to 100Hz ;\r
;------------------------------;\r
set_pit_freq:\r
- push eax\r
- mov al, 0x34 ; set to 100Hz, 0x34 = 00110100b\r
- out 0x43, al\r
- mov al, 0x9B ; lsb 1193180 / 1193\r
- out 0x40, al\r
- mov al, 0x2E ; msb\r
- out 0x40, al\r
- pop eax\r
- ret
\ No newline at end of file
+ push eax\r
+ mov al, 0x34 ; set to 100Hz, 0x34 = 00110100b\r
+ out 0x43, al\r
+ mov al, 0x9B ; lsb 1193180 / 1193\r
+ out 0x40, al\r
+ mov al, 0x2E ; msb\r
+ out 0x40, al\r
+ pop eax\r
+ ret
\ No newline at end of file
;----------------------------------------------------------;\r
-; BOS kernel Christoffer Bubach, 2003-2005. ;\r
+; BOS kernel Christoffer Bubach, 2003-2015. ;\r
;----------------------------------------------------------;\r
; ;\r
-; set/modify IDT entries ;\r
+; Set/modify IDT entries ;\r
; ;\r
;----------------------------------------------------------;\r
\r
+;-----------------------------------------------------;\r
+; ;\r
+; IDT entry structure ;\r
+; ;\r
+; 16bit - entry offset bits 0..15 ;\r
+; 16bit - code segment selector in GDT or LDT ;\r
+; 8bit - unused, set to 0 ;\r
+; 8bit - type and attributes ;\r
+; - 0xE = 32bit intterrupt ;\r
+; - 0x8 = Present bit = 1 ;\r
+; 16bit - entry offset bits 16..31 ;\r
+; ;\r
+; middle section for code segment 08 = 0x8E000008 ;\r
+;-----------------------------------------------------;\r
\r
\r
;--------------------------------------------------;\r
init_idt:\r
push eax\r
push ecx\r
+ push edi\r
\r
+ xor edi, edi\r
xor ecx, ecx\r
- .l1:\r
- mov eax, esi ; loop full IDT and\r
- mov [(0x6c00+ecx)], ax ; set to one ISR\r
- add ecx, 2\r
+ add edi, [idtr.address]\r
+ .l1: ; loop full IDT table\r
+ mov eax, esi\r
+ mov word [edi], ax ; set handler lower offset\r
+ add edi, 2\r
\r
- mov dword [(0x6c00+ecx)], 0x8E000008 ; 0x6c00 is where\r
- add ecx, 4 ; we put the IDT\r
+ mov dword [edi], 0x8E000008 ; set IDT segment and attributes\r
+ add edi, 4\r
\r
mov eax, esi\r
shr eax, 16\r
- mov [(0x6c00+ecx)], ax\r
- add ecx, 2\r
+ mov word [edi], ax ; set handler high offset\r
+ add edi, 2\r
\r
- cmp ecx, 0x800 ; 256 ints\r
- jb .l1 ; * 8 bytes each\r
+ add cx, 8 ; 8byte *\r
+ cmp cx, word [idtr.size] ; 256 ints\r
+ jb .l1 ; = done?\r
\r
+ pop edi\r
pop ecx\r
pop eax\r
ret\r
; edi = int function pointer ;\r
;--------------------------------------;\r
set_int:\r
- push eax\r
- push ecx\r
+ push eax\r
+ push ecx\r
\r
- mov al, 8 ; 8 bytes for each int\r
- mul cl ; cl * al = ax\r
- movzx ecx, ax ; ecx = IDT offset\r
- shr ecx, 1 ; 1/2 for dword list\r
- mov dword [(idt_list+ecx)], edi ; add to dword int list\r
- movzx ecx, ax ; ecx = IDT offset\r
+ mov al, 8 ; 8 bytes for each int\r
+ mul cl ; cl * al = ax\r
+ movzx ecx, ax ; ecx = IDT offset\r
+ shr ecx, 1 ; 1/2 for dword list\r
+ mov dword [(idt_list+ecx)], edi ; add to dword int list\r
+ movzx ecx, ax ; ecx = IDT offset\r
\r
- mov eax, edi\r
- mov [(0x6c00+ecx)], ax\r
- add ecx, 2\r
+ mov eax, edi\r
+ mov [(0x6c00+ecx)], ax\r
+ add ecx, 2\r
\r
- mov dword [(0x6c00+ecx)], 0x8E000008\r
- add ecx, 4\r
+ mov dword [(0x6c00+ecx)], 0x8E000008\r
+ add ecx, 4\r
\r
- mov eax, edi\r
- shr eax, 16\r
- mov [(0x6c00+ecx)], ax\r
+ mov eax, edi\r
+ shr eax, 16\r
+ mov [(0x6c00+ecx)], ax\r
\r
- pop ecx\r
- pop eax\r
- ret\r
+ pop ecx\r
+ pop eax\r
+ ret\r
\r
\r
\r
; out: esi = address or 0 if none present ;\r
;------------------------------------------------;\r
get_int:\r
- push eax\r
+ push eax\r
\r
- mov eax, 4 ; 4 bytes for each address\r
- mul cl ; cl * al = ax\r
- mov esi, idt_list\r
- add esi, eax\r
+ mov eax, 4 ; 4 bytes for each address\r
+ mul cl ; cl * al = ax\r
+ mov esi, idt_list\r
+ add esi, eax\r
\r
- pop eax\r
- ret\r
+ pop eax\r
+ ret\r
\r
\r
\r
; in: esi = pointer to int list ;\r
;----------------------------------------;\r
set_idt_list:\r
- push eax\r
- push edi\r
-\r
- xor ecx, ecx\r
- .l1:\r
- lodsd\r
- or eax, eax\r
- jz .next\r
- mov edi, eax\r
- call set_int\r
- .next:\r
- inc ecx\r
- cmp ecx, 0x100\r
- jb .l1\r
-\r
- pop edi\r
- pop eax\r
- ret\r
+ push eax\r
+ push edi\r
+\r
+ xor ecx, ecx\r
+ .l1:\r
+ lodsd\r
+ or eax, eax\r
+ jz .next\r
+ mov edi, eax\r
+ call set_int\r
+ .next:\r
+ inc ecx\r
+ cmp ecx, 0x100\r
+ jb .l1\r
+\r
+ pop edi\r
+ pop eax\r
+ ret\r
\r
\r
\r