gets.asm
来自「很少见的源码公开的msc51和z80的c编译器。」· 汇编 代码 · 共 275 行
ASM
275 行
;--------------------------------------------------------; File Created by SDCC : FreeWare ANSI-C Compiler; Version 2.3.0 Thu Sep 20 10:57:53 2001;-------------------------------------------------------- .module gets ;--------------------------------------------------------; Public variables in this module;-------------------------------------------------------- .globl _gets;--------------------------------------------------------; special function registers;--------------------------------------------------------;--------------------------------------------------------; special function bits ;--------------------------------------------------------;--------------------------------------------------------; internal ram data;-------------------------------------------------------- .area _DATA;--------------------------------------------------------; overlayable items in internal ram ;-------------------------------------------------------- .area _OVERLAY;--------------------------------------------------------; indirectly addressable internal ram data;-------------------------------------------------------- .area _ISEG;--------------------------------------------------------; bit data;-------------------------------------------------------- .area _BSEG;--------------------------------------------------------; external ram data;-------------------------------------------------------- .area _XSEG;--------------------------------------------------------; global & static initialisations;-------------------------------------------------------- .area _GSINIT .area _GSFINAL .area _GSINIT;--------------------------------------------------------; Home;-------------------------------------------------------- .area _HOME .area _CODE;--------------------------------------------------------; code;-------------------------------------------------------- .area _CODE; gets.c 3; genLabel; genFunction; ---------------------------------; Function gets; ---------------------------------___gets_start:_gets: lda sp,-3(sp); gets.c 5; genAssign; AOP_STK for _gets_count_1_1 lda hl,0(sp) ld (hl),#0x00 inc hl ld (hl),#0x00; gets.c 7; genLabel00109$:; gets.c 8; genCall; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0 call _getchar; AOP_STK for _gets_c_1_1 lda hl,2(sp) ld (hl),e; gets.c 9; genCmpEq; AOP_STK for _gets_c_1_1; genCmpEq: left 1, right 1, result 0 ld a,(hl) cp a,#0x08; Rule 5: Changed jump logic jp z,00103$00118$:; genCmpEq; AOP_STK for _gets_c_1_1; genCmpEq: left 1, right 1, result 0 lda hl,2(sp) ld a,(hl) cp a,#0x0A; Rule 5: Changed jump logic jp z,00104$00119$:; genCmpEq; AOP_STK for _gets_c_1_1; genCmpEq: left 1, right 1, result 0 lda hl,2(sp) ld a,(hl) cp a,#0x0D; Rule 5: Changed jump logic jp z,00104$00120$:; genGoto jp 00106$; gets.c 18; genLabel00103$:; gets.c 11; genIfx; AOP_STK for _gets_count_1_1 lda hl,0(sp) ld a,(hl+); Rule 8: Removed redundent or for (ix) or a,(hl) jp z,00109$; gets.c 12; genIpush; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0 ld a,#0x08 push af inc sp; genCall call _putchar lda sp,1(sp); gets.c 13; genIpush; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0 ld a,#0x20 push af inc sp; genCall call _putchar lda sp,1(sp); gets.c 14; genIpush; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0 ld a,#0x08 push af inc sp; genCall call _putchar lda sp,1(sp); gets.c 15; genAssign; AOP_STK for lda hl,5(sp) ld b,(hl) inc hl ld c,(hl); genMinus; AOP_STK for ld e,b ld d,c ld hl,#0x0001 ld a,e sub a,l ld e,a ld a,d sbc a,h lda hl,6(sp) ld (hl-),a ld (hl),e; gets.c 16; genMinus; AOP_STK for _gets_count_1_1 lda hl,0(sp) ld e,(hl) inc hl ld d,(hl) dec de dec hl ld (hl),e inc hl ld (hl),d; gets.c 18; genGoto jp 00109$; gets.c 21; genLabel00104$:; genIpush; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0 ld a,#0x0D push af inc sp; genCall call _putchar lda sp,1(sp); gets.c 22; genIpush; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0 ld a,#0x0A push af inc sp; genCall call _putchar lda sp,1(sp); gets.c 23; genAssign; AOP_STK for lda hl,5(sp) ld c,(hl) inc hl ld b,(hl); genAssign (pointer) ld a,#0x00 ld (bc),a; gets.c 24; genRet ld e,c ld d,b jp 00111$; gets.c 26; genLabel00106$:; genAssign; AOP_STK for lda hl,5(sp) ld c,(hl) inc hl ld b,(hl); genAssign (pointer); AOP_STK for _gets_c_1_1 lda hl,2(sp) ld a,(hl) ld (bc),a; genPlus; AOP_STK for ; genPlusIncr; Can't optimise plus by inc, falling back to the normal way ld hl,#0x0001 add hl,bc ld a,l ld d,h lda hl,5(sp) ld (hl+),a ld (hl),d; gets.c 27; genPlus; AOP_STK for _gets_count_1_1; genPlusIncr lda hl,0(sp) inc (hl) jr nz,00121$ inc hl inc (hl)00121$:; gets.c 28; genIpush; _saveRegsForCall: sendSetSize: 0 deInUse: 0 bcInUse: 0 deSending: 0; AOP_STK for _gets_c_1_1 lda hl,2(sp) ld a,(hl) push af inc sp; genCall call _putchar lda sp,1(sp); gets.c 30; genGoto jp 00109$; genLabel00111$:; genEndFunction lda sp,3(sp) ret___gets_end: .area _CODE
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?