1 2 3 4 5 6 INCLUDE "z80_crt0.hdr" 7 8 9 SECTION code_compiler 10 11._placeholder 12 ld hl,i_1+0 13 push hl 14 ld hl,6 ;const 15 call l_gintspsp ; 16 ld hl,6 ;const 17 add hl,sp 18 call l_gint ; 19 push hl 20 ld a,3 21 call printf 22 pop bc 23 pop bc 24 pop bc 25 ret 26 27 28 29._s_fastcall 30 ld de,65535 ;const 31 ex de,hl 32 push de 33 push hl 34 ex de,hl 35 push hl 36 call _placeholder 37 pop bc 38 pop bc 39 pop bc 40 ret 41 42 43 44._test2 45 ld hl,_s_fastcall 46 push hl 47 ld hl,i_1+7 48 call _s_fastcall 49 pop hl 50 push hl 51 push hl 52 ld hl,i_1+20 53 pop af 54 ld bc,i_2 55 push bc 56 push af 57 ret 58.i_2 59 pop bc 60 ret 61 62 63 64._s_regular 65 ld hl,65535 ;const 66 push hl 67 ld hl,4 ;const 68 add hl,sp 69 call l_gint ; 70 push hl 71 call _placeholder 72 pop bc 73 pop bc 74 ret 75 76 77 78._test3 79 ld hl,_s_regular 80 push hl 81 ld hl,i_1+26 82 push hl 83 call _s_regular 84 pop bc 85 pop hl 86 push hl 87 push hl 88 ld hl,i_1+39 89 ex (sp),hl 90 call l_jphl 91 pop bc 92 pop bc 93 ret 94 95 96 97._is_regular 98 ld hl,4 ;const 99 call l_gintspsp ; 100 ld hl,4 ;const 101 add hl,sp 102 call l_gint ; 103 push hl 104 call _placeholder 105 pop bc 106 pop bc 107 ret 108 109 110 111._test4 112 ld hl,_is_regular 113 push hl 114 ld hl,10 ;const 115 push hl 116 ld hl,i_1+45 117 push hl 118 call _is_regular 119 pop bc 120 pop bc 121 ld hl,0 ;const 122 add hl,sp 123 call l_gint 124 ld bc,4 ;const 125 push bc 126 push hl 127 ld hl,i_1+58 128 ex (sp),hl 129 call l_jphl 130 pop bc 131 pop bc 132 pop bc 133 ret 134 135 136 137._l_regular 138 ld hl,i_1+64 139 push hl 140 ld hl,4 ;const 141 add hl,sp 142 call l_glong 143 push de 144 push hl 145 ld a,3 146 call printf 147 pop bc 148 pop bc 149 pop bc 150 ret 151 152 153 154._test5 155 ld hl,_l_regular 156 push hl 157 ld hl,101 ;const 158 ld de,0 159 push de 160 push hl 161 call _l_regular 162 pop bc 163 pop bc 164 ld hl,0 ;const 165 call l_gintspsp ; 166 ld hl,65535 ;const 167 ld de,65535 168 ex de,hl 169 ex (sp),hl 170 push de 171 call l_jphl 172 pop bc 173 pop bc 174 pop bc 175 ret 176 177 178 179._d_fastcall 180 call dpush 181 ld hl,i_1+78 182 push hl 183 ld hl,2 ;const 184 add hl,sp 185 call dldpsh 186 ld a,4 187 call printf 188 pop bc 189 pop bc 190 pop bc 191 pop bc 192 pop bc 193 pop bc 194 pop bc 195 ret 196 197 198 199._test6 200 ld hl,_d_fastcall 201 push hl 202 ld hl,20 ;const 203 call l_int2long_u_float 204 call _d_fastcall 205 ld hl,0 ;const 206 call l_gintspsp ; 207 ld hl,1 ;const 208 call l_int2long_u_float 209 pop af 210 ld bc,i_3 211 push bc 212 push af 213 ret 214.i_3 215 pop bc 216 ret 217 218 219 220._ll_fastcall 221 push de 222 push hl 223 ld hl,i_1+94 224 push hl 225 ld hl,8 ;const 226 add hl,sp 227 call l_glong2sp 228 ld hl,6 ;const 229 add hl,sp 230 call l_glong 231 push de 232 push hl 233 ld a,5 234 call printf 235 pop bc 236 pop bc 237 pop bc 238 pop bc 239 pop bc 240 pop bc 241 pop bc 242 ret 243 244 245 246._test7 247 ld hl,_ll_fastcall 248 push hl 249 ld hl,100 ;const 250 ld de,0 251 push de 252 push hl 253 ld hl,65526 ;const 254 ld de,65535 255 call _ll_fastcall 256 pop bc 257 pop bc 258 ld hl,0 ;const 259 call l_gintspsp ; 260 ld hl,10 ;const 261 ld de,0 262 ex de,hl 263 ex (sp),hl 264 push de 265 push hl 266 ld hl,65535 ;const 267 ld de,65535 268 pop af 269 ld bc,i_4 270 push bc 271 push af 272 ret 273.i_4 274 pop bc 275 pop bc 276 pop bc 277 ret 278 279 280 281._is_fastcall 282 push hl 283 ld hl,4 ;const 284 call l_gintspsp ; 285 pop bc 286 pop hl 287 push hl 288 push bc 289 push hl 290 call _placeholder 291 pop bc 292 pop bc 293 pop bc 294 ret 295 296 297 298._test1 299 ld hl,_is_fastcall 300 push hl 301 ld hl,10 ;const 302 push hl 303 ld hl,i_1+111 304 call _is_fastcall 305 pop bc 306 ld hl,0 ;const 307 add hl,sp 308 call l_gint 309 ld bc,1 ;const 310 push bc 311 push hl 312 ld hl,i_1+124 313 pop af 314 ld bc,i_5 315 push bc 316 push af 317 ret 318.i_5 319 pop bc 320 pop bc 321 ret 322 323 324 325._main 326 call _test1 327 call _test2 328 call _test3 329 call _test4 330 call _test5 331 call _test6 332 call _test7 333 ld hl,0 ;const 334 ret 335 336 337 SECTION rodata_compiler 338.i_1 339 defm "%d %s" 340 defb 10 341 342 defm "" 343 defb 0 344 345 defm "test2-direct" 346 defb 0 347 348 defm "test2" 349 defb 0 350 351 defm "test3-direct" 352 defb 0 353 354 defm "test3" 355 defb 0 356 357 defm "test4-direct" 358 defb 0 359 360 defm "test4" 361 defb 0 362 363 defm "Long val %ld" 364 defb 10 365 366 defm "" 367 defb 0 368 369 defm "Double val %lf" 370 defb 10 371 372 defm "" 373 defb 0 374 375 defm "A = %ld b = %ld" 376 defb 10 377 378 defm "" 379 defb 0 380 381 defm "test1-direct" 382 defb 0 383 384 defm "test1" 385 defb 0 386 387 388 389 SECTION bss_compiler 390 SECTION code_compiler 391 392 393 394 GLOBAL open 395 GLOBAL creat 396 GLOBAL close 397 GLOBAL read 398 GLOBAL write 399 GLOBAL lseek 400 GLOBAL readbyte 401 GLOBAL writebyte 402 GLOBAL getcwd 403 GLOBAL chdir 404 GLOBAL getwd 405 GLOBAL rmdir 406 GLOBAL _RND_BLOCKSIZE 407 GLOBAL rnd_loadblock 408 GLOBAL rnd_saveblock 409 GLOBAL rnd_erase 410 GLOBAL __FOPEN_MAX 411 GLOBAL __sgoioblk 412 GLOBAL __sgoioblk_end 413 GLOBAL fopen_zsock 414 GLOBAL fileno 415 GLOBAL fopen 416 GLOBAL freopen 417 GLOBAL fdopen 418 GLOBAL _freopen1 419 GLOBAL fmemopen 420 GLOBAL funopen 421 GLOBAL fclose 422 GLOBAL fflush 423 GLOBAL closeall 424 GLOBAL fgets 425 GLOBAL fputs 426 GLOBAL fputc 427 GLOBAL fputs_callee 428 GLOBAL fputc_callee 429 GLOBAL fgetc 430 GLOBAL ungetc 431 GLOBAL feof 432 GLOBAL ferror 433 GLOBAL puts 434 GLOBAL ftell 435 GLOBAL fgetpos 436 GLOBAL fseek 437 GLOBAL fread 438 GLOBAL fwrite 439 GLOBAL gets 440 GLOBAL printf 441 GLOBAL fprintf 442 GLOBAL sprintf 443 GLOBAL snprintf 444 GLOBAL vfprintf 445 GLOBAL vsnprintf 446 GLOBAL printn 447 GLOBAL scanf 448 GLOBAL fscanf 449 GLOBAL sscanf 450 GLOBAL vfscanf 451 GLOBAL vsscanf 452 GLOBAL getarg 453 GLOBAL fchkstd 454 GLOBAL fgetc_cons 455 GLOBAL fgetc_cons_inkey 456 GLOBAL fputc_cons 457 GLOBAL fgets_cons 458 GLOBAL puts_cons 459 GLOBAL fabandon 460 GLOBAL fdtell 461 GLOBAL fdgetpos 462 GLOBAL rename 463 GLOBAL remove 464 GLOBAL getk 465 GLOBAL getk_inkey 466 GLOBAL printk 467 GLOBAL perror 468 GLOBAL set_fputc_cons 469 GLOBAL fputc_cons_native 470 GLOBAL fputc_cons_generic 471 GLOBAL fputc_cons_ansi 472 GLOBAL _placeholder 473 GLOBAL _s_fastcall 474 GLOBAL _test2 475 GLOBAL _s_regular 476 GLOBAL _test3 477 GLOBAL _is_regular 478 GLOBAL _test4 479 GLOBAL _l_regular 480 GLOBAL _test5 481 GLOBAL _d_fastcall 482 GLOBAL _test6 483 GLOBAL _ll_fastcall 484 GLOBAL _test7 485 GLOBAL _is_fastcall 486 GLOBAL _test1 487 GLOBAL _main 488 489 490 491 492