'--------------------------------------------------------------------------------------------------------- 'INI LMM. ' (HL) <- [C]; ' B <- B-1; ' HL <- HL+1 ini_lmm rdbyte data_8, c_reg 'Set the IO port from C wrbyte data_8, io_port mov data_8, #io_cmd_in 'Set I/O command to IN... #ifdef TriBladeProp mov dira, ram_dir_input 'RR20090321 (pass I/O to another cog) #endif wrbyte data_8, io_command :wait rdbyte data_8, io_command wz '...and wait for it to be completed. if_nz sub lmm_pc, #(2*4) 'jmp #:wait 'in LMM #ifdef TriBladeProp mov dira, ram_dir_read 'Take I/O from another cog #endif rdbyte data_8, io_data rdword address, h_reg 'Write port data to memory at HL call #write_memory_byte add address, #1 'Update HL reg wrword address, h_reg rdbyte data_8, b_reg 'Update B reg sub data_8, #1 wrbyte data_8, b_reg jmp #fetch '---------------------------------------------------------------------------------------------------------