Line 3... |
Line 3... |
|
|
-------------------------------- Symbol Table --------------------------------
|
-------------------------------- Symbol Table --------------------------------
|
|
|
Symbol Value Decimal
|
Symbol Value Decimal
|
|
|
ccand : $0029 41
|
ccand : $0064 100
|
ccasl : $0099 153
|
ccasl : $00d4 212
|
ccasr : $008b 139
|
ccasr : $00c6 198
|
ccbcneg : $011c 284
|
ccbcneg : $0157 343
|
cccmp : $0056 86
|
cccmp : $0091 145
|
cccmpbcde : $012c 300
|
cccmpbcde : $0167 359
|
cccmp1 : $0063 99
|
cccmp1 : $009e 158
|
cccom : $00ac 172
|
cccom : $00e7 231
|
ccdeneg : $0114 276
|
ccdeneg : $014f 335
|
ccdiv : $00d3 211
|
ccdiv : $010e 270
|
ccdiv1 : $00e9 233
|
ccdiv1 : $0124 292
|
ccdiv2 : $0100 256
|
ccdiv2 : $013b 315
|
ccdiv3 : $0109 265
|
ccdiv3 : $0144 324
|
cceq : $0030 48
|
cceq : $006b 107
|
ccgchar : $0007 7
|
ccgchar : $0042 66
|
ccge : $004a 74
|
ccge : $0085 133
|
ccgint : $000d 13
|
ccgint : $0048 72
|
ccgt : $003c 60
|
ccgt : $0077 119
|
ccle : $0043 67
|
ccle : $007e 126
|
cclt : $0050 80
|
cclt : $008b 139
|
ccmult : $00b3 179
|
ccmult : $00ee 238
|
ccmult1 : $00b8 184
|
ccmult1 : $00f3 243
|
ccne : $0036 54
|
ccne : $0071 113
|
ccneg : $00a7 167
|
ccneg : $00e2 226
|
ccor : $001b 27
|
ccor : $0056 86
|
ccpchar : $0012 18
|
ccpchar : $004d 77
|
ccpint : $0015 21
|
ccpint : $0050 80
|
ccrdel : $0124 292
|
ccrdel : $015f 351
|
ccsub : $00a0 160
|
ccsub : $00db 219
|
ccsxt : $0008 8
|
ccsxt : $0043 67
|
ccucmp : $0080 128
|
ccucmp : $00bb 187
|
ccuge : $0066 102
|
ccuge : $00a1 161
|
ccugt : $0072 114
|
ccugt : $00ad 173
|
ccule : $0079 121
|
ccule : $00b4 180
|
ccult : $006c 108
|
ccult : $00a7 167
|
ccxor : $0022 34
|
ccxor : $005d 93
|
cc1 : $035c 860
|
cc1 : $03d0 976
|
cc10 : $027a 634
|
cc10 : $02bb 699
|
cc11 : $02cf 719
|
cc11 : $0310 784
|
cc12 : $02e1 737
|
cc12 : $0322 802
|
cc13 : $033f 831
|
cc13 : $03b1 945
|
cc14 : $035b 859
|
cc14 : $03cf 975
|
cc15 : $0358 856
|
cc15 : $03cc 972
|
cc2 : $0131 305
|
cc2 : $016c 364
|
cc3 : $0144 324
|
cc3 : $0181 385
|
cc4 : $016d 365
|
cc4 : $01ae 430
|
cc5 : $0171 369
|
cc5 : $01b2 434
|
cc6 : $0183 387
|
cc6 : $01c4 452
|
cc7 : $01b3 435
|
cc7 : $01f4 500
|
cc8 : $01e3 483
|
cc8 : $0224 548
|
cc9 : $0221 545
|
cc9 : $0262 610
|
__getbyte : $014f 335
|
__getbyte : $018c 396
|
__main : $02e3 739
|
__int0_isr : $0324 804
|
__nl : $0172 370
|
__main : $0330 816
|
__outint : $01f0 496
|
__nl : $01b3 435
|
__printdec : $01b4 436
|
__outint : $0231 561
|
__printhex : $0249 585
|
__printdec : $01f5 501
|
__printstr : $0183 387
|
__printhex : $028a 650
|
AS80 Assembler for i8080-Z180 [1.11]. Page 2
|
AS80 Assembler for i8080-Z180 [1.11]. Page 2
|
--------------------------------- HELLO.ASM ----------------------------------
|
--------------------------------- HELLO.ASM ----------------------------------
|
|
|
__rxbyte : $039e 926
|
__printstr : $01c4 452
|
__sendbyte : $0131 305
|
__rxbyte : $042c 1068
|
__tstary : $039f 927
|
__sendbyte : $016c 364
|
|
__tstary : $042d 1069
|
__8080__ : $0001 1
|
__8080__ : $0001 1
|
|
|
62 labels used
|
63 labels used
|
|
|
770 lines read, no errors in pass 1.
|
924 lines read, no errors in pass 1.
|
AS80 Assembler for i8080-Z180 [1.11]. Page 3
|
AS80 Assembler for i8080-Z180 [1.11]. Page 3
|
--------------------------------- HELLO.ASM ----------------------------------
|
--------------------------------- HELLO.ASM ----------------------------------
|
|
|
; <><><> Small-C V1.2 DOS--CP/M Cross Compiler <
|
; <><><> Small-C V1.2 DOS--CP/M Cross Compiler <
|
; <><><><><> CP/M Large String Space Version <><><
|
; <><><><><> CP/M Large String Space Version <><><
|
Line 83... |
Line 84... |
;
|
;
|
code
|
code
|
0000 = org #0000
|
0000 = org #0000
|
0000 : 21000c ld hl,3072
|
0000 : 21000c ld hl,3072
|
0003 : f9 ld sp,hl
|
0003 : f9 ld sp,hl
|
0004 : cde302 call __main
|
0004 : cd3003 call __main
|
;//---------------------------------------------------
|
;//---------------------------------------------------
|
;// Project: light8080 SOC WiCores Solutions
|
;// Project: light8080 SOC WiCores Solutions
|
;//
|
;//
|
;// File name: hello.c (February 04, 2012)
|
;// File name: hello.c (February 04, 2012)
|
;//
|
;//
|
;// Writer: Moti Litochevski
|
;// Writer: Moti Litochevski
|
;//
|
;//
|
;// Description:
|
;// Description:
|
;// This file contains a simple program written in Sm
|
;// This file contains a simple program written in Sm
|
;// the UART and then switches to echo received bytes
|
;// the UART and then switches to echo received bytes
|
|
;// This example also include a simple interrupt exam
|
|
;// verilog testbench. the testbench
|
;//
|
;//
|
;// Revision History:
|
;// Revision History:
|
;//
|
;//
|
;// Rev
|
;// Rev
|
;//
|
;//
|
;//---------------------------------------------------
|
;//---------------------------------------------------
|
|
;// define interrupt vectors
|
|
;// note that this file must be edited to enable inter
|
|
;#include intr_vec.h
|
|
;//---------------------------------------------------
|
|
;// Project: light8080 SOC WiCores Solutions
|
|
;//
|
|
;// File name: intr_vec.h (March 03, 2012)
|
|
;//
|
|
;// Writer: Moti Litochevski
|
|
;//
|
|
;// Description:
|
|
;// This file contains a simple example of calling in
|
|
;// file defines the interrupt vector for external in
|
|
;// 0x0008. the interrupts vectors addresses are set
|
|
;// controller "intr_ctrl.v" file.
|
|
;// Code is generated for all 4 supported external in
|
|
;// are not called.
|
|
;// On execution of an interrupt the CPU will automat
|
|
;// enable flag set by the EI instruction. the interr
|
|
;// enable the interrupts again after interrupt servi
|
|
;// nested interrupts just move the EI instruction to
|
|
;// call instruction to the service routine (see comm
|
|
;// Note that this code is not optimized in any way.
|
|
;// verify the interrupt mechanism of the light8080 C
|
|
;//
|
|
;// Revision History:
|
|
;//
|
|
;// Rev
|
|
;//
|
|
;//---------------------------------------------------
|
|
;// to support interrupt enable the respective interru
|
|
;// beginning of the output assembly file. only the in
|
|
;// should call a valid interrupt service routine name
|
|
;// C function name should be prefixed by "__".
|
|
;#asm
|
|
AS80 Assembler for i8080-Z180 [1.11]. Page 4
|
|
--------------------------------- HELLO.ASM ----------------------------------
|
|
|
|
;Preserve space for interrupt routines
|
|
;interrupt 0 vector
|
|
0008 = org #0008
|
|
0008 : f5 push af
|
|
0009 : c5 push bc
|
|
000a : d5 push de
|
|
000b : e5 push hl
|
|
; ei ; to enable nested interrupts uncomment this
|
|
000c : cd2403 call __int0_isr
|
|
000f : e1 pop hl
|
|
0010 : d1 pop de
|
|
0011 : c1 pop bc
|
|
0012 : f1 pop af
|
|
0013 : fb ei ; interrupt are not enabled during the execut
|
|
0014 : c9 ret
|
|
;interrupt 1 vector
|
|
0018 = org #0018
|
|
0018 : f5 push af
|
|
0019 : c5 push bc
|
|
001a : d5 push de
|
|
001b : e5 push hl
|
|
; call __int1_isr ; interrupt not used
|
|
001c : e1 pop hl
|
|
001d : d1 pop de
|
|
001e : c1 pop bc
|
|
001f : f1 pop af
|
|
0020 : fb ei
|
|
0021 : c9 ret
|
|
;interrupt 2 vector
|
|
0028 = org #0028
|
|
0028 : f5 push af
|
|
0029 : c5 push bc
|
|
002a : d5 push de
|
|
002b : e5 push hl
|
|
; call __int2_isr ; interrupt not used
|
|
002c : e1 pop hl
|
|
002d : d1 pop de
|
|
002e : c1 pop bc
|
|
002f : f1 pop af
|
|
0030 : fb ei
|
|
0031 : c9 ret
|
|
;interrupt 3 vector
|
|
0038 = org #0038
|
|
0038 : f5 push af
|
|
0039 : c5 push bc
|
|
003a : d5 push de
|
|
003b : e5 push hl
|
|
; call __int3_isr ; interrupt not used
|
|
003c : e1 pop hl
|
|
003d : d1 pop de
|
|
003e : c1 pop bc
|
|
003f : f1 pop af
|
|
0040 : fb ei
|
|
0041 : c9 ret
|
|
;//---------------------------------------------------
|
|
;// Th.. Th.. Th.. Thats all folks !!!
|
|
;//---------------------------------------------------
|
|
;// insert c80 assmbly library to the output file
|
;#include ..\tools\c80\c80.lib
|
;#include ..\tools\c80\c80.lib
|
;#asm
|
;#asm
|
;
|
;
|
;-----------------------------------------------------
|
;-----------------------------------------------------
|
|
AS80 Assembler for i8080-Z180 [1.11]. Page 5
|
|
--------------------------------- HELLO.ASM ----------------------------------
|
|
|
; Small-C Run-time Librray
|
; Small-C Run-time Librray
|
;
|
;
|
; V4d As of July 16, 1980 (gtf)
|
; V4d As of July 16, 1980 (gtf)
|
; Added EXIT() function
|
; Added EXIT() function
|
;-----------------------------------------------------
|
;-----------------------------------------------------
|
;
|
;
|
;Fetch a single byte from the address in HL and sign e
|
;Fetch a single byte from the address in HL and sign e
|
0007 : ccgchar:
|
0042 : ccgchar:
|
0007 : 7e ld a,(hl)
|
0042 : 7e ld a,(hl)
|
0008 : ccsxt:
|
0043 : ccsxt:
|
0008 : 6f ld l,a
|
0043 : 6f ld l,a
|
0009 : 07 rlca
|
0044 : 07 rlca
|
000a : 9f sbc a
|
0045 : 9f sbc a
|
000b : 67 ld h,a
|
0046 : 67 ld h,a
|
000c : c9 ret
|
0047 : c9 ret
|
;Fetch a full 16-bit integer from the address in HL
|
;Fetch a full 16-bit integer from the address in HL
|
000d : ccgint:
|
0048 : ccgint:
|
000d : 7e ld a,(hl)
|
0048 : 7e ld a,(hl)
|
000e : 23 inc hl
|
0049 : 23 inc hl
|
000f : 66 ld h,(hl)
|
004a : 66 ld h,(hl)
|
0010 : 6f ld l,a
|
004b : 6f ld l,a
|
0011 : c9 ret
|
004c : c9 ret
|
;Store a single byte from HL at the address in DE
|
;Store a single byte from HL at the address in DE
|
0012 : ccpchar:
|
004d : ccpchar:
|
0012 : 7d ld a,l
|
004d : 7d ld a,l
|
0013 : 12 ld (de),a
|
004e : 12 ld (de),a
|
0014 : c9 ret
|
004f : c9 ret
|
;Store a 16-bit integer in HL at the address in DE
|
;Store a 16-bit integer in HL at the address in DE
|
0015 : ccpint:
|
0050 : ccpint:
|
0015 : 7d ld a,l
|
0050 : 7d ld a,l
|
0016 : 12 ld (de),a
|
0051 : 12 ld (de),a
|
0017 : 13 inc de
|
0052 : 13 inc de
|
0018 : 7c ld a,h
|
0053 : 7c ld a,h
|
AS80 Assembler for i8080-Z180 [1.11]. Page 4
|
0054 : 12 ld (de),a
|
--------------------------------- HELLO.ASM ----------------------------------
|
0055 : c9 ret
|
|
|
0019 : 12 ld (de),a
|
|
001a : c9 ret
|
|
;Inclusive "or" HL and DE into HL
|
;Inclusive "or" HL and DE into HL
|
001b : ccor:
|
0056 : ccor:
|
001b : 7d ld a,l
|
0056 : 7d ld a,l
|
001c : b3 or e
|
0057 : b3 or e
|
001d : 6f ld l,a
|
0058 : 6f ld l,a
|
001e : 7c ld a,h
|
0059 : 7c ld a,h
|
001f : b2 or d
|
005a : b2 or d
|
0020 : 67 ld h,a
|
005b : 67 ld h,a
|
0021 : c9 ret
|
005c : c9 ret
|
;Exclusive "or" HL and DE into HL
|
;Exclusive "or" HL and DE into HL
|
0022 : ccxor:
|
005d : ccxor:
|
0022 : 7d ld a,l
|
005d : 7d ld a,l
|
0023 : ab xor e
|
005e : ab xor e
|
0024 : 6f ld l,a
|
005f : 6f ld l,a
|
0025 : 7c ld a,h
|
0060 : 7c ld a,h
|
0026 : aa xor d
|
0061 : aa xor d
|
0027 : 67 ld h,a
|
0062 : 67 ld h,a
|
0028 : c9 ret
|
0063 : c9 ret
|
;"And" HL and DE into HL
|
;"And" HL and DE into HL
|
0029 : ccand:
|
0064 : ccand:
|
0029 : 7d ld a,l
|
0064 : 7d ld a,l
|
002a : a3 and e
|
0065 : a3 and e
|
002b : 6f ld l,a
|
0066 : 6f ld l,a
|
002c : 7c ld a,h
|
0067 : 7c ld a,h
|
002d : a2 and d
|
0068 : a2 and d
|
002e : 67 ld h,a
|
0069 : 67 ld h,a
|
002f : c9 ret
|
006a : c9 ret
|
|
AS80 Assembler for i8080-Z180 [1.11]. Page 6
|
|
--------------------------------- HELLO.ASM ----------------------------------
|
|
|
;Test if HL = DE and set HL = 1 if true else 0
|
;Test if HL = DE and set HL = 1 if true else 0
|
0030 : cceq:
|
006b : cceq:
|
0030 : cd5600 call cccmp
|
006b : cd9100 call cccmp
|
0033 : c8 ret z
|
006e : c8 ret z
|
0034 : 2b dec hl
|
006f : 2b dec hl
|
0035 : c9 ret
|
0070 : c9 ret
|
;Test if DE ~= HL
|
;Test if DE ~= HL
|
0036 : ccne:
|
0071 : ccne:
|
0036 : cd5600 call cccmp
|
0071 : cd9100 call cccmp
|
0039 : c0 ret nz
|
0074 : c0 ret nz
|
003a : 2b dec hl
|
0075 : 2b dec hl
|
003b : c9 ret
|
0076 : c9 ret
|
;Test if DE > HL (signed)
|
;Test if DE > HL (signed)
|
003c : ccgt:
|
0077 : ccgt:
|
003c : eb ex de,hl
|
0077 : eb ex de,hl
|
003d : cd5600 call cccmp
|
0078 : cd9100 call cccmp
|
0040 : d8 ret c
|
007b : d8 ret c
|
0041 : 2b dec hl
|
007c : 2b dec hl
|
0042 : c9 ret
|
007d : c9 ret
|
;Test if DE <= HL (signed)
|
;Test if DE <= HL (signed)
|
0043 : ccle:
|
007e : ccle:
|
0043 : cd5600 call cccmp
|
007e : cd9100 call cccmp
|
0046 : c8 ret z
|
0081 : c8 ret z
|
0047 : d8 ret c
|
0082 : d8 ret c
|
0048 : 2b dec hl
|
0083 : 2b dec hl
|
0049 : c9 ret
|
0084 : c9 ret
|
;Test if DE >= HL (signed)
|
;Test if DE >= HL (signed)
|
004a : ccge:
|
0085 : ccge:
|
004a : cd5600 call cccmp
|
0085 : cd9100 call cccmp
|
004d : d0 ret nc
|
0088 : d0 ret nc
|
004e : 2b dec hl
|
0089 : 2b dec hl
|
004f : c9 ret
|
008a : c9 ret
|
;Test if DE < HL (signed)
|
;Test if DE < HL (signed)
|
AS80 Assembler for i8080-Z180 [1.11]. Page 5
|
008b : cclt:
|
--------------------------------- HELLO.ASM ----------------------------------
|
008b : cd9100 call cccmp
|
|
008e : d8 ret c
|
0050 : cclt:
|
008f : 2b dec hl
|
0050 : cd5600 call cccmp
|
0090 : c9 ret
|
0053 : d8 ret c
|
|
0054 : 2b dec hl
|
|
0055 : c9 ret
|
|
; Signed compare of DE and HL
|
; Signed compare of DE and HL
|
; Performs DE - HL and sets the conditions:
|
; Performs DE - HL and sets the conditions:
|
; Carry reflects sign of difference (set means DE < HL
|
; Carry reflects sign of difference (set means DE < HL
|
; Zero/non-zero set according to equality.
|
; Zero/non-zero set according to equality.
|
0056 : cccmp:
|
0091 : cccmp:
|
0056 : 7b ld a,e
|
0091 : 7b ld a,e
|
0057 : 95 sub l
|
0092 : 95 sub l
|
0058 : 5f ld e,a
|
0093 : 5f ld e,a
|
0059 : 7a ld a,d
|
0094 : 7a ld a,d
|
005a : 9c sbc h
|
0095 : 9c sbc h
|
005b : 210100 ld hl,1
|
0096 : 210100 ld hl,1
|
005e : fa6300 jp m,cccmp1
|
0099 : fa9e00 jp m,cccmp1
|
0061 : b3 or e ;"OR" resets carry
|
009c : b3 or e ;"OR" resets carry
|
0062 : c9 ret
|
009d : c9 ret
|
0063 : cccmp1:
|
009e : cccmp1:
|
0063 : b3 or e
|
009e : b3 or e
|
0064 : 37 scf ;set carry to signal minus
|
009f : 37 scf ;set carry to signal minus
|
0065 : c9 ret
|
00a0 : c9 ret
|
;Test if DE >= HL (unsigned)
|
;Test if DE >= HL (unsigned)
|
0066 : ccuge:
|
00a1 : ccuge:
|
0066 : cd8000 call ccucmp
|
00a1 : cdbb00 call ccucmp
|
0069 : d0 ret nc
|
00a4 : d0 ret nc
|
006a : 2b dec hl
|
00a5 : 2b dec hl
|
006b : c9 ret
|
00a6 : c9 ret
|
|
AS80 Assembler for i8080-Z180 [1.11]. Page 7
|
|
--------------------------------- HELLO.ASM ----------------------------------
|
|
|
;Test if DE < HL (unsigned)
|
;Test if DE < HL (unsigned)
|
006c : ccult:
|
00a7 : ccult:
|
006c : cd8000 call ccucmp
|
00a7 : cdbb00 call ccucmp
|
006f : d8 ret c
|
00aa : d8 ret c
|
0070 : 2b dec hl
|
00ab : 2b dec hl
|
0071 : c9 ret
|
00ac : c9 ret
|
;Test if DE > HL (unsigned)
|
;Test if DE > HL (unsigned)
|
0072 : ccugt:
|
00ad : ccugt:
|
0072 : eb ex de,hl
|
00ad : eb ex de,hl
|
0073 : cd8000 call ccucmp
|
00ae : cdbb00 call ccucmp
|
0076 : d8 ret c
|
00b1 : d8 ret c
|
0077 : 2b dec hl
|
00b2 : 2b dec hl
|
0078 : c9 ret
|
00b3 : c9 ret
|
;Test if DE <= HL (unsigned)
|
;Test if DE <= HL (unsigned)
|
0079 : ccule:
|
00b4 : ccule:
|
0079 : cd8000 call ccucmp
|
00b4 : cdbb00 call ccucmp
|
007c : c8 ret z
|
00b7 : c8 ret z
|
007d : d8 ret c
|
00b8 : d8 ret c
|
007e : 2b dec hl
|
00b9 : 2b dec hl
|
007f : c9 ret
|
00ba : c9 ret
|
;Routine to perform unsigned compare
|
;Routine to perform unsigned compare
|
;carry set if DE < HL
|
;carry set if DE < HL
|
;zero/nonzero set accordingly
|
;zero/nonzero set accordingly
|
0080 : ccucmp:
|
00bb : ccucmp:
|
0080 : 7a ld a,d
|
00bb : 7a ld a,d
|
0081 : bc cp h
|
00bc : bc cp h
|
0082 : c28700 jp nz,$+5
|
00bd : c2c200 jp nz,$+5
|
0085 : 7b ld a,e
|
00c0 : 7b ld a,e
|
0086 : bd cp l
|
00c1 : bd cp l
|
0087 : 210100 ld hl,1
|
00c2 : 210100 ld hl,1
|
008a : c9 ret
|
00c5 : c9 ret
|
;Shift DE arithmetically right by HL and return in HL
|
;Shift DE arithmetically right by HL and return in HL
|
008b : ccasr:
|
00c6 : ccasr:
|
AS80 Assembler for i8080-Z180 [1.11]. Page 6
|
00c6 : eb ex de,hl
|
--------------------------------- HELLO.ASM ----------------------------------
|
00c7 : 7c ld a,h
|
|
00c8 : 17 rla
|
008b : eb ex de,hl
|
00c9 : 7c ld a,h
|
008c : 7c ld a,h
|
00ca : 1f rra
|
008d : 17 rla
|
00cb : 67 ld h,a
|
008e : 7c ld a,h
|
00cc : 7d ld a,l
|
008f : 1f rra
|
00cd : 1f rra
|
0090 : 67 ld h,a
|
00ce : 6f ld l,a
|
0091 : 7d ld a,l
|
00cf : 1d dec e
|
0092 : 1f rra
|
00d0 : c2c700 jp nz,ccasr+1
|
0093 : 6f ld l,a
|
00d3 : c9 ret
|
0094 : 1d dec e
|
|
0095 : c28c00 jp nz,ccasr+1
|
|
0098 : c9 ret
|
|
;Shift DE arithmetically left by HL and return in HL
|
;Shift DE arithmetically left by HL and return in HL
|
0099 : ccasl:
|
00d4 : ccasl:
|
0099 : eb ex de,hl
|
00d4 : eb ex de,hl
|
009a : 29 add hl,hl
|
00d5 : 29 add hl,hl
|
009b : 1d dec e
|
00d6 : 1d dec e
|
009c : c29a00 jp nz,ccasl+1
|
00d7 : c2d500 jp nz,ccasl+1
|
009f : c9 ret
|
00da : c9 ret
|
;Subtract HL from DE and return in HL
|
;Subtract HL from DE and return in HL
|
00a0 : ccsub:
|
00db : ccsub:
|
00a0 : 7b ld a,e
|
00db : 7b ld a,e
|
00a1 : 95 sub l
|
00dc : 95 sub l
|
00a2 : 6f ld l,a
|
00dd : 6f ld l,a
|
00a3 : 7a ld a,d
|
00de : 7a ld a,d
|
00a4 : 9c sbc h
|
00df : 9c sbc h
|
00a5 : 67 ld h,a
|
00e0 : 67 ld h,a
|
00a6 : c9 ret
|
00e1 : c9 ret
|
;Form the two's complement of HL
|
;Form the two's complement of HL
|
00a7 : ccneg:
|
AS80 Assembler for i8080-Z180 [1.11]. Page 8
|
00a7 : cdac00 call cccom
|
|
00aa : 23 inc hl
|
|
00ab : c9 ret
|
|
;Form the one's complement of HL
|
|
00ac : cccom:
|
|
00ac : 7c ld a,h
|
|
00ad : 2f cpl
|
|
00ae : 67 ld h,a
|
|
00af : 7d ld a,l
|
|
00b0 : 2f cpl
|
|
00b1 : 6f ld l,a
|
|
00b2 : c9 ret
|
|
;Multiply DE by HL and return in HL
|
|
00b3 : ccmult:
|
|
00b3 : 44 ld b,h
|
|
00b4 : 4d ld c,l
|
|
00b5 : 210000 ld hl,0
|
|
00b8 : ccmult1:
|
|
00b8 : 79 ld a,c
|
|
00b9 : 0f rrca
|
|
00ba : d2be00 jp nc,$+4
|
|
00bd : 19 add hl,de
|
|
00be : af xor a
|
|
00bf : 78 ld a,b
|
|
00c0 : 1f rra
|
|
00c1 : 47 ld b,a
|
|
00c2 : 79 ld a,c
|
|
00c3 : 1f rra
|
|
00c4 : 4f ld c,a
|
|
00c5 : b0 or b
|
|
00c6 : c8 ret z
|
|
00c7 : af xor a
|
|
AS80 Assembler for i8080-Z180 [1.11]. Page 7
|
|
--------------------------------- HELLO.ASM ----------------------------------
|
--------------------------------- HELLO.ASM ----------------------------------
|
|
|
00c8 : 7b ld a,e
|
00e2 : ccneg:
|
00c9 : 17 rla
|
00e2 : cde700 call cccom
|
00ca : 5f ld e,a
|
00e5 : 23 inc hl
|
00cb : 7a ld a,d
|
00e6 : c9 ret
|
00cc : 17 rla
|
;Form the one's complement of HL
|
00cd : 57 ld d,a
|
00e7 : cccom:
|
00ce : b3 or e
|
00e7 : 7c ld a,h
|
00cf : c8 ret z
|
00e8 : 2f cpl
|
00d0 : c3b800 jp ccmult1
|
00e9 : 67 ld h,a
|
|
00ea : 7d ld a,l
|
|
00eb : 2f cpl
|
|
00ec : 6f ld l,a
|
|
00ed : c9 ret
|
|
;Multiply DE by HL and return in HL
|
|
00ee : ccmult:
|
|
00ee : 44 ld b,h
|
|
00ef : 4d ld c,l
|
|
00f0 : 210000 ld hl,0
|
|
00f3 : ccmult1:
|
|
00f3 : 79 ld a,c
|
|
00f4 : 0f rrca
|
|
00f5 : d2f900 jp nc,$+4
|
|
00f8 : 19 add hl,de
|
|
00f9 : af xor a
|
|
00fa : 78 ld a,b
|
|
00fb : 1f rra
|
|
00fc : 47 ld b,a
|
|
00fd : 79 ld a,c
|
|
00fe : 1f rra
|
|
00ff : 4f ld c,a
|
|
0100 : b0 or b
|
|
0101 : c8 ret z
|
|
0102 : af xor a
|
|
0103 : 7b ld a,e
|
|
0104 : 17 rla
|
|
0105 : 5f ld e,a
|
|
0106 : 7a ld a,d
|
|
0107 : 17 rla
|
|
0108 : 57 ld d,a
|
|
0109 : b3 or e
|
|
010a : c8 ret z
|
|
010b : c3f300 jp ccmult1
|
;Divide DE by HL and return quotient in HL, remainder
|
;Divide DE by HL and return quotient in HL, remainder
|
00d3 : ccdiv:
|
010e : ccdiv:
|
00d3 : 44 ld b,h
|
010e : 44 ld b,h
|
00d4 : 4d ld c,l
|
010f : 4d ld c,l
|
00d5 : 7a ld a,d
|
0110 : 7a ld a,d
|
00d6 : a8 xor b
|
0111 : a8 xor b
|
00d7 : f5 push af
|
0112 : f5 push af
|
00d8 : 7a ld a,d
|
0113 : 7a ld a,d
|
00d9 : b7 or a
|
0114 : b7 or a
|
00da : fc1401 call m,ccdeneg
|
0115 : fc4f01 call m,ccdeneg
|
00dd : 78 ld a,b
|
0118 : 78 ld a,b
|
00de : b7 or a
|
0119 : b7 or a
|
00df : fc1c01 call m,ccbcneg
|
011a : fc5701 call m,ccbcneg
|
00e2 : 3e10 ld a,16
|
011d : 3e10 ld a,16
|
00e4 : f5 push af
|
011f : f5 push af
|
00e5 : eb ex de,hl
|
0120 : eb ex de,hl
|
00e6 : 110000 ld de,0
|
0121 : 110000 ld de,0
|
00e9 : ccdiv1:
|
0124 : ccdiv1:
|
00e9 : 29 add hl,hl
|
0124 : 29 add hl,hl
|
00ea : cd2401 call ccrdel
|
0125 : cd5f01 call ccrdel
|
00ed : ca0001 jp z,ccdiv2
|
AS80 Assembler for i8080-Z180 [1.11]. Page 9
|
00f0 : cd2c01 call cccmpbcde
|
|
00f3 : fa0001 jp m,ccdiv2
|
|
00f6 : 7d ld a,l
|
|
00f7 : f601 or 1
|
|
00f9 : 6f ld l,a
|
|
00fa : 7b ld a,e
|
|
00fb : 91 sub c
|
|
00fc : 5f ld e,a
|
|
00fd : 7a ld a,d
|
|
00fe : 98 sbc b
|
|
00ff : 57 ld d,a
|
|
0100 : ccdiv2:
|
|
0100 : f1 pop af
|
|
0101 : 3d dec a
|
|
0102 : ca0901 jp z,ccdiv3
|
|
0105 : f5 push af
|
|
0106 : c3e900 jp ccdiv1
|
|
0109 : ccdiv3:
|
|
0109 : f1 pop af
|
|
010a : f0 ret p
|
|
010b : cd1401 call ccdeneg
|
|
010e : eb ex de,hl
|
|
010f : cd1401 call ccdeneg
|
|
0112 : eb ex de,hl
|
|
0113 : c9 ret
|
|
0114 : ccdeneg:
|
|
0114 : 7a ld a,d
|
|
0115 : 2f cpl
|
|
0116 : 57 ld d,a
|
|
0117 : 7b ld a,e
|
|
0118 : 2f cpl
|
|
0119 : 5f ld e,a
|
|
AS80 Assembler for i8080-Z180 [1.11]. Page 8
|
|
--------------------------------- HELLO.ASM ----------------------------------
|
--------------------------------- HELLO.ASM ----------------------------------
|
|
|
011a : 13 inc de
|
0128 : ca3b01 jp z,ccdiv2
|
011b : c9 ret
|
012b : cd6701 call cccmpbcde
|
011c : ccbcneg:
|
012e : fa3b01 jp m,ccdiv2
|
011c : 78 ld a,b
|
0131 : 7d ld a,l
|
011d : 2f cpl
|
0132 : f601 or 1
|
011e : 47 ld b,a
|
0134 : 6f ld l,a
|
011f : 79 ld a,c
|
0135 : 7b ld a,e
|
0120 : 2f cpl
|
0136 : 91 sub c
|
0121 : 4f ld c,a
|
0137 : 5f ld e,a
|
0122 : 03 inc bc
|
0138 : 7a ld a,d
|
0123 : c9 ret
|
0139 : 98 sbc b
|
0124 : ccrdel:
|
013a : 57 ld d,a
|
0124 : 7b ld a,e
|
013b : ccdiv2:
|
0125 : 17 rla
|
013b : f1 pop af
|
0126 : 5f ld e,a
|
013c : 3d dec a
|
0127 : 7a ld a,d
|
013d : ca4401 jp z,ccdiv3
|
0128 : 17 rla
|
0140 : f5 push af
|
0129 : 57 ld d,a
|
0141 : c32401 jp ccdiv1
|
012a : b3 or e
|
0144 : ccdiv3:
|
012b : c9 ret
|
0144 : f1 pop af
|
012c : cccmpbcde:
|
0145 : f0 ret p
|
012c : 7b ld a,e
|
0146 : cd4f01 call ccdeneg
|
012d : 91 sub c
|
0149 : eb ex de,hl
|
012e : 7a ld a,d
|
014a : cd4f01 call ccdeneg
|
012f : 98 sbc b
|
014d : eb ex de,hl
|
0130 : c9 ret
|
014e : c9 ret
|
|
014f : ccdeneg:
|
|
014f : 7a ld a,d
|
|
0150 : 2f cpl
|
|
0151 : 57 ld d,a
|
|
0152 : 7b ld a,e
|
|
0153 : 2f cpl
|
|
0154 : 5f ld e,a
|
|
0155 : 13 inc de
|
|
0156 : c9 ret
|
|
0157 : ccbcneg:
|
|
0157 : 78 ld a,b
|
|
0158 : 2f cpl
|
|
0159 : 47 ld b,a
|
|
015a : 79 ld a,c
|
|
015b : 2f cpl
|
|
015c : 4f ld c,a
|
|
015d : 03 inc bc
|
|
015e : c9 ret
|
|
015f : ccrdel:
|
|
015f : 7b ld a,e
|
|
0160 : 17 rla
|
|
0161 : 5f ld e,a
|
|
0162 : 7a ld a,d
|
|
0163 : 17 rla
|
|
0164 : 57 ld d,a
|
|
0165 : b3 or e
|
|
0166 : c9 ret
|
|
0167 : cccmpbcde:
|
|
0167 : 7b ld a,e
|
|
0168 : 91 sub c
|
|
0169 : 7a ld a,d
|
|
016a : 98 sbc b
|
|
016b : c9 ret
|
;// UART IO registers
|
;// UART IO registers
|
;port (128) UDATA; // uart data register used for bot
|
;port (128) UDATA; // uart data register used for bot
|
;port (129) UBAUDL; // low byte of baud rate register
|
;port (129) UBAUDL; // low byte of baud rate register
|
|
AS80 Assembler for i8080-Z180 [1.11]. Page 10
|
|
--------------------------------- HELLO.ASM ----------------------------------
|
|
|
;port (130) UBAUDH; // low byte of baud rate register
|
;port (130) UBAUDH; // low byte of baud rate register
|
;port (131) USTAT; // uart status register
|
;port (131) USTAT; // uart status register
|
;// digital IO ports registers
|
;// digital IO ports registers
|
;port (132) P1REG; // output port1 - used as firs
|
;port (132) P1DATA; // port 1 data register
|
;port (133) P2REG; // output port2 - used as low digi
|
;port (133) P1DIR; // port 1 direction register contr
|
;port (134) P3REG; // output port3 - used as high dig
|
;port (134) P2DATA; // port 2 data register
|
;port (135) P4REG; // output port4
|
;port (135) P2DIR; // port 2 direction register contr
|
|
;// interrupt controller register
|
|
;port (136) INTRENA; // interrupts enable register
|
;// simulation end register
|
;// simulation end register
|
;// writing any value to this port will end the verilo
|
;// writing any value to this port will end the verilo
|
;// test bench.
|
;// test bench.
|
;port (255) SIMEND;
|
;port (255) SIMEND;
|
;// registers bit fields definition
|
;// registers bit fields definition
|
Line 450... |
Line 554... |
;char rxbyte; // byte received from the uart
|
;char rxbyte; // byte received from the uart
|
;int tstary[2] = {1234, 5678};
|
;int tstary[2] = {1234, 5678};
|
;//---------------------------------------------------
|
;//---------------------------------------------------
|
;// send a single byte to the UART
|
;// send a single byte to the UART
|
;sendbyte(by)
|
;sendbyte(by)
|
0131 : __sendbyte:
|
016c : __sendbyte:
|
;char by;
|
;char by;
|
;{
|
;{
|
; while (USTAT & UTXBUSY);
|
; while (USTAT & UTXBUSY);
|
0131 : cc2:
|
016c : cc2:
|
0131 : db83 in a,(131)
|
016c : db83 in a,(131)
|
0133 : cf call ccsxt
|
016e : cd4300 call ccsxt
|
0134 : e5 push hl
|
0171 : e5 push hl
|
0135 : 210100 ld hl,1
|
0172 : 210100 ld hl,1
|
0138 : d1 pop de
|
0175 : d1 pop de
|
0139 : cd2900 call ccand
|
0176 : cd6400 call ccand
|
013c : 7c ld a,h
|
0179 : 7c ld a,h
|
AS80 Assembler for i8080-Z180 [1.11]. Page 9
|
017a : b5 or l
|
--------------------------------- HELLO.ASM ----------------------------------
|
017b : ca8101 jp z,cc3
|
|
017e : c36c01 jp cc2
|
013d : b5 or l
|
0181 : cc3:
|
013e : ca4401 jp z,cc3
|
|
0141 : c33101 jp cc2
|
|
0144 : cc3:
|
|
; UDATA = by;
|
; UDATA = by;
|
0144 : 210200 ld hl,2
|
0181 : 210200 ld hl,2
|
0147 : 39 add hl,sp
|
0184 : 39 add hl,sp
|
0148 : cd0700 call ccgchar
|
0185 : cd4200 call ccgchar
|
014b : 7d ld a,l
|
0188 : 7d ld a,l
|
014c : d380 out (128),a
|
0189 : d380 out (128),a
|
|
|
;}
|
;}
|
014e : c9 ret
|
018b : c9 ret
|
;// check if a byte was received by the uart
|
;// check if a byte was received by the uart
|
;getbyte()
|
;getbyte()
|
014f : __getbyte:
|
018c : __getbyte:
|
;{
|
;{
|
; if (USTAT & URXFULL) {
|
; if (USTAT & URXFULL) {
|
014f : db83 in a,(131)
|
018c : db83 in a,(131)
|
0151 : cf call ccsxt
|
018e : cd4300 call ccsxt
|
0152 : e5 push hl
|
0191 : e5 push hl
|
0153 : 211000 ld hl,16
|
0192 : 211000 ld hl,16
|
0156 : d1 pop de
|
0195 : d1 pop de
|
0157 : cd2900 call ccand
|
0196 : cd6400 call ccand
|
015a : 7c ld a,h
|
0199 : 7c ld a,h
|
015b : b5 or l
|
019a : b5 or l
|
015c : ca6d01 jp z,cc4
|
019b : caae01 jp z,cc4
|
|
AS80 Assembler for i8080-Z180 [1.11]. Page 11
|
|
--------------------------------- HELLO.ASM ----------------------------------
|
|
|
; rxbyte = UDATA;
|
; rxbyte = UDATA;
|
015f : db80 in a,(128)
|
019e : db80 in a,(128)
|
0161 : cf call ccsxt
|
01a0 : cd4300 call ccsxt
|
0162 : 7d ld a,l
|
01a3 : 7d ld a,l
|
0163 : 329e03 ld (__rxbyte),a
|
01a4 : 322c04 ld (__rxbyte),a
|
; return 1;
|
; return 1;
|
0166 : 210100 ld hl,1
|
01a7 : 210100 ld hl,1
|
0169 : c9 ret
|
01aa : c9 ret
|
; }
|
; }
|
; else
|
; else
|
016a : c37101 jp cc5
|
01ab : c3b201 jp cc5
|
016d : cc4:
|
01ae : cc4:
|
; return 0;
|
; return 0;
|
016d : 210000 ld hl,0
|
01ae : 210000 ld hl,0
|
0170 : c9 ret
|
01b1 : c9 ret
|
0171 : cc5:
|
01b2 : cc5:
|
;}
|
;}
|
0171 : c9 ret
|
01b2 : c9 ret
|
;// send new line to the UART
|
;// send new line to the UART
|
;nl()
|
;nl()
|
0172 : __nl:
|
01b3 : __nl:
|
;{
|
;{
|
; sendbyte(13);
|
; sendbyte(13);
|
0172 : 210d00 ld hl,13
|
01b3 : 210d00 ld hl,13
|
0175 : e5 push hl
|
01b6 : e5 push hl
|
0176 : cd3101 call __sendbyte
|
01b7 : cd6c01 call __sendbyte
|
0179 : c1 pop bc
|
01ba : c1 pop bc
|
; sendbyte(10);
|
; sendbyte(10);
|
017a : 210a00 ld hl,10
|
01bb : 210a00 ld hl,10
|
017d : e5 push hl
|
01be : e5 push hl
|
017e : cd3101 call __sendbyte
|
01bf : cd6c01 call __sendbyte
|
0181 : c1 pop bc
|
01c2 : c1 pop bc
|
;}
|
;}
|
0182 : c9 ret
|
01c3 : c9 ret
|
;// sends a string to the UART
|
;// sends a string to the UART
|
AS80 Assembler for i8080-Z180 [1.11]. Page 10
|
|
--------------------------------- HELLO.ASM ----------------------------------
|
|
|
|
;printstr(sptr)
|
;printstr(sptr)
|
0183 : __printstr:
|
01c4 : __printstr:
|
;char *sptr;
|
;char *sptr;
|
;{
|
;{
|
; while (*sptr != 0)
|
; while (*sptr != 0)
|
0183 : cc6:
|
01c4 : cc6:
|
0183 : 210200 ld hl,2
|
01c4 : 210200 ld hl,2
|
0186 : 39 add hl,sp
|
01c7 : 39 add hl,sp
|
0187 : cd0d00 call ccgint
|
01c8 : cd4800 call ccgint
|
018a : cd0700 call ccgchar
|
01cb : cd4200 call ccgchar
|
018d : e5 push hl
|
01ce : e5 push hl
|
018e : 210000 ld hl,0
|
01cf : 210000 ld hl,0
|
0191 : d1 pop de
|
01d2 : d1 pop de
|
0192 : cd3600 call ccne
|
01d3 : cd7100 call ccne
|
0195 : 7c ld a,h
|
01d6 : 7c ld a,h
|
0196 : b5 or l
|
01d7 : b5 or l
|
0197 : cab301 jp z,cc7
|
01d8 : caf401 jp z,cc7
|
; sendbyte(*sptr++);
|
; sendbyte(*sptr++);
|
019a : 210200 ld hl,2
|
01db : 210200 ld hl,2
|
019d : 39 add hl,sp
|
01de : 39 add hl,sp
|
019e : e5 push hl
|
01df : e5 push hl
|
019f : cd0d00 call ccgint
|
01e0 : cd4800 call ccgint
|
01a2 : 23 inc hl
|
01e3 : 23 inc hl
|
01a3 : d1 pop de
|
01e4 : d1 pop de
|
01a4 : cd1500 call ccpint
|
01e5 : cd5000 call ccpint
|
01a7 : 2b dec hl
|
01e8 : 2b dec hl
|
01a8 : cd0700 call ccgchar
|
01e9 : cd4200 call ccgchar
|
01ab : e5 push hl
|
AS80 Assembler for i8080-Z180 [1.11]. Page 12
|
01ac : cd3101 call __sendbyte
|
--------------------------------- HELLO.ASM ----------------------------------
|
01af : c1 pop bc
|
|
01b0 : c38301 jp cc6
|
01ec : e5 push hl
|
01b3 : cc7:
|
01ed : cd6c01 call __sendbyte
|
|
01f0 : c1 pop bc
|
|
01f1 : c3c401 jp cc6
|
|
01f4 : cc7:
|
;}
|
;}
|
01b3 : c9 ret
|
01f4 : c9 ret
|
;// sends a decimal value to the UART
|
;// sends a decimal value to the UART
|
;printdec(dval)
|
;printdec(dval)
|
01b4 : __printdec:
|
01f5 : __printdec:
|
;int dval;
|
;int dval;
|
;{
|
;{
|
; if (dval<0) {
|
; if (dval<0) {
|
01b4 : 210200 ld hl,2
|
01f5 : 210200 ld hl,2
|
01b7 : 39 add hl,sp
|
01f8 : 39 add hl,sp
|
01b8 : cd0d00 call ccgint
|
01f9 : cd4800 call ccgint
|
01bb : e5 push hl
|
01fc : e5 push hl
|
01bc : 210000 ld hl,0
|
01fd : 210000 ld hl,0
|
01bf : d1 pop de
|
0200 : d1 pop de
|
01c0 : cd5000 call cclt
|
0201 : cd8b00 call cclt
|
01c3 : 7c ld a,h
|
0204 : 7c ld a,h
|
01c4 : b5 or l
|
0205 : b5 or l
|
01c5 : cae301 jp z,cc8
|
0206 : ca2402 jp z,cc8
|
; sendbyte('-');
|
; sendbyte('-');
|
01c8 : 212d00 ld hl,45
|
0209 : 212d00 ld hl,45
|
01cb : e5 push hl
|
020c : e5 push hl
|
01cc : cd3101 call __sendbyte
|
020d : cd6c01 call __sendbyte
|
01cf : c1 pop bc
|
0210 : c1 pop bc
|
; dval = -dval;
|
; dval = -dval;
|
01d0 : 210200 ld hl,2
|
0211 : 210200 ld hl,2
|
01d3 : 39 add hl,sp
|
0214 : 39 add hl,sp
|
01d4 : e5 push hl
|
0215 : e5 push hl
|
01d5 : 210400 ld hl,4
|
0216 : 210400 ld hl,4
|
01d8 : 39 add hl,sp
|
0219 : 39 add hl,sp
|
01d9 : cd0d00 call ccgint
|
021a : cd4800 call ccgint
|
AS80 Assembler for i8080-Z180 [1.11]. Page 11
|
021d : cde200 call ccneg
|
--------------------------------- HELLO.ASM ----------------------------------
|
0220 : d1 pop de
|
|
0221 : cd5000 call ccpint
|
01dc : cda700 call ccneg
|
|
01df : d1 pop de
|
|
01e0 : cd1500 call ccpint
|
|
; }
|
; }
|
; outint(dval);
|
; outint(dval);
|
01e3 : cc8:
|
0224 : cc8:
|
01e3 : 210200 ld hl,2
|
0224 : 210200 ld hl,2
|
01e6 : 39 add hl,sp
|
0227 : 39 add hl,sp
|
01e7 : cd0d00 call ccgint
|
0228 : cd4800 call ccgint
|
01ea : e5 push hl
|
022b : e5 push hl
|
01eb : cdf001 call __outint
|
022c : cd3102 call __outint
|
01ee : c1 pop bc
|
022f : c1 pop bc
|
;}
|
;}
|
01ef : c9 ret
|
0230 : c9 ret
|
;// function copied from c80dos.c
|
;// function copied from c80dos.c
|
;outint(n)
|
;outint(n)
|
01f0 : __outint:
|
0231 : __outint:
|
;int n;
|
;int n;
|
;{
|
;{
|
;int q;
|
;int q;
|
01f0 : c5 push bc
|
0231 : c5 push bc
|
; q = n/10;
|
; q = n/10;
|
01f1 : 210000 ld hl,0
|
0232 : 210000 ld hl,0
|
01f4 : 39 add hl,sp
|
0235 : 39 add hl,sp
|
01f5 : e5 push hl
|
0236 : e5 push hl
|
01f6 : 210600 ld hl,6
|
0237 : 210600 ld hl,6
|
01f9 : 39 add hl,sp
|
023a : 39 add hl,sp
|
01fa : cd0d00 call ccgint
|
AS80 Assembler for i8080-Z180 [1.11]. Page 13
|
01fd : e5 push hl
|
|
01fe : 210a00 ld hl,10
|
|
0201 : d1 pop de
|
|
0202 : cdd300 call ccdiv
|
|
0205 : d1 pop de
|
|
0206 : cd1500 call ccpint
|
|
; if (q) outint(q);
|
|
0209 : 210000 ld hl,0
|
|
020c : 39 add hl,sp
|
|
020d : cd0d00 call ccgint
|
|
0210 : 7c ld a,h
|
|
0211 : b5 or l
|
|
0212 : ca2102 jp z,cc9
|
|
0215 : 210000 ld hl,0
|
|
0218 : 39 add hl,sp
|
|
0219 : cd0d00 call ccgint
|
|
021c : e5 push hl
|
|
021d : cdf001 call __outint
|
|
0220 : c1 pop bc
|
|
; sendbyte('0'+(n-q*10));
|
|
0221 : cc9:
|
|
0221 : 213000 ld hl,48
|
|
0224 : e5 push hl
|
|
0225 : 210600 ld hl,6
|
|
0228 : 39 add hl,sp
|
|
0229 : cd0d00 call ccgint
|
|
022c : e5 push hl
|
|
022d : 210400 ld hl,4
|
|
0230 : 39 add hl,sp
|
|
0231 : cd0d00 call ccgint
|
|
0234 : e5 push hl
|
|
0235 : 210a00 ld hl,10
|
|
0238 : d1 pop de
|
|
0239 : cdb300 call ccmult
|
|
AS80 Assembler for i8080-Z180 [1.11]. Page 12
|
|
--------------------------------- HELLO.ASM ----------------------------------
|
--------------------------------- HELLO.ASM ----------------------------------
|
|
|
023c : d1 pop de
|
023b : cd4800 call ccgint
|
023d : cda000 call ccsub
|
023e : e5 push hl
|
0240 : d1 pop de
|
023f : 210a00 ld hl,10
|
0241 : 19 add hl,de
|
0242 : d1 pop de
|
0242 : e5 push hl
|
0243 : cd0e01 call ccdiv
|
0243 : cd3101 call __sendbyte
|
0246 : d1 pop de
|
0246 : c1 pop bc
|
0247 : cd5000 call ccpint
|
|
; if (q) outint(q);
|
|
024a : 210000 ld hl,0
|
|
024d : 39 add hl,sp
|
|
024e : cd4800 call ccgint
|
|
0251 : 7c ld a,h
|
|
0252 : b5 or l
|
|
0253 : ca6202 jp z,cc9
|
|
0256 : 210000 ld hl,0
|
|
0259 : 39 add hl,sp
|
|
025a : cd4800 call ccgint
|
|
025d : e5 push hl
|
|
025e : cd3102 call __outint
|
|
0261 : c1 pop bc
|
|
; sendbyte('0'+(n-q*10));
|
|
0262 : cc9:
|
|
0262 : 213000 ld hl,48
|
|
0265 : e5 push hl
|
|
0266 : 210600 ld hl,6
|
|
0269 : 39 add hl,sp
|
|
026a : cd4800 call ccgint
|
|
026d : e5 push hl
|
|
026e : 210400 ld hl,4
|
|
0271 : 39 add hl,sp
|
|
0272 : cd4800 call ccgint
|
|
0275 : e5 push hl
|
|
0276 : 210a00 ld hl,10
|
|
0279 : d1 pop de
|
|
027a : cdee00 call ccmult
|
|
027d : d1 pop de
|
|
027e : cddb00 call ccsub
|
|
0281 : d1 pop de
|
|
0282 : 19 add hl,de
|
|
0283 : e5 push hl
|
|
0284 : cd6c01 call __sendbyte
|
|
0287 : c1 pop bc
|
;}
|
;}
|
0247 : c1 pop bc
|
0288 : c1 pop bc
|
0248 : c9 ret
|
0289 : c9 ret
|
;// sends a hexadecimal value to the UART
|
;// sends a hexadecimal value to the UART
|
;printhex(hval)
|
;printhex(hval)
|
0249 : __printhex:
|
028a : __printhex:
|
;int hval;
|
;int hval;
|
;{
|
;{
|
;int q;
|
;int q;
|
0249 : c5 push bc
|
028a : c5 push bc
|
; q = hval/16;
|
; q = hval/16;
|
024a : 210000 ld hl,0
|
028b : 210000 ld hl,0
|
024d : 39 add hl,sp
|
028e : 39 add hl,sp
|
024e : e5 push hl
|
028f : e5 push hl
|
024f : 210600 ld hl,6
|
0290 : 210600 ld hl,6
|
0252 : 39 add hl,sp
|
0293 : 39 add hl,sp
|
0253 : cd0d00 call ccgint
|
0294 : cd4800 call ccgint
|
0256 : e5 push hl
|
0297 : e5 push hl
|
0257 : 211000 ld hl,16
|
0298 : 211000 ld hl,16
|
025a : d1 pop de
|
029b : d1 pop de
|
025b : cdd300 call ccdiv
|
AS80 Assembler for i8080-Z180 [1.11]. Page 14
|
025e : d1 pop de
|
|
025f : cd1500 call ccpint
|
|
; if (q) printhex(q);
|
|
0262 : 210000 ld hl,0
|
|
0265 : 39 add hl,sp
|
|
0266 : cd0d00 call ccgint
|
|
0269 : 7c ld a,h
|
|
026a : b5 or l
|
|
026b : ca7a02 jp z,cc10
|
|
026e : 210000 ld hl,0
|
|
0271 : 39 add hl,sp
|
|
0272 : cd0d00 call ccgint
|
|
0275 : e5 push hl
|
|
0276 : cd4902 call __printhex
|
|
0279 : c1 pop bc
|
|
; q = hval-q*16;
|
|
027a : cc10:
|
|
027a : 210000 ld hl,0
|
|
027d : 39 add hl,sp
|
|
027e : e5 push hl
|
|
027f : 210600 ld hl,6
|
|
0282 : 39 add hl,sp
|
|
0283 : cd0d00 call ccgint
|
|
0286 : e5 push hl
|
|
0287 : 210400 ld hl,4
|
|
028a : 39 add hl,sp
|
|
028b : cd0d00 call ccgint
|
|
028e : e5 push hl
|
|
028f : 211000 ld hl,16
|
|
0292 : d1 pop de
|
|
0293 : cdb300 call ccmult
|
|
0296 : d1 pop de
|
|
0297 : cda000 call ccsub
|
|
029a : d1 pop de
|
|
AS80 Assembler for i8080-Z180 [1.11]. Page 13
|
|
--------------------------------- HELLO.ASM ----------------------------------
|
--------------------------------- HELLO.ASM ----------------------------------
|
|
|
029b : cd1500 call ccpint
|
029c : cd0e01 call ccdiv
|
; if (q > 9)
|
029f : d1 pop de
|
029e : 210000 ld hl,0
|
02a0 : cd5000 call ccpint
|
02a1 : 39 add hl,sp
|
; if (q) printhex(q);
|
02a2 : cd0d00 call ccgint
|
02a3 : 210000 ld hl,0
|
02a5 : e5 push hl
|
02a6 : 39 add hl,sp
|
02a6 : 210900 ld hl,9
|
02a7 : cd4800 call ccgint
|
02a9 : d1 pop de
|
02aa : 7c ld a,h
|
02aa : cd3c00 call ccgt
|
02ab : b5 or l
|
02ad : 7c ld a,h
|
02ac : cabb02 jp z,cc10
|
02ae : b5 or l
|
02af : 210000 ld hl,0
|
02af : cacf02 jp z,cc11
|
02b2 : 39 add hl,sp
|
; sendbyte('A'+q-10);
|
02b3 : cd4800 call ccgint
|
02b2 : 214100 ld hl,65
|
02b6 : e5 push hl
|
02b5 : e5 push hl
|
02b7 : cd8a02 call __printhex
|
02b6 : 210200 ld hl,2
|
02ba : c1 pop bc
|
02b9 : 39 add hl,sp
|
; q = hval-q*16;
|
02ba : cd0d00 call ccgint
|
02bb : cc10:
|
02bd : d1 pop de
|
02bb : 210000 ld hl,0
|
02be : 19 add hl,de
|
02be : 39 add hl,sp
|
02bf : e5 push hl
|
02bf : e5 push hl
|
02c0 : 210a00 ld hl,10
|
02c0 : 210600 ld hl,6
|
02c3 : d1 pop de
|
02c3 : 39 add hl,sp
|
02c4 : cda000 call ccsub
|
02c4 : cd4800 call ccgint
|
02c7 : e5 push hl
|
02c7 : e5 push hl
|
02c8 : cd3101 call __sendbyte
|
02c8 : 210400 ld hl,4
|
02cb : c1 pop bc
|
02cb : 39 add hl,sp
|
|
02cc : cd4800 call ccgint
|
|
02cf : e5 push hl
|
|
02d0 : 211000 ld hl,16
|
|
02d3 : d1 pop de
|
|
02d4 : cdee00 call ccmult
|
|
02d7 : d1 pop de
|
|
02d8 : cddb00 call ccsub
|
|
02db : d1 pop de
|
|
02dc : cd5000 call ccpint
|
|
; if (q > 9)
|
|
02df : 210000 ld hl,0
|
|
02e2 : 39 add hl,sp
|
|
02e3 : cd4800 call ccgint
|
|
02e6 : e5 push hl
|
|
02e7 : 210900 ld hl,9
|
|
02ea : d1 pop de
|
|
02eb : cd7700 call ccgt
|
|
02ee : 7c ld a,h
|
|
02ef : b5 or l
|
|
02f0 : ca1003 jp z,cc11
|
|
; sendbyte('A'+q-10);
|
|
02f3 : 214100 ld hl,65
|
|
02f6 : e5 push hl
|
|
02f7 : 210200 ld hl,2
|
|
02fa : 39 add hl,sp
|
|
02fb : cd4800 call ccgint
|
|
02fe : d1 pop de
|
|
02ff : 19 add hl,de
|
|
0300 : e5 push hl
|
|
0301 : 210a00 ld hl,10
|
|
0304 : d1 pop de
|
|
0305 : cddb00 call ccsub
|
|
0308 : e5 push hl
|
|
0309 : cd6c01 call __sendbyte
|
|
030c : c1 pop bc
|
|
AS80 Assembler for i8080-Z180 [1.11]. Page 15
|
|
--------------------------------- HELLO.ASM ----------------------------------
|
|
|
; else
|
; else
|
02cc : c3e102 jp cc12
|
030d : c32203 jp cc12
|
02cf : cc11:
|
0310 : cc11:
|
; sendbyte('0'+q);
|
; sendbyte('0'+q);
|
02cf : 213000 ld hl,48
|
0310 : 213000 ld hl,48
|
02d2 : e5 push hl
|
0313 : e5 push hl
|
02d3 : 210200 ld hl,2
|
0314 : 210200 ld hl,2
|
02d6 : 39 add hl,sp
|
0317 : 39 add hl,sp
|
02d7 : cd0d00 call ccgint
|
0318 : cd4800 call ccgint
|
02da : d1 pop de
|
031b : d1 pop de
|
02db : 19 add hl,de
|
031c : 19 add hl,de
|
02dc : e5 push hl
|
031d : e5 push hl
|
02dd : cd3101 call __sendbyte
|
031e : cd6c01 call __sendbyte
|
02e0 : c1 pop bc
|
0321 : c1 pop bc
|
02e1 : cc12:
|
0322 : cc12:
|
|
;}
|
|
0322 : c1 pop bc
|
|
0323 : c9 ret
|
|
;// external interrupt 0 service routine
|
|
;int0_isr()
|
|
0324 : __int0_isr:
|
|
;{
|
|
; printstr("Interrupt 0 was asserted."); nl();
|
|
0324 : 21d003 ld hl,cc1+0
|
|
0327 : e5 push hl
|
|
0328 : cdc401 call __printstr
|
|
032b : c1 pop bc
|
|
032c : cdb301 call __nl
|
;}
|
;}
|
02e1 : c1 pop bc
|
032f : c9 ret
|
02e2 : c9 ret
|
|
;// program main routine
|
;// program main routine
|
;main()
|
;main()
|
02e3 : __main:
|
0330 : __main:
|
;{
|
;{
|
; // configure UART baud rate - set to 9600 for 30MHz
|
; // configure UART baud rate - set to 9600 for 30MHz
|
; // BAUD = round(//16) = round(30e6
|
; // BAUD = round(//16) = round(30e6
|
; UBAUDL = 195;
|
;//MOTIMOTIMOTIMOTIMOTIMOTIMOTIMOTIMOTIMOTIMOTIMOTIMOT
|
02e3 : 21c300 ld hl,195
|
;//MOTIMOTIMOTIMOTIMOTIMOTIMOTIMOTIMOTIMOTIMOTIMOTIMOT
|
02e6 : 7d ld a,l
|
;// UBAUDL = 195;
|
02e7 : d381 out (129),a
|
; UBAUDL = 1;
|
|
0330 : 210100 ld hl,1
|
|
0333 : 7d ld a,l
|
|
0334 : d381 out (129),a
|
|
|
|
;//MOTIMOTIMOTIMOTIMOTIMOTIMOTIMOTIMOTIMOTIMOTIMOTIMOT
|
|
;//MOTIMOTIMOTIMOTIMOTIMOTIMOTIMOTIMOTIMOTIMOTIMOTIMOT
|
; UBAUDH = 0;
|
; UBAUDH = 0;
|
02e9 : 210000 ld hl,0
|
0336 : 210000 ld hl,0
|
02ec : 7d ld a,l
|
0339 : 7d ld a,l
|
02ed : d382 out (130),a
|
033a : d382 out (130),a
|
|
|
|
; // configure both ports to output and digital output
|
|
; P1DATA = 0x00;
|
|
033c : 210000 ld hl,0
|
|
033f : 7d ld a,l
|
|
0340 : d384 out (132),a
|
|
|
|
; P1DIR = 0xff;
|
|
0342 : 21ff00 ld hl,255
|
|
0345 : 7d ld a,l
|
|
0346 : d385 out (133),a
|
|
|
; // print message
|
AS80 Assembler for i8080-Z180 [1.11]. Page 16
|
AS80 Assembler for i8080-Z180 [1.11]. Page 14
|
|
--------------------------------- HELLO.ASM ----------------------------------
|
--------------------------------- HELLO.ASM ----------------------------------
|
|
|
|
; P2DATA = 0x00;
|
|
0348 : 210000 ld hl,0
|
|
034b : 7d ld a,l
|
|
034c : d386 out (134),a
|
|
|
|
; P2DIR = 0xff;
|
|
034e : 21ff00 ld hl,255
|
|
0351 : 7d ld a,l
|
|
0352 : d387 out (135),a
|
|
|
|
; // enable interrupt 0 only
|
|
; INTRENA = 0x01;
|
|
0354 : 210100 ld hl,1
|
|
0357 : 7d ld a,l
|
|
0358 : d388 out (136),a
|
|
|
|
; // enable CPU interrupt
|
|
;#asm
|
|
035a : fb ei
|
|
;
|
|
; // print message
|
; printstr("Hello World!!!"); nl();
|
; printstr("Hello World!!!"); nl();
|
02ef : 215c03 ld hl,cc1+0
|
035b : 21ea03 ld hl,cc1+26
|
02f2 : e5 push hl
|
035e : e5 push hl
|
02f3 : cd8301 call __printstr
|
035f : cdc401 call __printstr
|
02f6 : c1 pop bc
|
0362 : c1 pop bc
|
02f7 : cd7201 call __nl
|
0363 : cdb301 call __nl
|
; printstr("Dec value: "); printdec(tstary[1]); nl();
|
; printstr("Dec value: "); printdec(tstary[1]); nl();
|
02fa : 216b03 ld hl,cc1+15
|
0366 : 21f903 ld hl,cc1+41
|
02fd : e5 push hl
|
0369 : e5 push hl
|
02fe : cd8301 call __printstr
|
036a : cdc401 call __printstr
|
0301 : c1 pop bc
|
036d : c1 pop bc
|
0302 : 219f03 ld hl,__tstary
|
036e : 212d04 ld hl,__tstary
|
0305 : e5 push hl
|
0371 : e5 push hl
|
0306 : 210100 ld hl,1
|
0372 : 210100 ld hl,1
|
0309 : 29 add hl,hl
|
0375 : 29 add hl,hl
|
030a : d1 pop de
|
0376 : d1 pop de
|
030b : 19 add hl,de
|
0377 : 19 add hl,de
|
030c : cd0d00 call ccgint
|
0378 : cd4800 call ccgint
|
030f : e5 push hl
|
037b : e5 push hl
|
0310 : cdb401 call __printdec
|
037c : cdf501 call __printdec
|
0313 : c1 pop bc
|
037f : c1 pop bc
|
0314 : cd7201 call __nl
|
0380 : cdb301 call __nl
|
; printstr("Hex value: 0x"); printhex(tstary[0]); nl()
|
; printstr("Hex value: 0x"); printhex(tstary[0]); nl()
|
0317 : 217703 ld hl,cc1+27
|
0383 : 210504 ld hl,cc1+53
|
031a : e5 push hl
|
0386 : e5 push hl
|
031b : cd8301 call __printstr
|
0387 : cdc401 call __printstr
|
031e : c1 pop bc
|
038a : c1 pop bc
|
031f : 219f03 ld hl,__tstary
|
038b : 212d04 ld hl,__tstary
|
0322 : e5 push hl
|
038e : e5 push hl
|
0323 : 210000 ld hl,0
|
038f : 210000 ld hl,0
|
0326 : 29 add hl,hl
|
0392 : 29 add hl,hl
|
0327 : d1 pop de
|
0393 : d1 pop de
|
0328 : 19 add hl,de
|
0394 : 19 add hl,de
|
0329 : cd0d00 call ccgint
|
0395 : cd4800 call ccgint
|
032c : e5 push hl
|
0398 : e5 push hl
|
032d : cd4902 call __printhex
|
0399 : cd8a02 call __printhex
|
0330 : c1 pop bc
|
039c : c1 pop bc
|
0331 : cd7201 call __nl
|
039d : cdb301 call __nl
|
; printstr("Echoing received bytes: "); nl();
|
; // assert bit 0 of port 1 to test external interrupt
|
0334 : 218503 ld hl,cc1+41
|
; P1DATA = 0x01;
|
0337 : e5 push hl
|
03a0 : 210100 ld hl,1
|
0338 : cd8301 call __printstr
|
AS80 Assembler for i8080-Z180 [1.11]. Page 17
|
033b : c1 pop bc
|
--------------------------------- HELLO.ASM ----------------------------------
|
033c : cd7201 call __nl
|
|
|
03a3 : 7d ld a,l
|
|
03a4 : d384 out (132),a
|
|
|
;
|
;
|
|
; printstr("Echoing received bytes: "); nl();
|
|
03a6 : 211304 ld hl,cc1+67
|
|
03a9 : e5 push hl
|
|
03aa : cdc401 call __printstr
|
|
03ad : c1 pop bc
|
|
03ae : cdb301 call __nl
|
; // loop forever
|
; // loop forever
|
; while (1) {
|
; while (1) {
|
033f : cc13:
|
03b1 : cc13:
|
033f : 210100 ld hl,1
|
03b1 : 210100 ld hl,1
|
0342 : 7c ld a,h
|
03b4 : 7c ld a,h
|
0343 : b5 or l
|
03b5 : b5 or l
|
0344 : ca5b03 jp z,cc14
|
03b6 : cacf03 jp z,cc14
|
; // check if a new byte was received
|
; // check if a new byte was received
|
; if (getbyte())
|
; if (getbyte())
|
0347 : cd4f01 call __getbyte
|
03b9 : cd8c01 call __getbyte
|
034a : 7c ld a,h
|
03bc : 7c ld a,h
|
034b : b5 or l
|
03bd : b5 or l
|
034c : ca5803 jp z,cc15
|
03be : cacc03 jp z,cc15
|
; // echo the received byte to the UART
|
; // echo the received byte to the UART
|
; sendbyte(rxbyte);
|
; sendbyte(rxbyte);
|
034f : 3a9e03 ld a,(__rxbyte)
|
03c1 : 3a2c04 ld a,(__rxbyte)
|
0352 : cf call ccsxt
|
03c4 : cd4300 call ccsxt
|
AS80 Assembler for i8080-Z180 [1.11]. Page 15
|
03c7 : e5 push hl
|
--------------------------------- HELLO.ASM ----------------------------------
|
03c8 : cd6c01 call __sendbyte
|
|
03cb : c1 pop bc
|
0353 : e5 push hl
|
; }
|
0354 : cd3101 call __sendbyte
|
03cc : cc15:
|
0357 : c1 pop bc
|
03cc : c3b103 jp cc13
|
; }
|
03cf : cc14:
|
0358 : cc15:
|
|
0358 : c33f03 jp cc13
|
|
035b : cc14:
|
|
;}
|
;}
|
035b : c9 ret
|
03cf : c9 ret
|
;//---------------------------------------------------
|
;//---------------------------------------------------
|
;// Th.. Th.. Th.. Thats all folks !!!
|
;// Th.. Th.. Th.. Thats all folks !!!
|
;//---------------------------------------------------
|
;//---------------------------------------------------
|
035c : cc1:
|
03d0 : cc1:
|
035c : 48656c6c6f2057.. db 72,101,108,108,111,32,87,111,114,108
|
03d0 : 496e7465727275.. db 73,110,116,101,114,114,117,112,116,32
|
0366 : 64212121004465.. db 100,33,33,33,0,68,101,99,32,118
|
03da : 30207761732061.. db 48,32,119,97,115,32,97,115,115,101
|
0370 : 616c75653a2000.. db 97,108,117,101,58,32,0,72,101,120
|
03e4 : 727465642e0048.. db 114,116,101,100,46,0,72,101,108,108
|
037a : 2076616c75653a.. db 32,118,97,108,117,101,58,32,48,120
|
03ee : 6f20576f726c64.. db 111,32,87,111,114,108,100,33,33,33
|
0384 : 004563686f696e.. db 0,69,99,104,111,105,110,103,32,114
|
03f8 : 00446563207661.. db 0,68,101,99,32,118,97,108,117,101
|
038e : 65636569766564.. db 101,99,101,105,118,101,100,32,98,121
|
0402 : 3a200048657820.. db 58,32,0,72,101,120,32,118,97,108
|
0398 : 7465733a2000 db 116,101,115,58,32,0
|
040c : 75653a20307800.. db 117,101,58,32,48,120,0,69,99,104
|
039e : __rxbyte:
|
0416 : 6f696e67207265.. db 111,105,110,103,32,114,101,99,101,105
|
039e : 00 ds 1
|
0420 : 76656420627974.. db 118,101,100,32,98,121,116,101,115,58
|
039f : __tstary:
|
042a : 2000 db 32,0
|
039f : d2042e16 db -46,4,46,22
|
042c : __rxbyte:
|
|
042c : 00 ds 1
|
|
042d : __tstary:
|
|
042d : d2042e16 db -46,4,46,22
|
|
|
; --- End of Compilation ---
|
; --- End of Compilation ---
|
No errors in pass 2.
|
No errors in pass 2.
|