星期三

印列記憶體內容2

改進了一點,現在可以用下面的按鍵控制移動:
Space - 下一版
b - 上一版
0 - 回到Address 0
4/F4 - 加/減 0x1000
5/F5 - 加/減 0x10000
6/F6 - 加/減 0x100000
---------- kernel.asm ----------
;*********************************************
;   ABCOS - Kernel
;*********************************************

   bits 32
   org 0x1000

   CALL ClearScreen

   MOV   ESI, 0x00
   MOV   BX, 0

Main_loop:
   CALL GetKeyboard

   CMP   DL, 30h ; b - back
   JNZ   Main_not_back
   SUB   ESI, 640d
   JMP   Main_PrintMem
Main_not_back:
   CMP   DL, 0Bh ; 0 - to zero
   JNZ   Main_not_0
   MOV   ESI, 0
   JMP   Main_PrintMem
Main_not_0:
   CMP   DL, 05h ; 4 - 4
   JNZ   Main_not_4
   ADD   ESI, 0x1000
   SUB   ESI, 320d
   JMP   Main_PrintMem
Main_not_4:
   CMP   DL, 06h ; 5 - 5
   JNZ   Main_not_5
   ADD   ESI, 0x10000
   SUB   ESI, 320d
   JMP   Main_PrintMem
Main_not_5:
   CMP   DL, 07h ; 6 - 6
   JNZ   Main_not_6
   ADD   ESI, 0x100000
   SUB   ESI, 320d
   JMP   Main_PrintMem
Main_not_6:

   CMP   DL, 3Eh ; f4 - 4
   JNZ   Main_not_f4
   SUB   ESI, 0x1000
   SUB   ESI, 320d
   JMP   Main_PrintMem
Main_not_f4:
   CMP   DL, 3Fh ; f5 - 5
   JNZ   Main_not_f5
   SUB   ESI, 0x10000
   SUB   ESI, 320d
   JMP   Main_PrintMem
Main_not_f5:
   CMP   DL, 40h ; f6 - 6
   JNZ   Main_not_f6
   SUB   ESI, 0x100000
   SUB   ESI, 320d
   JMP   Main_PrintMem
Main_not_f6:

Main_PrintMem:
   CALL PrintMemory_20Line
   JMP Main_loop
Main_End:
   HLT
---------- kernel.asm ----------

沒有留言: