opcodes[]: global scope global { global scope implicit__i2c { } type utf8str: type ucs1str: type ucs2str: type FD: type BlockDevice: type I2cBlockDevice: bool read_block ( I2cBlockDevice¢ fd, uint32 blk, uint8[]¢ bu ) { var I2cBlockDevice¢ fd var uint32 blk var uint8[]¢ bu var uint16 fpos var uint16 a var uint16 e lvar+2+0 "blk" ( -- uint32& ) lo ( uint32& -- uint16& ) peek ( uint16& -- uint16 ) lvar+6+2 "fd" ( -- I2cBlockDevice¢& ) peek ( I2cBlockDevice¢& -- I2cBlockDevice¢ ) item+9 "log2blocksize" ( -- uint8& ) peek ( uint8& -- uint8 ) cast ( uint8 -- int16 ) << ( uint16, int16 -- uint16 ) 0 ( -- uint16 ) lvar+0+4 "bu" ( -- uint8[]¢& ) peek ( uint8[]¢& -- uint8[]¢ ) count ( uint8[]¢ -- uint16 ) 1 ( -- uint16 ) - ( uint16, uint16 -- uint16 ) lvar+6+6 "fd" ( -- I2cBlockDevice¢& ) peek ( I2cBlockDevice¢& -- I2cBlockDevice¢ ) item+17 "select_mask" ( -- uint8& ) peek ( uint8& -- uint8 ) call select ( uint8 ) lvar-2+6 "fpos" ( -- uint16& ) peek ( uint16& -- uint16 ) call start_reading ( uint16 -- bool ) jp_z ( bool -- ) -> L664 call ei () 3 ( -- OSErr ) call yes_with_error ( OSErr -- bool ) jp ( -- ) -> L661 L664: lvar-4+6 "a" ( -- uint16& ) peek ( uint16& -- uint16 ) lvar-6+8 "e" ( -- uint16& ) peek ( uint16& -- uint16 ) == ( uint16, uint16 -- bool ) call readbyte ( bool -- uint8 ) lvar+0+8 "bu" ( -- uint8[]¢& ) peek ( uint8[]¢& -- uint8[]¢ ) lvar-4+10 "a" ( -- uint16& ) peekpp ( uint16& -- uint16 ) atindex ( uint8[]¢, int16 -- uint8& ) poke ( uint8, uint8& -- ) lvar-4+6 "a" ( -- uint16& ) peek ( uint16& -- uint16 ) lvar-6+8 "e" ( -- uint16& ) peek ( uint16& -- uint16 ) <= ( uint16, uint16 -- bool ) jp_z ( bool -- ) -> L665 jp ( -- ) -> L664 L665: call ei () 0 ( -- bool ) jp ( -- ) -> L661 L661: tor ( bool -- ) drop ( uint16 -- ) drop ( uint16 -- ) drop ( uint16 -- ) drop ( uint8[]¢ -- ) drop ( uint32 -- ) drop ( I2cBlockDevice¢ -- ) fromr ( -- bool ) } bool write_block ( I2cBlockDevice¢ fd, uint32 blk, uint8[]¢ bu ) { var I2cBlockDevice¢ fd var uint32 blk var uint8[]¢ bu var uint16 fpos var uint16 a var uint16 e local scope ANON var uint8 n lvar+2+0 "blk" ( -- uint32& ) lo ( uint32& -- uint16& ) peek ( uint16& -- uint16 ) lvar+6+2 "fd" ( -- I2cBlockDevice¢& ) peek ( I2cBlockDevice¢& -- I2cBlockDevice¢ ) item+9 "log2blocksize" ( -- uint8& ) peek ( uint8& -- uint8 ) cast ( uint8 -- int16 ) << ( uint16, int16 -- uint16 ) 0 ( -- uint16 ) lvar+0+4 "bu" ( -- uint8[]¢& ) peek ( uint8[]¢& -- uint8[]¢ ) count ( uint8[]¢ -- uint16 ) L667: lvar-4+6 "a" ( -- uint16& ) peek ( uint16& -- uint16 ) lvar-6+8 "e" ( -- uint16& ) peek ( uint16& -- uint16 ) < ( uint16, uint16 -- bool ) jp_z ( bool -- ) -> L668 lvar+6+6 "fd" ( -- I2cBlockDevice¢& ) peek ( I2cBlockDevice¢& -- I2cBlockDevice¢ ) item+17 "select_mask" ( -- uint8& ) peek ( uint8& -- uint8 ) call select ( uint8 ) lvar-2+6 "fpos" ( -- uint16& ) peek ( uint16& -- uint16 ) call start_writing ( uint16 -- bool ) jp_z ( bool -- ) -> L669 call ei () 3 ( -- OSErr ) call yes_with_error ( OSErr -- bool ) jp ( -- ) -> L666 L669: lvar+6+6 "fd" ( -- I2cBlockDevice¢& ) peek ( I2cBlockDevice¢& -- I2cBlockDevice¢ ) item+5 "blocksize" ( -- uint16& ) peek ( uint16& -- uint16 ) lvar-6+8 "e" ( -- uint16& ) peek ( uint16& -- uint16 ) lvar-4+10 "a" ( -- uint16& ) peek ( uint16& -- uint16 ) - ( uint16, uint16 -- uint16 ) call min ( uint16, uint16 -- uint16 ) cast ( uint16 -- uint8 ) lvar-8+8 "n" ( -- uint8& ) peek ( uint8& -- uint8 ) cast ( uint8 -- uint16 ) lvar-2+10 "fpos" ( -- uint16& ) += ( uint16, uint16& -- ) L671: lvar+0+8 "bu" ( -- uint8[]¢& ) peek ( uint8[]¢& -- uint8[]¢ ) lvar-4+10 "a" ( -- uint16& ) peekpp ( uint16& -- uint16 ) atindex ( uint8[]¢, int16 -- uint8& ) peek ( uint8& -- uint8 ) call writebyte ( uint8 -- bool ) jp_z ( bool -- ) -> L673 call ei () 2 ( -- OSErr ) call yes_with_error ( OSErr -- bool ) tor ( bool -- ) drop ( uint8 -- ) fromr ( -- bool ) jp ( -- ) -> L666 L673: lvar-8+8 "n" ( -- uint8& ) mmpeek ( uint8& -- uint8 ) !! ( uint8 -- bool ) jp_z ( bool -- ) -> L672 jp ( -- ) -> L671 L672: call send_end () call ei () drop ( uint8 -- ) jp ( -- ) -> L667 L668: 0 ( -- bool ) L666: tor ( bool -- ) drop ( uint16 -- ) drop ( uint16 -- ) drop ( uint16 -- ) drop ( uint8[]¢ -- ) drop ( uint32 -- ) drop ( I2cBlockDevice¢ -- ) fromr ( -- bool ) local scope ANON { } } I2cBlockDevice new ( uint8 select_mask, ucs1str¢ name ) { var uint8 select_mask var ucs1str¢ name var I2cBlockDevice this lvar+2+0 "select_mask" ( -- uint8& ) peek ( uint8& -- uint8 ) call select ( uint8 ) 0 ( -- uint16 ) call start_reading ( uint16 -- bool ) jp_z ( bool -- ) -> L659 call ei () NULL ( -- void* ) jp ( -- ) -> L658 L659: call send_end () call ei () 18 ( -- uint16 ) alloc ( uint16 -- I2cBlockDevice ) lvar-2+2 "this" ( -- I2cBlockDevice& ) peek ( I2cBlockDevice& -- I2cBlockDevice¢ ) 4 ( -- NodeType ) lvar+0+6 "name" ( -- ucs1str¢& ) peek ( ucs1str¢& -- ucs1str¢ ) gvar-2 "i2c_handlers" ( -- FD_Handlers& ) peek ( FD_Handlers& -- FD_Handlers¢ ) 6 ( -- uint8 ) 512 ( -- uint32 ) call init ( BlockDevice¢, NodeType, ucs1str¢, FD_Handlers¢, uint8, uint32 ) lvar+2+2 "select_mask" ( -- uint8& ) peek ( uint8& -- uint8 ) lvar-2+4 "this" ( -- I2cBlockDevice& ) peek ( I2cBlockDevice& -- I2cBlockDevice¢ ) item+17 "select_mask" ( -- uint8& ) poke ( uint8, uint8& -- ) lvar-2+2 "this" ( -- I2cBlockDevice& ) peek ( I2cBlockDevice& -- I2cBlockDevice¢ ) retain ( I2cBlockDevice¢ -- I2cBlockDevice ) tor ( I2cBlockDevice -- ) call! kill ( I2cBlockDevice -- I2cBlockDevice ) dispose ( I2cBlockDevice -- ) fromr ( -- I2cBlockDevice ) jp ( -- ) -> L658 L658: tor ( I2cBlockDevice -- ) drop ( ucs1str¢ -- ) drop ( uint8 -- ) fromr ( -- I2cBlockDevice ) } FD_Handlers new_i2c_handlers () { #assert FD_Handlers.getctl == 0 #assert FD_Handlers.setctl == 2 #assert FD_Handlers.avail_in == 4 #assert FD_Handlers.avail_out == 6 #assert FD_Handlers.getc == 8 #assert FD_Handlers.putc == 10 #assert FD_Handlers.read == 12 #assert FD_Handlers.write == 14 #assert FD_Handlers.read_block == 16 #assert FD_Handlers.write_block == 18 #assert FD_Handlers.kill == 20 #assert FD_Handlers.getfpos == 22 #assert FD_Handlers.setfpos == 24 p_enter dw ISTR dw 26 dw BlockDevice.getctl__11BlockDeviceC_5uint8_6uint16 dw BlockDevice.setctl__11BlockDeviceC_5uint8_6uint16_ dw no_avail_in__2FDC_6uint16 dw no_avail_in__2FDC_6uint16 ; avail_out dw no_avail_in__2FDC_6uint16 ; no_getc__2FDC_8ucs1char dw no_putc__2FDC_8ucs1char_ dw no_read__2FDC_5uint8ATOE_4bool dw no_read__2FDC_5uint8ATOE_4bool ; write dw I2cBlockDevice.read_block__14I2cBlockDeviceC_6uint32_5uint8AEC_4bool dw I2cBlockDevice.write_block__14I2cBlockDeviceC_6uint32_5uint8AEC_4bool dw FD.kill__2FDC_ dw no_getfpos__2FDC_6uint32 dw no_setfpos__2FDC_6uint32_4bool dw RETURN } } call new_i2c_handlers ( -- FD_Handlers ) gsinit "i2c_handlers"