From 1c9a83c7a47937dd9a8629bd1e9971df30b36d4a Mon Sep 17 00:00:00 2001 From: Zorchenhimer Date: Sat, 20 Sep 2025 22:37:46 -0400 Subject: [PATCH] Add OP codes 89, B5, B6, AF, & B0 - 0x89 DrawString - 0xB5 StringCopy - 0xB6 4E_to_471A (needs a better name) - 0xAF StrToArgA - 0xB0 ArgAToStr --- labels.mlb | 47 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/labels.mlb b/labels.mlb index b733c18..b73fdab 100644 --- a/labels.mlb +++ b/labels.mlb @@ -91,9 +91,24 @@ NesPrgRom:0551:LC551_loop NesPrgRom:055F:LC55F_exit NesPrgRom:05BC:LC5BC NesPrgRom:06AA:LC6AA -NesPrgRom:0724:Handler_89 -NesPrgRom:0745:LC745_loop +NesPrgRom:0724:Handler_89_DrawString:\nDraws a string using characters\nfrom the ROM's character set. +NesPrgRom:073E:L073E_loop +NesPrgRom:0745:L0745_loop +NesPrgRom:074D:L074D +NesPrgRom:0762:L0762 +NesPrgRom:0768:L0768_next +NesPrgRom:076E:L076E NesPrgRom:0778:Handler_F1 +NesPrgRom:07D5:L07D5_end +NesPrgRom:0884:L0884_LoadPRGCHR:\nSome kinda character load routine +NesPrgRom:0890::A <- stack +NesPrgRom:0891::A -> X +NesPrgRom:0892::A <- X +NesPrgRom:0893::A -> stack +NesPrgRom:08C8:L08C8 +NesPrgRom:08ED:L08ED +NesPrgRom:094A:L094A_loop +NesPrgRom:096F:L096F_loop NesPrgRom:09A1:Handler_D4_SetCursorLoc NesPrgRom:09B3:Handler_E2_SetupSprite:ArgA: Attribute\nArbB-ArgC: a pointer\nArgD-ArgF: ???\nArgG: sprite index+64 NesPrgRom:09FA:LC9FA_loop @@ -738,6 +753,7 @@ NesPrgRom:420D:L820D_SwapToRamBank0 NesPrgRom:421C:L821C_RestorePrevRamBank NesPrgRom:422C:L822C_RamBankB_Check:If $45FE is negative, chop\noff the top bit, shift it\nleft 4 times (high nibble to\nlow), and store that into\nRamBank_B. Clear this high\nnibble from $45FE at the end. NesPrgRom:4241:L4241 +NesPrgRom:4242:L4242 NesPrgRom:424B:L824B NesPrgRom:424C:L824C NesPrgRom:424D:Handler_81_InfLoop:Handler for bytecode $81.\nInfinite loop. @@ -822,7 +838,7 @@ NesPrgRom:459C:L459C NesPrgRom:45A3:L45A3 NesPrgRom:45BE:L45BE NesPrgRom:45C8:L45C8 -NesPrgRom:45D4:Handler_B7_DerefPointer:\nDeref **CodePointer\nCode has a pointer. deref it +NesPrgRom:45D4:Handler_B7_DerefPointer:\nDeref **CodePointer\nCode has an inline pointer.\nderef it & put it on the stack. NesPrgRom:45D7:L45D7_loop NesPrgRom:45EA:L45EA NesPrgRom:45ED:L45ED_loop @@ -840,7 +856,7 @@ NesPrgRom:464F:L464F_loop NesPrgRom:4664:L4664 NesPrgRom:4667::string buffers on stack are always 32-bytes NesPrgRom:466F:L466F -NesPrgRom:4670:Handler_B9_IndexedDeref +NesPrgRom:4670:Handler_B9_IndexedDeref:\nPush the value at the inline\naddress + word offset from stack. NesPrgRom:4676:L4676 NesPrgRom:4688:L4688 NesPrgRom:4689:Handler_BC_PushStringToStack_FromTable:Push a string from table\n(addr inline, offset stack)\nto the stack. @@ -867,11 +883,12 @@ NesPrgRom:473D:Handler_BE_WriteToWordTable:Base addr inline\nOffset in stack\nWr NesPrgRom:474B:L474B NesPrgRom:474E:L474E NesPrgRom:4756:Handler_EA_WriteToStringTable:Base addr inline\nOffset in stack\nWrites 32 bytes from stack -NesPrgRom:476F:L876F_ShiftStackToArgA:\nArgA = (Stack*2)+Inline +NesPrgRom:476F:L876F_CalcAddrOffset:\nArgA = (Stack*2)+Inline\n\nCalculate address using inline\nas the base and the stack value as\na word offset. NesPrgRom:4772:L4772:\nInline word -> ArgB -NesPrgRom:4785:L4785 +NesPrgRom:4785:L4785:\nPop word -> ArgA NesPrgRom:4790:L4790 -NesPrgRom:4793:L4793:\nPop word -> ArgA +NesPrgRom:4793:L4793 +NesPrgRom:479B: NesPrgRom:47AD:L87AD_IndexedDeref_StringTable:Index into a string table.\nBase addr is inline.\nOffset is on stack. NesPrgRom:47B0:L87B0_loop:\ninline arg -> ArgB NesPrgRom:47C3:L87C3 @@ -1366,14 +1383,20 @@ NesPrgRom:6A1C:L6A1C NesPrgRom:6A4A:L6A4A NesPrgRom:6A5A:L6A5A NesPrgRom:6A83:Handler_B4 -NesPrgRom:6AB1:Handler_B5 -NesPrgRom:6ADD:Handler_B6 +NesPrgRom:6AB1:Handler_B5_StringCopy:Copy (Word_471A) to (Word_4E) then\nincrement Word_471A by number of\nbytes copied. +NesPrgRom:6AB6::RTS if < #$60 +NesPrgRom:6AC4:L6AC4_loop +NesPrgRom:6ADC:L6ADC_rts +NesPrgRom:6ADD:Handler_B6_4E_to_471A +NesPrgRom:6AE8:L6AE8 NesPrgRom:6B09:Handler_AD_Absolute:\nNegates Arg_A if negative NesPrgRom:6B11:Handler_AE_Compare:\nIf Arg_A < 0\n Return -1\nElse If ArgA == 0\n Return 0\nElse\n Return 1 NesPrgRom:6B20:LAB20_ne NesPrgRom:6B22:LAB22_eq NesPrgRom:6B29:LAB29_mi NesPrgRom:6B2D:LAB2D +NesPrgRom:6B30:Handler_AF_StrToArgA:Takes the first byte of the string\nat $0700 and puts it into ArgA+0. +NesPrgRom:6B3A:Handler_B0_ArgAToStr:Takes ArgA+0 and writes it to the\nfirst Word of the string at $0700. NesPrgRom:6C83:Handler_A8 NesPrgRom:6CEE:Handler_F2_InfLoop NesPrgRom:6E56:Handler_A9:ArgA DataID (used as a lookup into $6C01)\n\nupdates or restores nametable.\nlooks like it works on a portion\nof the screen, not the full screen. @@ -1721,6 +1744,8 @@ NesInternalRam:04B3:Byte_04B3 NesInternalRam:04B4:Byte_04B4 NesInternalRam:04B5:Byte_04B5 NesInternalRam:0500-05FF:Page_0500 +NesInternalRam:0600-0601:Word_0600 +NesInternalRam:0602-0603:Word_0602 NesInternalRam:0604:Byte_0604 NesInternalRam:0605:Byte_0605 NesInternalRam:0606:Byte_0606 @@ -1782,8 +1807,6 @@ NesWorkRam:0980-098F:Table_6980 NesWorkRam:0C01:Table_6C01 NesWorkRam:0C41-0C42:Table_6C41 NesWorkRam:0CC1-0CC2:Table_6CC1 -NesWorkRam:4880-497F:Table_6880 -NesWorkRam:4A00-4AFF:Table_6A00 NesWorkRam:8400:Byte_4400 NesWorkRam:8401-8403:ControllerStuff_4401 NesWorkRam:8404-8406:ControllerStuff_4404:controller pressed this frame @@ -1874,6 +1897,8 @@ NesWorkRam:8867-8869:Array_4867 NesWorkRam:886B:Byte_486B NesWorkRam:886C:Byte_486C NesWorkRam:886D-886E:Word_486D +NesWorkRam:8870:Byte_4870 +NesWorkRam:8871:Byte_4871 NesWorkRam:8873:Byte_4873 NesWorkRam:8874:Byte_4874 NesWorkRam:8875-8876:Word_4875