about summary refs log blame commit diff stats
path: root/083scenario_screen_test.mu
blob: b4ac6e5e8f01ed5acb0f78dfc032ea448514130a (plain) (tree)
1
2
3
4
5
6
7
8

                                                                            
                                        
             
                                 
       
                       
                             






                         
                                                 
             
                                 

                     
                           
                                
                                               
       
                               






                         














                                       
# To check our support for screens in scenarios, rewrite tests from print.mu

scenario print-character-at-top-left-2 [
  local-scope
  assume-screen 3/width, 2/height
  run [
    a:char <- copy 97/a
    screen <- print screen, a
  ]
  screen-should-contain [
    .a  .
    .   .
  ]
]

scenario clear-line-erases-printed-characters-2 [
  local-scope
  assume-screen 5/width, 3/height
  # print a character
  a:char <- copy 97/a
  screen <- print screen, a
  # move cursor to start of line
  screen <- move-cursor screen, 0/row, 0/column
  run [
    screen <- clear-line screen
  ]
  screen-should-contain [
    .     .
    .     .
    .     .
  ]
]

scenario scroll-screen [
  local-scope
  assume-screen 3/width, 2/height
  run [
    a:char <- copy 97/a
    move-cursor screen, 1/row, 2/column
    screen <- print screen, a
    screen <- print screen, a
  ]
  screen-should-contain [
    .  a.
    .a  .
  ]
]
32/ecx 0xc/disp8 . # copy *(ebp+12) to ecx 81 0/subop/add 3/mod/direct 1/rm32/ecx . . . . . 4/imm32 # add to ecx # . size : edx = *s 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 2/r32/edx 0xc/disp8 . # copy *(ebp+12) to edx 8b/copy 0/mod/indirect 2/rm32/edx . . . 2/r32/edx . . # copy *edx to edx # . syscall b8/copy-to-eax 4/imm32/write cd/syscall 0x80/imm8 # if (eax < 0) abort 3d/compare-eax-with 0/imm32 0f 8c/jump-if-lesser $_write:abort/disp32 $_write:end: # . restore registers 5b/pop-to-ebx 5a/pop-to-edx 59/pop-to-ecx 58/pop-to-eax # . epilogue 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp 5d/pop-to-ebp c3/return $_write:abort: # can't write a message here for risk of an infinite loop, so we'll use a special exit code instead # . syscall(exit, 255) bb/copy-to-ebx 0xff/imm32 b8/copy-to-eax 1/imm32/exit cd/syscall 0x80/imm8 # never gets here # . . vim:nowrap:textwidth=0