无法在我的组装操作系统中添加应用程序

问题描述

我使用nasm制作了一个小型操作系统,我想使用汇编语言添加基本的GUI和一些应用程序(例如计算器,日历),所以有人可以帮助我该怎么做?

现在我们可以在其中键入文本,并且它具有蓝色背景,但是现在我无法在其中添加任何命令或程序,我也需要帮助。

请提供以下我到目前为止编写的代码 如果您能告诉我如何使用Assembly(.asm)语言这样做会更好 但是c#或c ++也可以。

由于我的操作系统是开源的,您也可以将您对此代码制作的补丁寄给我:[email protected]

这是我到目前为止编写的代码

    [BITS 16]   ;Tells the assembler that its a 16 bit code
  [ORG 0x7C00]  ;Origin,tell the assembler that where the code will
            ;be in memory after it is been loaded

CALL PrintString    ;Call print string procedure



  JMP $         ;Infinite loop,hang it here.


PrintCharacter: ;Procedure to print character on screen
        ;Assume that ASCII value is in register AL

   MOV AH,09h
   MOV CX,1000h
    mov al,20h
     mov bl,17h
    int 10h

    mov ah,09h
     mov cx,80d
    mov al,87h
   int 10h

  mov ah,01h
  mov cx,07h
  int 10h

  mov bl,05h
  mov cl,05h


  _mouser:
  mov ah,02h
  mov dl,bl
  mov dh,cl
  int 10h
  mov ah,00h
  int 16h

  cmp al,77h
  je _up
  cmp al,73h
  je _down
  cmp al,61h
  je _left
  cmp al,64h
  je _right
  cmp al,08h
  je _backspace
  cmp al,09h
  jge _print
  cmp al,07h
  jge _print

  jmp _mouser

  _backspace:
  sub bl,1h
  jmp _backspace2

  _backspace2:
  mov ah,0eh
  mov al,20h
  int 10h
  jmp _mouser

  _down:
  cmp cl,23d
  je _mouser
  add cl,1h
  jmp _mouser

  _up:
  cmp cl,0h
  je _mouser
  sub cl,1h
  jmp _mouser

  _left:
  cmp bl,0h
  je _mouser
  sub bl,1h
  jmp _mouser

  _right:
  cmp bl,79d
  je _mouser
  add bl,1h
  jmp _mouser

  _print:
  mov ah,0eh
  cmp al,00h
  je _down
  int 10h
  jmp _right



  mov si,hello_world              ; point hello_world to source index
    call print_string                      ; call print different color string function

  hello_world db  'Hello World!',13,0



  print_string:
      mov ah,0x0E            ; value to tell interrupt handler that take value from al & print it

  .repeat_next_char:
      lodsb              ; get character from string
      cmp al,0                      ; cmp al with end of string
      je .done_print                 ; if char is zero,end of string
      int 0x10                   ; otherwise,print it
      jmp .repeat_next_char      ; jmp to .repeat_next_char if not 0

  .done_print:
      ret                       ;return


  INT 0x10  ;Call video interrupt



  PrintString:  ;Procedure to print string on screen
      ;Assume that string starting pointer is in register SI

  next_character:   ;Lable to fetch next character from string
  MOV AL,[SI]  ;Get a byte from string and store in AL register
  INC SI        ;Increment SI pointer
  OR AL,AL ;Check if value in AL is zero (end of string)
  JZ exit_function ;If end then return
  CALL PrintCharacter ;Else print the character which is in AL register
  JMP next_character    ;Fetch next character from string
  exit_function:    ;End label
  RET       ;Return from procedure




      times 512 - ($-$$)) db,0
  DW 0xAA55         ;Add boot signature at the end of bootloader       

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)