asm_regs.g 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # This file is part of asmc, a bootstrapping OS with minimal seed
  2. # Copyright (C) 2018 Giovanni Mascellani <gio@debian.org>
  3. # https://gitlab.com/giomasce/asmc
  4. # This program is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation, either version 3 of the License, or
  7. # (at your option) any later version.
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. # You should have received a copy of the GNU General Public License
  13. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  14. fun parse_register 1 {
  15. $reg
  16. @reg 0 param = ;
  17. if reg "al" strcmp_case 0 == { 0x10 ret ; }
  18. if reg "cl" strcmp_case 0 == { 0x11 ret ; }
  19. if reg "dl" strcmp_case 0 == { 0x12 ret ; }
  20. if reg "bl" strcmp_case 0 == { 0x13 ret ; }
  21. if reg "ah" strcmp_case 0 == { 0x14 ret ; }
  22. if reg "ch" strcmp_case 0 == { 0x15 ret ; }
  23. if reg "dh" strcmp_case 0 == { 0x16 ret ; }
  24. if reg "bh" strcmp_case 0 == { 0x17 ret ; }
  25. if reg "ax" strcmp_case 0 == { 0x20 ret ; }
  26. if reg "cx" strcmp_case 0 == { 0x21 ret ; }
  27. if reg "dx" strcmp_case 0 == { 0x22 ret ; }
  28. if reg "bx" strcmp_case 0 == { 0x23 ret ; }
  29. if reg "sp" strcmp_case 0 == { 0x24 ret ; }
  30. if reg "bp" strcmp_case 0 == { 0x25 ret ; }
  31. if reg "si" strcmp_case 0 == { 0x26 ret ; }
  32. if reg "di" strcmp_case 0 == { 0x27 ret ; }
  33. if reg "eax" strcmp_case 0 == { 0x30 ret ; }
  34. if reg "ecx" strcmp_case 0 == { 0x31 ret ; }
  35. if reg "edx" strcmp_case 0 == { 0x32 ret ; }
  36. if reg "ebx" strcmp_case 0 == { 0x33 ret ; }
  37. if reg "esp" strcmp_case 0 == { 0x34 ret ; }
  38. if reg "ebp" strcmp_case 0 == { 0x35 ret ; }
  39. if reg "esi" strcmp_case 0 == { 0x36 ret ; }
  40. if reg "edi" strcmp_case 0 == { 0x37 ret ; }
  41. if reg "cs" strcmp_case 0 == { 0x28 ret ; }
  42. if reg "ss" strcmp_case 0 == { 0x29 ret ; }
  43. if reg "ds" strcmp_case 0 == { 0x2a ret ; }
  44. if reg "es" strcmp_case 0 == { 0x2b ret ; }
  45. if reg "fs" strcmp_case 0 == { 0x2c ret ; }
  46. if reg "gs" strcmp_case 0 == { 0x2d ret ; }
  47. 0xffffffff ret ;
  48. }