From 1ead42b4b8cf6ae636453b464e7c85db0df2c167 Mon Sep 17 00:00:00 2001 From: AYIDouble Date: Thu, 13 Sep 2018 10:32:06 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=81=20Refactoring?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assembler Intel Code/apm_shutdown.S | 102 +++++++++++++-------------- Assembler Intel Code/infinite_loop.S | 2 +- 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/Assembler Intel Code/apm_shutdown.S b/Assembler Intel Code/apm_shutdown.S index bef53bb..efdde33 100644 --- a/Assembler Intel Code/apm_shutdown.S +++ b/Assembler Intel Code/apm_shutdown.S @@ -2,61 +2,61 @@ BEGIN -movb $0x53,%ah #this is an APM command -movb $0x0,%al #installation check command -xorw %bx,%bx #device id (0 = APM BIOS) -int $0x15 #call the BIOS function through interrupt 15h -jc APM_error #if the carry flag is set there was an error - #the function was successful - #AX = APM version number - #AH = Major revision number (in BCD format) - #AL = Minor revision number (also BCD format) - #BX = ASCII characters "P" (in BH) and "M" (in BL) - #CX = APM flags (see the official documentation for more details) + movb $0x53,%ah #this is an APM command + movb $0x0,%al #installation check command + xorw %bx,%bx #device id (0 = APM BIOS) + int $0x15 #call the BIOS function through interrupt 15h + jc APM_error #if the carry flag is set there was an error + #the function was successful + #AX = APM version number + #AH = Major revision number (in BCD format) + #AL = Minor revision number (also BCD format) + #BX = ASCII characters "P" (in BH) and "M" (in BL) + #CX = APM flags (see the official documentation for more details) -#disconnect from any APM interface -movb $0x53,%ah #this is an APM command -movb $0x4,%al #interface disconnect command -xorw %bx,%bx #device id (0 = APM BIOS) -int $0x15 #call the BIOS function through interrupt 15h -jc .disconnect_error #if the carry flag is set see what the fuss is about. -jmp .no_error + #disconnect from any APM interface + movb $0x53,%ah #this is an APM command + movb $0x4,%al #interface disconnect command + xorw %bx,%bx #device id (0 = APM BIOS) + int $0x15 #call the BIOS function through interrupt 15h + jc .disconnect_error #if the carry flag is set see what the fuss is about. + jmp .no_error -.disconnect_error: #the error code is in ah. -cmpb $0x3,%ah #if the error code is anything but 03h there was an error. -jne APM_error #the error code 03h means that no interface was connected in the first place. + .disconnect_error: #the error code is in ah. + cmpb $0x3,%ah #if the error code is anything but 03h there was an error. + jne APM_error #the error code 03h means that no interface was connected in the first place. -.no_error: - #the function was successful - #Nothing is returned. + .no_error: + #the function was successful + #Nothing is returned. -#connect to an APM interface -movb $0x53,%ah #this is an APM command -movb $0x01,%al #see above description -xorw %bx,%bx #device id (0 = APM BIOS) -int $0x15 #call the BIOS function through interrupt 15h -jc APM_error #if the carry flag is set there was an error - #the function was successful - #The return values are different for each interface. - #The Real Mode Interface returns nothing. - #See the official documentation for the - #return values for the protected mode interfaces. + #connect to an APM interface + movb $0x53,%ah #this is an APM command + movb $0x01,%al #see above description + xorw %bx,%bx #device id (0 = APM BIOS) + int $0x15 #call the BIOS function through interrupt 15h + jc APM_error #if the carry flag is set there was an error + #the function was successful + #The return values are different for each interface. + #The Real Mode Interface returns nothing. + #See the official documentation for the + #return values for the protected mode interfaces. -#Enable power management for all devices -movb $0x53,%ah #this is an APM command -movb $0x8,%al #Change the state of power management... -movw $0x001,%bx #...on all devices to... -movw $0x001,%cx #...power management on. -int $0x15 #call the BIOS function through interrupt 15h -jc APM_error #if the carry flag is set there was an error + #Enable power management for all devices + movb $0x53,%ah #this is an APM command + movb $0x8,%al #Change the state of power management... + movw $0x001,%bx #...on all devices to... + movw $0x001,%cx #...power management on. + int $0x15 #call the BIOS function through interrupt 15h + jc APM_error #if the carry flag is set there was an error -#Set the power state for all devices -movb $0x53,%ah #this is an APM command -movb $0x07,%al #Set the power state... -movw $0x0001,%bx #...on all devices to... -movw $0x0003,%cx #see above -int $0x15 #call the BIOS function through interrupt 15h -jc APM_error #if the carry flag is set there was an error + #Set the power state for all devices + movb $0x53,%ah #this is an APM command + movb $0x07,%al #Set the power state... + movw $0x0001,%bx #...on all devices to... + movw $0x0003,%cx #see above + int $0x15 #call the BIOS function through interrupt 15h + jc APM_error #if the carry flag is set there was an error -APM_error: -hlt \ No newline at end of file + APM_error: + hlt \ No newline at end of file diff --git a/Assembler Intel Code/infinite_loop.S b/Assembler Intel Code/infinite_loop.S index 62ed558..8b33e92 100644 --- a/Assembler Intel Code/infinite_loop.S +++ b/Assembler Intel Code/infinite_loop.S @@ -1,4 +1,4 @@ #include "common.h" BEGIN loop: -jmp loop \ No newline at end of file + jmp loop \ No newline at end of file