Human68k CUI emulator with sound.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

fake_human.s 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. ;
  2. ; Fake HUMAN.SYS
  3. ;
  4. ; Uses a fake MMIO port to execute the actual DOS stuff
  5. ;
  6. LineFVecAddr equ $00002c
  7. DOSCallVecTable equ $001800
  8. DOSWorkCurProcAddr equ $001caa
  9. FakeDOSCallPort equ $ea0000
  10. FakeEmuCmdPort equ $ea0008
  11. .text
  12. Start:
  13. bra DOSStart
  14. HelloString:
  15. .dc.b 'Fake DOS', $0d, $0a, $00, $00
  16. DOSStart:
  17. movea.l #$21000,sp
  18. bsr SetupDOSCalls
  19. ; Signal to emulator that we're done initializing
  20. move.w #$ffff, (FakeEmuCmdPort)
  21. @@:
  22. stop #$2000
  23. jmp @b
  24. ; Setup DOS call table at $1800
  25. ; and the Line F exception handler
  26. SetupDOSCalls:
  27. lea.l (DOSCallVecTable),a1
  28. move.w #$00ff,d1
  29. @@:
  30. move.l #FakeDOSCallHandler,(a1)+ ; Fill all 256 DOS calls with the fake handler
  31. dbra.w d1,@b
  32. move.l #LineFExceptionHandler,(LineFVecAddr)
  33. rts
  34. ; Catch $Fxxx instructions
  35. LineFExceptionHandler:
  36. movem.l d0-d1/a1-a2,-(sp)
  37. lea.l ($0012,sp),a2 ; Get stack addr of pushed PC
  38. movea.l (a2),a1 ; Get PC from stack
  39. clr.l d0
  40. move.w (a1)+,d0 ; Get instruction from (PC)
  41. move.l a1, (a2)
  42. cmpi.w #$ff00,d0 ; Only process instructions >= $ff00
  43. bcs LineFDone
  44. move.w d0, d1
  45. and.w #$00ff, d1
  46. add.w d1, d1
  47. add.w d1, d1
  48. lea.l (DOSCallVecTable), a2
  49. add.l d1, a2
  50. move.l (a2), a2
  51. jsr (a2)
  52. LineFDone:
  53. movem.l (sp)+,d0-d1/a1-a2
  54. rte
  55. FakeDOSCallHandler:
  56. lea.l (26,sp),sp
  57. move.l #FakeDOSCallPort, a1
  58. move.w d0, (a1)
  59. lea.l (-26,sp),sp
  60. rts