* Ermittlung der Tastaturcodes output .TOS include "C:\TOSDEF.S" section text do_start pea titel call_gemdos Cconws addq.l #6,sp m_loop call_gemdos Crawcin addq.l #2,sp move.l d0,key cmp.b #$20,d0 bls.s m1 move.w d0,-(sp) * Zeichen ausgeben call_gemdos Cconout addq.l #4,sp m1 pea t_ascii * ASCII-Code call_gemdos Cconws addq.l #6,sp move.l key,d0 bsr.s out_num pea t_scan * SCAN-Code call_gemdos Cconws addq.l #6,sp move.l key,d0 swap d0 bsr.s out_num pea t_crsnl * CRLF call_gemdos Cconws addq.l #6,sp move.l key,d0 * Test auf ^C cmp.w #3,d0 bne.s m_loop call_gemdos Pterm0 * Programmende * Ausgabe von d0.b als Dezimal- und Hexzahl out_num move.w d0,d7 moveq.w #-1,d6 * Stellenz„hler o_dez1 and.l #$FF,d0 divu #10,d0 swap d0 add.w #'0',d0 move.w d0,-(sp) addq.w #1,d6 swap d0 tst.w d0 bne.s o_dez1 o_dez2 call_gemdos Cconout addq.l #4,sp dbf.w d6,o_dez2 move.w #$20,-(sp) * Leerzeichen call_gemdos Cconout addq.l #4,sp move.w #'$',-(sp) * Ausgabe Hexzahl call_gemdos Cconout addq.l #4,sp move.w d7,d0 lsr.b #4,d0 bsr.s o_hex1 move.w d7,d0 o_hex1 and.w #$F,d0 add.w #'0',d0 cmp.w #'9',d0 bls.s o_hex2 add.w #7,d0 o_hex2 move.w d0,-(sp) call_gemdos Cconout addq.l #4,sp rts section data titel dc.b 13,10,'Ermittlung der Tastencodes',13,10 dc.b '...Abbruch mit ^C',13,10 t_crsnl dc.b 13,10,0 t_ascii dc.b 9,'ASCII: ',0 t_scan dc.b 9,'SCAN: ',0 section bss key ds.l 1 ds.l 100 mystack ds.l 1