#ifdef INTELLISENSE_DIRECTIVES #pragma once #endif // Auto-generated by ps1_meta.lua — DO NOT EDIT // Source: C:\projects\Pikuma\ps1\code\hello_joypad\hello_joypad.tape.c // Component atoms (MipsAtomComp_(ac_*)) -> macro variants (mac_*) #ifndef WORD_COUNT #define WORD_COUNT(name, count) enum { words_##name = (count) }; #endif /* atom_dbg_skip */ #define mac_load_v2s2(rs_x, rs_y, r_base, offset) \ load_half( rs_x, r_base, O_(V3_S2,x)) \ , load_half( rs_y, r_base, O_(V3_S2,y)) WORD_COUNT(mac_load_v2s2, 2) /* atom_dbg_skip */ #define mac_store_v2s2(rt_x, rt_y, base, offset) \ store_half(rt_x, base, offset + O_(V2_S2,x)) \ , store_half(rt_y, base, offset + O_(V2_S2,y)) WORD_COUNT(mac_store_v2s2, 2) /* atom_dbg_skip */ #define mac_store_rects2(rt_x, rt_y, rt_width, rt_height, base, offset) \ store_half(rt_x, base, offset + O_(Rect_S2,x)) \ , store_half(rt_y, base, offset + O_(Rect_S2,y)) \ , store_half(rt_width, base, offset + O_(Rect_S2,width)) \ , store_half(rt_height, base, offset + O_(Rect_S2,height)) WORD_COUNT(mac_store_rects2, 4) /* atom_dbg_skip */ #define mac_store_rgb8(rr, rg, rb, base, offset) \ store_byte(rr, base, offset + O_(DrawEnv,initial_bg_color.r)) \ , store_byte(rg, base, offset + O_(DrawEnv,initial_bg_color.g)) \ , store_byte(rb, base, offset + O_(DrawEnv,initial_bg_color.b)) WORD_COUNT(mac_store_rgb8, 3) #define mac_gcmd_push(cmd, reg_transfer, reg_base, port) \ load_upper_i(reg_transfer, cmd >> 16) \ , or_i_self( reg_transfer, cmd & 0xFFFF) \ , store_word( reg_transfer, reg_base, port) WORD_COUNT(mac_gcmd_push, 3) #define mac_put_disp_env(reg_transfer, reg_base, port) \ mac_gcmd_push(gp0_word_draw_area_top_left_origin, reg_transfer, reg_base, port) \ , mac_gcmd_push(gp0_word_draw_area_bottom_right_320x240, reg_transfer, reg_base, port) \ , mac_gcmd_push(gp0_word_set_mask_bit(), reg_transfer, reg_base, port) \ , mac_gcmd_push(gp0_word_draw_area_top_left_origin, reg_transfer, reg_base, port) \ , mac_gcmd_push(gp0_word_draw_area_bottom_right_320x240, reg_transfer, reg_base, port) WORD_COUNT(mac_put_disp_env, 15) #define mac_put_draw_env(reg_transfer, reg_base, port) \ mac_gcmd_push(gp0_dr_env_tag, reg_transfer, reg_base, port) /* tag (length=15 << 24, addr=0) — packet header for the DR_ENV sequence. The GPU needs this to recognize the next 15 words as a DR_ENV packet and trigger the isbg auto-clear. */ \ , mac_gcmd_push(gp0_word_draw_mode_drawing_allowed, reg_transfer, reg_base, port) /* code[0] DrawMode (dfe=1, dtd=0, tpage=0) */ \ , mac_gcmd_push(gp0_word_set_texture_window(), reg_transfer, reg_base, port) /* code[1] TextureWindow (tw=(0,0)) */ \ , mac_gcmd_push(enc_gp0_draw_area_tl_word(0, ScreenRes_Y), reg_transfer, reg_base, port) /* code[2] DrawArea top-left (clip.x=0, clip.y=ScreenRes_Y=240) */ \ , mac_gcmd_push(gp0_word_draw_area_bottom_right_320x240, reg_transfer, reg_base, port) /* code[3] DrawArea bottom-right (clip.x+w=320, clip.y+h=480) */ \ , mac_gcmd_push(gp0_word_set_draw_offset(), reg_transfer, reg_base, port) /* code[4] DrawOffset (ofs=(0,0)) — bare-cmd word; the GPU uses the current state machine. */ \ , mac_gcmd_push(gp0_word_dr_env_mask(), reg_transfer, reg_base, port) /* code[5] Mask (dtd=0, dfe=1, isbg=1) — 0xE6 cmd + isbg bit. */ \ , mac_gcmd_push(gp0_word_dr_env_bg_color_cmd(1, 7, 7, 7), reg_transfer, reg_base, port) /* code[6] Initial-bg-color + auto-clear (isbg=1, r=7, g=7, b=7). */ \ , mac_gcmd_push(gp0_word_dr_env_draw_mode(1), reg_transfer, reg_base, port) /* code[7] Re-assert DrawMode with isbg=1 (isbg-flag set; the 0xE1 cmd byte plus isbg only). */ /* code[8..10] Padding (NOP — GPU discards; the DR_ENV requires 16 words total). */ \ , mac_gcmd_push(gp0_word_nop(), reg_transfer, reg_base, port) \ , mac_gcmd_push(gp0_word_nop(), reg_transfer, reg_base, port) \ , mac_gcmd_push(gp0_word_nop(), reg_transfer, reg_base, port) /* code[11..12] TextureWindow bottom-right (tw.x+tw.w=0, tw.y+tw.h=0) — libpsyx emits twice. */ \ , mac_gcmd_push(gp0_word_set_texture_window(), reg_transfer, reg_base, port) \ , mac_gcmd_push(gp0_word_set_texture_window(), reg_transfer, reg_base, port) /* code[13..14] Padding (NOP) — completes the 16-word packet. */ \ , mac_gcmd_push(gp0_word_nop(), reg_transfer, reg_base, port) \ , mac_gcmd_push(gp0_word_nop(), reg_transfer, reg_base, port) WORD_COUNT(mac_put_draw_env, 48)