cscg22-gearboy

CSCG 2022 Challenge 'Gearboy'
git clone https://git.sinitax.com/sinitax/cscg22-gearboy
Log | Files | Refs | sfeed.txt

emu_debug_printf.s (698B)


      1        .include "global.s"
      2
      3        .title  "EMU_debug"
      4        .module EMU_debug
      5
      6        .globl  _sprintf
      7
      8        .area   _DATA
      9
     10ret_save:
     11        .ds     0x02
     12printf_buffer:
     13        .ds     0x80
     14
     15        .area   _HOME
     16    
     17        ;; EMU_printf(fmt, ...)
     18_EMU_printf::
     19        di
     20        pop de
     21        ld hl, #ret_save
     22        ld (hl), e
     23        inc hl
     24        ld (hl), d
     25        
     26        ld de, #printf_buffer
     27        push de
     28        call _sprintf
     29        pop hl
     30
     31        ld d,d
     32        jr 1$
     33        .dw 0x6464
     34        .dw 0x0001
     35        .dw #printf_buffer
     36        .dw 0        
     371$:
     38        ld hl, #ret_save
     39        ld a, (hl+)
     40        ld h, (hl)
     41        ld l, a
     42        ei
     43        jp (hl)